Skip to content

TrajectoryAnalysis.resample fails with default args and only time events #71

Description

@ixjlyons
import condor


class ODE(condor.ODESystem):
    a = parameter()
    x = state()
    y = state()  # work around #70 

    dot[x] = -a * x


if True:
    class Ev(ODE.Event):
        at_time = 5
        update[x] = 1
        terminate = True
else:
    # function + terminate works
    class Ev(ODE.Event):
        function = x - 0.5
        update[x] = 1
        terminate = True


class Traj(ODE.TrajectoryAnalysis):
    tf = 10
    initial[x] = 1


sim = Traj(a=0.5)
sim_resamp = sim.resample(1.0)
Traceback (most recent call last):
  File "/home/krlyons/proj/condor/condor/.scratch/resample_idxs.py", line 30, in <module>
    sim_resamp = sim.resample(1.0)
  File "/home/krlyons/proj/condor/condor/src/condor/contrib.py", line 738, in resample
    xs[idx1 + 1, :] = self._res.x[x_interp_segment.idx1]
    ~~^^^^^^^^^^^^^
IndexError: index 8 is out of bounds for axis 0 with size 8

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions