@@ -85,7 +85,13 @@ class NeuralynxRawIO(BaseRawIO):
8585 keep_original_times: bool, default: False
8686 If True, keep original start time as in files,
8787 Otherwise set 0 of time to first time in dataset
88-
88+ strict_gap_mode: bool, default: True
89+ Detect gaps using strict mode or not.
90+ * strict_gap_mode = True then a gap is consider when timstamp difference between two
91+ consequtive data packet is more than one sample interval.
92+ * strict_gap_mode = False then a gap has an increased tolerance. Some new system with different clock need this option
93+ otherwise, too many gaps are detected
94+
8995 Notes
9096 -----
9197 * This IO supports NCS, NEV, NSE and NTT file formats (not NVT or NRD yet)
@@ -125,7 +131,7 @@ class NeuralynxRawIO(BaseRawIO):
125131 ("samples" , "int16" , (NcsSection ._RECORD_SIZE )),
126132 ]
127133
128- def __init__ (self , dirname = "" , filename = "" , exclude_filename = None , keep_original_times = False , ** kargs ):
134+ def __init__ (self , dirname = "" , filename = "" , exclude_filename = None , keep_original_times = False , strict_gap_mode = True , ** kargs ):
129135
130136 if dirname != "" :
131137 self .dirname = dirname
@@ -137,6 +143,7 @@ def __init__(self, dirname="", filename="", exclude_filename=None, keep_original
137143 raise ValueError ("One of dirname or filename must be provided." )
138144
139145 self .keep_original_times = keep_original_times
146+ self .strict_gap_mode = strict_gap_mode
140147 self .exclude_filename = exclude_filename
141148 BaseRawIO .__init__ (self , ** kargs )
142149
@@ -790,7 +797,7 @@ def scan_stream_ncs_files(self, ncs_filenames):
790797
791798 verify_sec_struct = NcsSectionsFactory ._verifySectionsStructure
792799 if not chanSectMap or (not verify_sec_struct (data , chan_ncs_sections )):
793- chan_ncs_sections = NcsSectionsFactory .build_for_ncs_file (data , nlxHeader )
800+ chan_ncs_sections = NcsSectionsFactory .build_for_ncs_file (data , nlxHeader , strict_gap_mode = self . strict_gap_mode )
794801
795802 # register file section structure for all contained channels
796803 for chan_uid in zip (nlxHeader ["channel_names" ], np .asarray (nlxHeader ["channel_ids" ], dtype = str )):
0 commit comments