sPyNNaker
sPyNNaker copied to clipboard
pop.get_data (clear = true) vs neo.t_start
We currently do support Population.get_data with the param clear=True
But.
-
It only clear the current segment. Ie data collected before a reset remains.
-
We do not update the Recorder._recording_start_time
- The Neo will have a t_start of 0
- The Neo will show nan Values for data before the clear
- get_data("Spikes", clear=True) does not clear the v data
Do we think these behaviours are desirable or need fixing?
to replicate: import pyNN.spiNNaker as sim
sim.setup(timestep=1.0) sim.set_number_of_neurons_per_core(sim.IF_curr_exp, 100) simtime = 10
pop_1 = sim.Population(1, sim.IF_curr_exp(), label="pop_1") input = sim.Population(1, sim.SpikeSourceArray(spike_times=[0,11]), label="input") input_proj = sim.Projection(input, pop_1, sim.OneToOneConnector(), synapse_type=sim.StaticSynapse(weight=5, delay=1)) pop_1.record(["spikes", "v"]) sim.run(simtime) neo = pop_1.get_data(variables=["spikes", "v"],clear=True) spikes = neo.segments[0].spiketrains print(spikes) v = neo.segments[0].filter(name='v')[0] print(v) sim.run(simtime)
neo = pop_1.get_data(variables=["spikes", "v"]) spikes = neo.segments[0].spiketrains print(spikes) v = neo.segments[0].filter(name='v')[0] print(v) sim.end()
Note the start time in Neo is for the whole segment so if one variable is cleared and another not it would be hard to update start time
I think the behaviours are correct; the clear means clear everything up to now on the variable I have chosen. This basically says I have done with the data before now and processed it, so save disk by clearing. There is a question as to whether this should clear the previous segments also...
I didn't think it was possible to do get_data and only get back the current segment. Doesn't the call always return all segments (assuming they haven't yet been cleared)? So if there is a call to get_data(..., clear=True) then it should collect all the data and then wipe it all... ?
http://neuralensemble.org/docs/PyNN/reference/populations.html shows NO way to get data for one/the current segment only.
A clear for multi segment data is currently (i think incorrectly) only wipes the current segments data. This is because clear was not considered in the cache data work,.
See: https://github.com/SpiNNakerManchester/sPyNNaker/issues/1249
I haven't really looked at this again since it was originally posted but I think the assumption that if the user says clear=True then they want to wipe all the data is a good one?
I do personally highly dislike the use of the clear flag.
No that the Human Brain Project is ending this will not be addressed until someone can explain the need for clear.