sPyNNaker icon indicating copy to clipboard operation
sPyNNaker copied to clipboard

pop.get_data (clear = true) vs neo.t_start

Open Christian-B opened this issue 3 years ago • 6 comments

We currently do support Population.get_data with the param clear=True

But.

  1. It only clear the current segment. Ie data collected before a reset remains.

  2. 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
  1. 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()

Christian-B avatar Nov 08 '22 07:11 Christian-B

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

Christian-B avatar Nov 08 '22 07:11 Christian-B

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...

rowleya avatar Nov 08 '22 07:11 rowleya

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... ?

andrewgait avatar Nov 08 '22 08:11 andrewgait

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

Christian-B avatar Nov 09 '22 06:11 Christian-B

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?

andrewgait avatar Sep 28 '23 10:09 andrewgait

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.

Christian-B avatar Sep 28 '23 14:09 Christian-B