nestml icon indicating copy to clipboard operation
nestml copied to clipboard

Make GetStatus and SetStatus of generated models compatible

Open jougs opened this issue 7 years ago • 1 comments

This was formerly known as https://github.com/nest/nest-simulator/issues/248 and before that as nest.trac.577

GetStatus and SetStatus are complementary functions and it is reasonable to expect that the result of GetStatus can be used as input to SetStatus:

nest.SetStatus(nodes, nest.GetStatus(nodes))
nest.SetDefaults(model, nest.GetDefaults(model))

should work. Currently, it does not work (for almost all models). One reason for this is that GetStatus returns a number of read-only values; when these are sent to SetStatus, they are not read out and an UnaccessedDictionaryItem exception is raised.

Note: SetStatus does not provide a full reset!

old_status = nest.GetStatus(nodes)
... do something ...
nest.SetStatus(nodes, old_status)

will not fully reset the nodes, since SetStatus does not change the contents of buffers for incoming spikes and possibly other variables representing the history of the neuron.

jougs avatar Jun 29 '17 23:06 jougs

Related to #363: if set_status() fails at any stage, none of the parameters should be updated. This is achieved in NEST neuron models by making a temporary copy of the parameters struct, updating the copy, and only replacing the actual parameters by the copy at the very end, if everything checks out.

Related NEST simulator issue: https://github.com/nest/nest-simulator/issues/249

clinssen avatar Jan 10 '20 09:01 clinssen