spikeinterface icon indicating copy to clipboard operation
spikeinterface copied to clipboard

Times not propagated by `.save_to_memory()`

Open cwindolf opened this issue 1 year ago • 4 comments

I was a bit surprised to see that the following is possible:

rec = si.read_binary_folder(...)
rec1 = rec.save_to_memory()
print(rec.sample_index_to_time(0), rec1.sample_index_to_time(0))
# => 2451.763033333333, 0.0

I'm working around this by rec1.set_times(rec.get_times()), but it seems to me that since save() maintains the times when saving to other formats (like the binary folder), it should do that for memory mode as well.

cwindolf avatar Feb 26 '24 16:02 cwindolf

Is it based on time vector or t_start ?

samuelgarcia avatar Feb 26 '24 20:02 samuelgarcia

This particular recording has t_start and no time_vector

cwindolf avatar Feb 27 '24 18:02 cwindolf

To get it working, I ended up doing

rec1._recording_segments[0].t_start = rec0._recording_segments[0].t_start
rec1._kwargs["t_starts"] = [rec0._recording_segments[0].t_start]

cwindolf avatar Feb 29 '24 16:02 cwindolf

Related: https://github.com/SpikeInterface/spikeinterface/issues/2627

h-mayorquin avatar Jun 14 '24 19:06 h-mayorquin