@@ -84,12 +84,9 @@ class SpikeGLXRawIO(BaseRawWithBufferApiIO):
8484 -----
8585 * Contrary to other implementations this IO reads the entire folder and subfolders and:
8686 deals with several segments based on the `_gt0`, `_gt1`, `_gt2`, etc postfixes
87- deals with all signals "imec0", "imec1" for neuropixel probes and also
88- external signal like"nidq". This is the "device"
89- * For imec device both "ap" and "lf" are extracted so one device have several "streams"
90- * There are several versions depending the neuropixel probe generation (`1.x`/`2.x`/`3.x`)
91- * Here, we assume that the `meta` file has the same structure across all generations.
92- * This IO is developed based on neuropixel generation 2.0, single shank recordings.
87+ deals with all signals coming from different acquisition cards ("imec0", "imec1", etc) in a typical
88+ PXIe chassis and also external signal like"nidq". This is the "device"
89+ * For imec device both "ap" and "lf" are extracted so even a one device setup has several "streams"
9390
9491 Examples
9592 --------
@@ -125,7 +122,6 @@ def _parse_header(self):
125122 stream_names = sorted (list (srates .keys ()), key = lambda e : srates [e ])[::- 1 ]
126123 nb_segment = np .unique ([info ["seg_index" ] for info in self .signals_info_list ]).size
127124
128- # self._memmaps = {}
129125 self .signals_info_dict = {}
130126 # one unique block
131127 self ._buffer_descriptions = {0 : {}}
@@ -166,7 +162,6 @@ def _parse_header(self):
166162
167163 stream_id = stream_name
168164
169- stream_index = stream_names .index (info ["stream_name" ])
170165 signal_streams .append ((stream_name , stream_id , buffer_id ))
171166
172167 # add channels to global list
@@ -250,7 +245,6 @@ def _parse_header(self):
250245 # insert some annotation at some place
251246 self ._generate_minimal_annotations ()
252247 self ._generate_minimal_annotations ()
253- block_ann = self .raw_annotations ["blocks" ][0 ]
254248
255249 for seg_index in range (nb_segment ):
256250 seg_ann = self .raw_annotations ["blocks" ][0 ]["segments" ][seg_index ]
@@ -354,17 +348,17 @@ def scan_files(dirname):
354348 if len (info_list ) == 0 :
355349 raise FileNotFoundError (f"No appropriate combination of .meta and .bin files were detected in { dirname } " )
356350
357- # the segment index will depend on both 'gate_num' and 'trigger_num'
351+ # the segment index will depend on both 'gate_num' and 'trigger_num' and on "dock_num"
358352 # so we order by 'gate_num' then 'trigger_num'
359353 # None is before any int
360354 def make_key (info ):
361- k0 = info ["gate_num" ]
362- if k0 is None :
363- k0 = - 1
364- k1 = info ["trigger_num" ]
365- if k1 is None :
366- k1 = - 1
367- return (k0 , k1 )
355+ gate_num = info ["gate_num" ]
356+ if gate_num is None :
357+ gate_num = - 1
358+ trigger_num = info ["trigger_num" ]
359+ if trigger_num is None :
360+ trigger_num = - 1
361+ return (gate_num , trigger_num )
368362
369363 order_key = list ({make_key (info ) for info in info_list })
370364 order_key = sorted (order_key )
@@ -488,9 +482,21 @@ def extract_stream_info(meta_file, meta):
488482 else :
489483 # NIDQ case
490484 has_sync_trace = False
491- fname = Path (meta_file ).stem
485+
486+ bin_file_path = meta ["fileName" ]
487+ fname = Path (bin_file_path ).stem
488+
489+
490+ # First we check if the gate, trigger and dock numbers are present in the meta
491+
492+ probe_slot = meta .get ("imDatPrb_slot" , None )
493+ probe_port = meta .get ("imDatPrb_port" , None )
494+ probe_dock = meta .get ("imDatPrb_dock" , None )
495+
496+
492497 run_name , gate_num , trigger_num , device , stream_kind = parse_spikeglx_fname (fname )
493-
498+ # x = 1
499+
494500 if "imec" in fname .split ("." )[- 2 ]:
495501 device = fname .split ("." )[- 2 ]
496502 stream_kind = fname .split ("." )[- 1 ]
0 commit comments