@@ -24,6 +24,11 @@ class BlackrockRecordingExtractor(NeoBaseRecordingExtractor):
2424 use_names_as_ids : bool, default: False
2525 Determines the format of the channel IDs used by the extractor. If set to True, the channel IDs will be the
2626 names from NeoRawIO. If set to False, the channel IDs will be the ids provided by NeoRawIO.
27+ gap_tolerance_ms : float | None, default: None
28+ Maximum acceptable gap size in milliseconds for automatic segmentation.
29+ If None (default), an error is raised when timestamp gaps are detected.
30+ If a value is provided, gaps smaller than this threshold are ignored and
31+ gaps larger than this threshold create new segments.
2732
2833 """
2934
@@ -36,8 +41,11 @@ def __init__(
3641 stream_name = None ,
3742 all_annotations : bool = False ,
3843 use_names_as_ids : bool = False ,
44+ gap_tolerance_ms : float | None = None ,
3945 ):
4046 neo_kwargs = self .map_to_neo_kwargs (file_path )
47+ if gap_tolerance_ms is not None :
48+ neo_kwargs ["gap_tolerance_ms" ] = gap_tolerance_ms
4149 neo_kwargs ["load_nev" ] = False # Avoid loading spikes release in neo 0.12.0
4250
4351 # trick to avoid to select automatically the correct stream_id
@@ -52,7 +60,7 @@ def __init__(
5260 use_names_as_ids = use_names_as_ids ,
5361 ** neo_kwargs ,
5462 )
55- self ._kwargs .update ({"file_path" : str (Path (file_path ).absolute ())})
63+ self ._kwargs .update ({"file_path" : str (Path (file_path ).absolute ()), "gap_tolerance_ms" : gap_tolerance_ms })
5664
5765 @classmethod
5866 def map_to_neo_kwargs (cls , file_path ):
@@ -82,6 +90,11 @@ class BlackrockSortingExtractor(NeoBaseSortingExtractor):
8290 nsx_to_load : int | list | str, default: None
8391 IDs of nsX file from which to load data, e.g., if set to 5 only data from the ns5 file are loaded.
8492 If 'all', then all nsX will be loaded. If None, all nsX files will be loaded. If empty list, no nsX files will be loaded.
93+ gap_tolerance_ms : float | None, default: None
94+ Maximum acceptable gap size in milliseconds for automatic segmentation.
95+ If None (default), an error is raised when timestamp gaps are detected.
96+ If a value is provided, gaps smaller than this threshold are ignored and
97+ gaps larger than this threshold create new segments.
8598 """
8699
87100 NeoRawIOClass = "BlackrockRawIO"
@@ -94,8 +107,11 @@ def __init__(
94107 stream_name : str | None = None ,
95108 sampling_frequency : float | None = None ,
96109 nsx_to_load : int | list | str | None = None ,
110+ gap_tolerance_ms : float | None = None ,
97111 ):
98112 neo_kwargs = self .map_to_neo_kwargs (file_path )
113+ if gap_tolerance_ms is not None :
114+ neo_kwargs ["gap_tolerance_ms" ] = gap_tolerance_ms
99115 NeoBaseSortingExtractor .__init__ (
100116 self ,
101117 stream_id = stream_id ,
@@ -110,6 +126,7 @@ def __init__(
110126 "sampling_frequency" : sampling_frequency ,
111127 "stream_id" : stream_id ,
112128 "stream_name" : stream_name ,
129+ "gap_tolerance_ms" : gap_tolerance_ms ,
113130 }
114131
115132 @classmethod
0 commit comments