3737import math
3838import numpy as np
3939
40+ from enum import IntEnum , auto
41+
42+
43+ class AcqType (IntEnum ):
44+ PRE4 = auto ()
45+ BML = auto ()
46+ DIGITALLYNX = auto ()
47+ DIGITALLYNXSX = auto ()
48+ CHEETAH64 = auto ()
49+ RAWDATAFILE = auto ()
50+ CHEETAH560 = auto ()
51+ ATLAS = auto ()
52+ UNKNOWN = auto ()
4053
4154class NcsSections :
4255 """
@@ -250,7 +263,7 @@ def build_for_ncs_file(ncsMemMap, nlxHdr, gapTolerance=None, strict_gap_mode=Tru
250263 acqType = nlxHdr .type_of_recording ()
251264 freq = nlxHdr ["sampling_rate" ]
252265
253- if acqType == " PRE4" :
266+ if acqType == AcqType . PRE4 :
254267 # Old Neuralynx style with truncated whole microseconds for actual sampling. This
255268 # restriction arose from the sampling being based on a master 1 MHz clock.
256269 microsPerSampUsed = math .floor (NcsSectionsFactory .get_micros_per_samp_for_freq (freq ))
@@ -266,7 +279,8 @@ def build_for_ncs_file(ncsMemMap, nlxHdr, gapTolerance=None, strict_gap_mode=Tru
266279 ncsSects .sampFreqUsed = sampFreqUsed
267280 ncsSects .microsPerSampUsed = microsPerSampUsed
268281
269- elif acqType in ["DIGITALLYNX" , "DIGITALLYNXSX" , "CHEETAH64" , "CHEETAH560" , "RAWDATAFILE" ]:
282+ elif acqType in [AcqType .DIGITALLYNX , AcqType .DIGITALLYNXSX , AcqType .CHEETAH64 ,
283+ AcqType .CHEETAH560 , AcqType .RAWDATAFILE ]:
270284 # digital lynx style with fractional frequency and micros per samp determined from block times
271285 if gapTolerance is None :
272286 if strict_gap_mode :
@@ -293,7 +307,7 @@ def build_for_ncs_file(ncsMemMap, nlxHdr, gapTolerance=None, strict_gap_mode=Tru
293307 ncsSects .sampFreqUsed = sampFreqUsed
294308 ncsSects .microsPerSampUsed = NcsSectionsFactory .get_micros_per_samp_for_freq (sampFreqUsed )
295309
296- elif acqType == " BML" or acqType == " ATLAS" :
310+ elif acqType == AcqType . BML or acqType == AcqType . ATLAS :
297311 # BML & ATLAS style with fractional frequency and micros per samp
298312 if strict_gap_mode :
299313 # this is the old behavior, maybe we could put 0.9 sample interval no ?
0 commit comments