Non-Uniform Sampling of Trajectory?

  • Mathis

    Mathis - 2012-11-27

    First of all thanks for creating such a great open source tool. I am currently simulating a quantum many-body system with it and I would need to sample the trajectory that is created at logarithmic places instead of uniformly with distance dt.
    Is there already a possibility for this or do I need to change the sample routine?

    All the best, Mathis

    P.S. Easiest would probably be if an array of precise times can be given at which the output is shown.

  • Rob Clewley

    Rob Clewley - 2012-11-27

    The solution is easy because you can "call" a trajectory object


    like a function. The sample method only sets up a linearly-separated array for calling the object in the same way. If you can precompute the log-separated array,


    , then your sample would be returned using


    . I'm pretty sure the default call is for 'precise' values, but you can force the option anyway. The standard trajectory attributes expose an independent variable interval so that you can determine the limits of your array.

    Linear interpolation will still be used between your mesh points, but don't forget that dopri/radau has a quasi-dense output such that you can increase the "refine" integer and get more mesh points back at the same accuracy with negligible extra cost. You can also select polynomial interpolation ('polyinterp' Boolean algparams flag), which will retain derivative data and give you quadratically accurate interpolation. This will be slow for large data sets, as the interpolator object is created in pure python after integration.

    Hope that helps.

  • Mathis

    Mathis - 2012-11-27

    Perfekt! It is really a beautiful project you produced.
    Thanks a lot for your help.


Log in to post a comment.