NeuralEnsemble / python-neo

Neo is a package for representing electrophysiology data in Python, together with support for reading a wide range of neurophysiology file formats
http://neo.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
325 stars 248 forks source link

`SpikeGLXRecordingExtractor` missing `firstSample` #1253

Closed DradeAW closed 9 months ago

DradeAW commented 1 year ago

Issue from SpikeInterface/spikeinterface#1469

The first sample in a spikeGLX recording is missing with neo extracting, which is a piece of information that can be very useful.

samuelgarcia commented 1 year ago

I do not think we are removing the first sample. Maybe I am wring. I think the device itself do not have a strick synchronize rec start that can lead to one or several shift at startup.

DradeAW commented 1 year ago

I don't mean that you remove the first sample, I mean there is a variable firstSample in the meta file to know exactly when the recording started (and this can help to synchronize the AP and LFP channels since they don't start exactly at the same time).

This information is not extracted from the metadata file and thus in the SpikeInterface object there's no way to synchronize the 2 traces.

samuelgarcia commented 1 year ago

OK you mean we have an incorrect t_start ? Certainly. Can you make a PR ?

zm711 commented 9 months ago

@DradeAW, any interest in a patch? Or if you want to share a file with me I can work on a PR soon.

DradeAW commented 9 months ago

Unfortunately I don't think I have time to make a PR right now, But I'd love to have a little patch on this :)

zm711 commented 9 months ago

I might give this a go Monday. So I might ping you then to help test the PR :)

zm711 commented 9 months ago

@DradeAW

I was actually playing with this right now. And the firstSample is being returned from neo. You need to do this...

spikeglx = neo.rawio.SpikeGLXRawIO('path/to/data')
spikeglx.parse_header()
info = spikeglx.signals_info_list
first_sample = info[0]['meta']['firstSample'] # to get this for first file set

It is a little buried. I think you mostly work at the spikeinteface level. Maybe it is tossed in the spikeglx extractor, but neo is definitely getting the info.

DradeAW commented 9 months ago

Ok perfect, thanks!