SpikeInterface / spikeinterface

A Python-based module for creating flexible and robust spike sorting pipelines.
https://spikeinterface.readthedocs.io
MIT License
495 stars 187 forks source link

set times propagation #3274

Open RobertoDF opened 1 month ago

RobertoDF commented 1 month ago

Hi, There is something not entirely clear in how time is managed: if i set the times to a recording object with recording.set_times(correct_times) and I sort that object the sorting object will not have the correct_times, so I have to do again

recording.set_times(correct_times)
sorting.register_recording(recording)

I find this quite unintuitive, is there an internal reason for this to be necessary? For example I cannot create a sorting analyzer directly with this: create_sorting_analyzer(sorting = read_sorter_folder(f"{path_recording_folder}/spike_interface_output/probe{group}"), recording=raw_rec.split_by(property="group")[group], **job_kwargs) because I always have to load the sorter first and register the times.

Thanks!!

zm711 commented 1 month ago

Hey @RobertoDF, there a currently a bunch of discussions about this: https://github.com/SpikeInterface/spikeinterface/issues/3157, https://github.com/SpikeInterface/spikeinterface/issues/3029, (and others I can't find at the moment). Basically we are trying to get times to work better and be more intuitive, but it is still a big discussion to figure out the best way to do this.

Maybe @alejoe91 has a better work-around for now.

RobertoDF commented 2 weeks ago

Times are propagated and saved to disk if I write to binary folder (save(format="binary")! didn´t know that!