You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I often want to probe some data from a Nengo model and save it to a file, either by calling np.savez myself or by returning a dict that later will be saved by the calling function. Unfortunately, I cannot directly use sim.data as dict to save because it is indexed by object instances (the probes). Thus, one has to define the probe and then manually list the conversion which often is in two different places (model definition vs. model execution and analysis):
withnengo.Network() asmodel:
# model ...p_something=nengo.Probe(some.sub.net.something, synapse=0.01)
# run simulation and do stuffnp.savez('foo.npz', something=sim.data[p_something])
Note, that I have to type out the name something three times (I don't count some.sub.net.something because I might want to use a different name for probing/saving) and if I probe multiple things, there is some repeated code (nengo.Probe, sim.data[...]).
It would be nice to have some way to do this with only one line per probed thing to map the probed thing to a name to save it under and maybe a final statement to give all those things as a string indexed dict.
I'm not entirely sure how this should look like and whether it is something to be included in core Nengo or maybe more appropriate for nengo_extras.
The text was updated successfully, but these errors were encountered:
I often want to probe some data from a Nengo model and save it to a file, either by calling
np.savez
myself or by returning adict
that later will be saved by the calling function. Unfortunately, I cannot directly usesim.data
as dict to save because it is indexed by object instances (the probes). Thus, one has to define the probe and then manually list the conversion which often is in two different places (model definition vs. model execution and analysis):Note, that I have to type out the name
something
three times (I don't countsome.sub.net.something
because I might want to use a different name for probing/saving) and if I probe multiple things, there is some repeated code (nengo.Probe
,sim.data[...]
).It would be nice to have some way to do this with only one line per probed thing to map the probed thing to a name to save it under and maybe a final statement to give all those things as a string indexed
dict
.I'm not entirely sure how this should look like and whether it is something to be included in core Nengo or maybe more appropriate for nengo_extras.
The text was updated successfully, but these errors were encountered: