@@ -52,7 +52,6 @@ def __init__(self, filename=""):
5252
5353 def _parse_header (self ):
5454
55-
5655 with open (self .filename , "rb" ) as fid :
5756 f = StructFile (fid )
5857
@@ -99,7 +98,6 @@ def _parse_header(self):
9998 if zname != zname2 .decode ("ascii" ).strip (" " ):
10099 raise NeoReadWriteError ("expected the zone name to match" )
101100
102-
103101 # "TRONCA" zone define segments
104102 zname2 , pos , length = zones ["TRONCA" ]
105103 f .seek (pos )
@@ -114,7 +112,7 @@ def _parse_header(self):
114112 break
115113 else :
116114 self .info_segments .append ((seg_start , trace_offset ))
117-
115+
118116 if len (self .info_segments ) == 0 :
119117 # one unique segment = general case
120118 self .info_segments .append ((0 , 0 ))
@@ -152,8 +150,9 @@ def _parse_header(self):
152150 (sampling_rate ,) = f .read_f ("H" )
153151 sampling_rate *= Rate_Min
154152 chan_id = str (c )
155- signal_channels .append ((chan_name , chan_id , sampling_rate , sig_dtype , units , gain , offset , stream_id , buffer_id ))
156-
153+ signal_channels .append (
154+ (chan_name , chan_id , sampling_rate , sig_dtype , units , gain , offset , stream_id , buffer_id )
155+ )
157156
158157 signal_channels = np .array (signal_channels , dtype = _signal_channel_dtype )
159158
@@ -166,31 +165,31 @@ def _parse_header(self):
166165 self ._sampling_rate = float (np .unique (signal_channels ["sampling_rate" ])[0 ])
167166
168167 # memmap traces buffer
169- full_signal_shape = get_memmap_shape (self .filename , sig_dtype , num_channels = Num_Chan , offset = Data_Start_Offset )
168+ full_signal_shape = get_memmap_shape (
169+ self .filename , sig_dtype , num_channels = Num_Chan , offset = Data_Start_Offset
170+ )
170171 seg_limits = [trace_offset for seg_start , trace_offset in self .info_segments ] + [full_signal_shape [0 ]]
171172 self ._t_starts = []
172- self ._buffer_descriptions = {0 : {}}
173+ self ._buffer_descriptions = {0 : {}}
173174 for seg_index in range (nb_segment ):
174175 seg_start , trace_offset = self .info_segments [seg_index ]
175176 self ._t_starts .append (seg_start / self ._sampling_rate )
176177
177178 start = seg_limits [seg_index ]
178179 stop = seg_limits [seg_index + 1 ]
179-
180+
180181 shape = (stop - start , Num_Chan )
181- file_offset = Data_Start_Offset + ( start * np .dtype (sig_dtype ).itemsize * Num_Chan )
182+ file_offset = Data_Start_Offset + (start * np .dtype (sig_dtype ).itemsize * Num_Chan )
182183 self ._buffer_descriptions [0 ][seg_index ] = {}
183184 self ._buffer_descriptions [0 ][seg_index ][buffer_id ] = {
184- "type" : "raw" ,
185- "file_path" : str (self .filename ),
186- "dtype" : sig_dtype ,
185+ "type" : "raw" ,
186+ "file_path" : str (self .filename ),
187+ "dtype" : sig_dtype ,
187188 "order" : "C" ,
188- "file_offset" : file_offset ,
189- "shape" : shape ,
189+ "file_offset" : file_offset ,
190+ "shape" : shape ,
190191 }
191192
192-
193-
194193 # Event channels
195194 event_channels = []
196195 event_channels .append (("Trigger" , "" , "event" ))
@@ -217,14 +216,9 @@ def _parse_header(self):
217216 for seg_index in range (nb_segment ):
218217 left_lim = seg_limits [seg_index ]
219218 right_lim = seg_limits [seg_index + 1 ]
220- keep = (
221- (rawevent ["start" ] >= left_lim )
222- & (rawevent ["start" ] < right_lim )
223- & (rawevent ["start" ] != 0 )
224- )
219+ keep = (rawevent ["start" ] >= left_lim ) & (rawevent ["start" ] < right_lim ) & (rawevent ["start" ] != 0 )
225220 self ._raw_events [- 1 ].append (rawevent [keep ])
226221
227-
228222 # No spikes
229223 spike_channels = []
230224 spike_channels = np .array (spike_channels , dtype = _spike_channel_dtype )
0 commit comments