Closed jmrohwer closed 7 years ago
Nice idea. I'll try it out asap, are there any other output arrays that would benefit from this?
Seems to work, the only thing I might suggest is instead of:
self._sim = numpy.rec.fromrecords(self.data_sim.getAllSimData(lbls=True)[0],
names=self.data_sim.getAllSimData(lbls=True)[1])'
doing something like:
data = self.data_sim.getAllSimData(lbls=True)
self._sim = numpy.rec.fromrecords(data[0], names=data[1])'
as it saves a function call. Otherwise good to go.
OK done and merged.
I have implemented the simulation results as a recarray
mod.sim
(much in the same way as for themod.scan
recarray). This is with lazy loading so the object is only created when it is called. This allows the user to conveniently access the simulation time and values of the variables:mod.Simulate()
mod.sim.Time
mod.sim.S1
mod.sim.R1
etc.These can then directly be used further in calculations or plotting. I have found this very useful in interactive work.