@@ -190,17 +190,19 @@ def _buildNcsSections(ncsMemMap, sampFreq, gapTolerance=0):
190190 and ncsMemMap ["sample_rate" ][0 ] == ncsMemMap ["sample_rate" ][- 1 ]
191191 and ncsMemMap ["timestamp" ][- 1 ] == predLastBlockStartTime
192192 ):
193- lastBlkEndTime = NcsSectionsFactory .calc_sample_time (sampFreq , ncsMemMap ["timestamp" ][- 1 ], ncsMemMap ["nb_valid" ][- 1 ])
193+ lastBlkEndTime = NcsSectionsFactory .calc_sample_time (
194+ sampFreq , ncsMemMap ["timestamp" ][- 1 ], ncsMemMap ["nb_valid" ][- 1 ]
195+ )
194196 n_samples = NcsSection ._RECORD_SIZE * (ncsMemMap .size - 1 ) + ncsMemMap ["nb_valid" ][- 1 ]
195197 section0 = NcsSection (
196- startRec = 0 ,
197- startTime = ncsMemMap ["timestamp" ][0 ],
198- endRec = ncsMemMap .size - 1 ,
199- endTime = lastBlkEndTime ,
200- n_samples = n_samples
201- )
198+ startRec = 0 ,
199+ startTime = ncsMemMap ["timestamp" ][0 ],
200+ endRec = ncsMemMap .size - 1 ,
201+ endTime = lastBlkEndTime ,
202+ n_samples = n_samples ,
203+ )
202204 ncsSects .sects .append (section0 )
203-
205+
204206 else :
205207 # need to parse all data block to detect gaps
206208 # check when the predicted timestamp is outside the tolerance
@@ -210,19 +212,19 @@ def _buildNcsSections(ncsMemMap, sampFreq, gapTolerance=0):
210212 gap_inds = np .flatnonzero (np .abs (delta - delta_prediction ) > gapTolerance )
211213 gap_inds += 1
212214
213- sections_limits = [ 0 ] + gap_inds .tolist () + [len (ncsMemMap )]
215+ sections_limits = [0 ] + gap_inds .tolist () + [len (ncsMemMap )]
214216
215217 for i in range (len (gap_inds ) + 1 ):
216218 start = sections_limits [i ]
217219 stop = sections_limits [i + 1 ]
218- duration = np .uint64 (1e6 / sampFreq * ncsMemMap ["nb_valid" ][stop - 1 ])
220+ duration = np .uint64 (1e6 / sampFreq * ncsMemMap ["nb_valid" ][stop - 1 ])
219221 ncsSects .sects .append (
220222 NcsSection (
221223 startRec = start ,
222224 startTime = ncsMemMap ["timestamp" ][start ],
223- endRec = stop - 1 ,
224- endTime = ncsMemMap ["timestamp" ][stop - 1 ] + duration ,
225- n_samples = np .sum (ncsMemMap ["nb_valid" ][start :stop ])
225+ endRec = stop - 1 ,
226+ endTime = ncsMemMap ["timestamp" ][stop - 1 ] + duration ,
227+ n_samples = np .sum (ncsMemMap ["nb_valid" ][start :stop ]),
226228 )
227229 )
228230
@@ -274,7 +276,6 @@ def build_for_ncs_file(ncsMemMap, nlxHdr, gapTolerance=None, strict_gap_mode=Tru
274276 # quarter of paquet size is tolerate
275277 gapTolerance = round (0.25 * NcsSection ._RECORD_SIZE * 1e6 / freq )
276278 ncsSects = NcsSectionsFactory ._buildNcsSections (ncsMemMap , freq , gapTolerance = gapTolerance )
277-
278279
279280 # take longer data block to compute reaal sampling rate
280281 # ind_max = np.argmax([section.n_samples for section in ncsSects.sects])
@@ -292,7 +293,6 @@ def build_for_ncs_file(ncsMemMap, nlxHdr, gapTolerance=None, strict_gap_mode=Tru
292293 ncsSects .sampFreqUsed = sampFreqUsed
293294 ncsSects .microsPerSampUsed = NcsSectionsFactory .get_micros_per_samp_for_freq (sampFreqUsed )
294295
295-
296296 elif acqType == "BML" or acqType == "ATLAS" :
297297 # BML & ATLAS style with fractional frequency and micros per samp
298298 if strict_gap_mode :
@@ -305,7 +305,6 @@ def build_for_ncs_file(ncsMemMap, nlxHdr, gapTolerance=None, strict_gap_mode=Tru
305305 ncsSects .sampFreqUsed = freq
306306 ncsSects .microsPerSampUsed = NcsSectionsFactory .get_micros_per_samp_for_freq (freq )
307307
308-
309308 else :
310309 raise TypeError ("Unknown Ncs file type from header." )
311310
0 commit comments