@@ -96,6 +96,8 @@ def _parse_header(self):
9696 else :
9797 event_stream_names = []
9898
99+ self ._num_of_signal_streams = len (sig_stream_names )
100+
99101 # first loop to reassign stream by "stream_index" instead of "stream_name"
100102 self ._sig_streams = {}
101103 self ._evt_streams = {}
@@ -177,13 +179,13 @@ def _parse_header(self):
177179 continue
178180 stream_index = int (stream_id )
179181 # Neural signal
180- if stream_index < len ( sig_stream_names ) :
182+ if stream_index < self . _num_of_signal_streams :
181183 stream_name = sig_stream_names [stream_index ]
182184 buffer_id = stream_id
183185 # We add the buffers here as both the neural and the ADC channels are in the same buffer
184186 signal_buffers .append ((stream_name , buffer_id ))
185187 else : # This names the ADC streams
186- neural_stream_index = stream_index - len ( sig_stream_names )
188+ neural_stream_index = stream_index - self . _num_of_signal_streams
187189 neural_stream_name = sig_stream_names [neural_stream_index ]
188190 stream_name = f"{ neural_stream_name } _ADC"
189191 buffer_id = str (neural_stream_index )
@@ -461,9 +463,12 @@ def _channels_to_group_id(self, channel_indexes):
461463 return group_id
462464
463465 def _get_signal_t_start (self , block_index , seg_index , stream_index ):
464- if stream_index >= len (self ._sig_streams [block_index ][seg_index ]):
465- stream_index = stream_index - len (self ._sig_streams [block_index ][seg_index ])
466- t_start = self ._sig_streams [block_index ][seg_index ][stream_index ]["t_start" ]
466+ if stream_index < self ._num_of_signal_streams :
467+ _sig_stream_index = stream_index
468+ else :
469+ _sig_stream_index = stream_index - self ._num_of_signal_streams
470+
471+ t_start = self ._sig_streams [block_index ][seg_index ][_sig_stream_index ]["t_start" ]
467472 return t_start
468473
469474 def _spike_count (self , block_index , seg_index , unit_index ):
0 commit comments