Menu

loadObjects() on Generator: object 't' is missing

Help
2015-04-26
2015-04-26
  • Maurizio De Pitta'

    Dear all,
    upon loading a generator DS by loadObjects() and try to continue the trajectory, I obtain get a suspicious error.

    The code is:

    DS   = Generator.VODE_odeSystem(DSargs)
    traj = DS.compute('start_pts')
    # Intermediate saving
    saveObjects([DS,DSargs,traj],'tmp.sav')
    
    <Quit session or replace objects by the saved ones>
    
    # Load objects
    [DS,DSargs,traj] = loadObjects('tmp.sav')
    traj = DS.compute('start_pts',dirn='c')
    

    And I get the following error:

    AttributeError
    >1 traj = DS.compute('start_pts',dirn='c')
    
    /usr/local/pydstool/PyDSTool/Generator/Vode_ODEsystem.pyc in compute(self, trajname, dirn, ics)
    130         indepdom0, indepdom1 = self.indepvariable.depdomain.get()
    131         if continue_integ:
    >132             if indepdom0 > self._solver.t:
    133                 print("Previous end time is %f"%self._solver.t)
    134                 raise ValueError("Start time not correctly updated for "
    
    AttributeError: 'ode' object has no attribute 't'
    

    Bug or am I doing something wrong?

    Thanks for your feedback.

    Cheers,

    M

     
  • Rob Clewley

    Rob Clewley - 2015-04-26

    The intention of 'continue' was not to allow this between python sessions. There is low level state in the DLL, _solver, that is not stored between sessions when you save the DS object, for instance the t attribute of the DLL. It's possible that I could get all of that transient state restored, but I'm not sure that all of it is accessible to the python layer. You could create an issue on github and I'll look into it.

    An easy solution to support this inter-session is to make a second trajectory that begins from the end of the first, and then append their pointsets and reform a new trajectory from those. The internal state of the solver is still not the same, as restarting will invoke fresh choices of step size, etc., but it should be adequate for most purposes.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.