python-neo icon indicating copy to clipboard operation
python-neo copied to clipboard

index error with a spikeglx neuropixels files

Open Saksham20 opened this issue 4 years ago • 4 comments

When I try to open a set of imec.ap.bin/imec.ap.meta files I get this error (when I pass the folder in which only these two files are present):

>>> from neo import SpikeGLXIO
>>> sg = SpikeGLXIO('/mnt/scrap/catalyst_neuro/sakshamsharda/shenoy/PrimateNeuropixel/P20180323')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/sakshamsharda/miniconda3/envs/giocomo_lab_nwb/lib/python3.7/site-packages/neo/io/spikeglxio.py", line 11, in __init__
    BaseFromRaw.__init__(self, dirname)
  File "/home/sakshamsharda/miniconda3/envs/giocomo_lab_nwb/lib/python3.7/site-packages/neo/io/basefromrawio.py", line 74, in __init__
    self.parse_header()
  File "/home/sakshamsharda/miniconda3/envs/giocomo_lab_nwb/lib/python3.7/site-packages/neo/rawio/baserawio.py", line 185, in parse_header
    self._parse_header()
  File "/home/sakshamsharda/miniconda3/envs/giocomo_lab_nwb/lib/python3.7/site-packages/neo/rawio/spikeglxrawio.py", line 67, in _parse_header
    self.signals_info_list = scan_files(self.dirname)
  File "/home/sakshamsharda/miniconda3/envs/giocomo_lab_nwb/lib/python3.7/site-packages/neo/rawio/spikeglxrawio.py", line 221, in scan_files
    seg_index = int(r[0][0])

The folder contains the files named: P20180613/P20180613.imec.ap.bin P20180613/P20180613.imec.ap.meta

Are the files expected to be in a specific naming format?

Saksham20 avatar Sep 22 '21 17:09 Saksham20

if a folder only contains 1 of .ap.bin and .meta file without the tags of '*.g0_t0.imec0*ap.in' in the file name, then would it make sense to assume only 1 segment and stream? Currently the header pulls the segment and stream from the file name like here .I'm not sure if the above mentioned file naming scheme is an edge case or something that can be incorporated into the api?

Saksham20 avatar Sep 28 '21 09:09 Saksham20

Yes of course. We have to change this and add any pattern which is possible. Can you make a PR ?

samuelgarcia avatar Sep 28 '21 10:09 samuelgarcia

@Saksham20 Any news on this?

JuliaSprenger avatar Mar 03 '22 13:03 JuliaSprenger

Same issue as https://github.com/NeuralEnsemble/python-neo/issues/1337 conceptually. Can be fixed together.

guptadivyansh avatar Dec 12 '23 16:12 guptadivyansh

I think with our newest version of spikeglx we cover many more regex possibilities. Feel free to reopen if the latest version doesn't cover your issue.

zm711 avatar Jul 08 '24 19:07 zm711