Skip to content

Commit 9ec85fe

Browse files
committed
add test + docs
1 parent 142227b commit 9ec85fe

2 files changed

Lines changed: 18 additions & 6 deletions

File tree

src/spikeinterface/extractors/neoextractors/intan.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,20 @@ def _add_channel_groups(self):
110110

111111
class IntanSplitFilesRecordingExtractor(ConcatenateSegmentRecording, AppendSegmentRecording):
112112
"""
113-
Class for reading Intan traditional format split files from a folder and concatenating them in temporal order.
113+
Class for reading Intan traditional format split files from a folder and
114+
concatenating/appending them in temporal order.
114115
115-
Intan traditional format creates multiple files with time-based naming when recording for extended
116-
periods. This class automatically sorts the files by filename and concatenates them
117-
to create a continuous recording.
116+
Intan traditional format creates multiple files with time-based naming when recording
117+
for extended periods. This class automatically sorts the files by filename and concatenates
118+
them to create a continuous recording (monosegment) or appends them to a multisegment recording.
118119
119120
Parameters
120121
----------
121122
folder_path : str or Path
122123
Path to the folder containing split Intan files (.rhd or .rhs extensions)
124+
mode : "concatenate" | "append": default: "concatenate"
125+
The determines whether to concatenate intan files to make a monosegment or to append them
126+
to make a multisegment recording
123127
stream_id : str, default: None
124128
If there are several streams, specify the stream id you want to load.
125129
stream_name : str, default: None
@@ -143,13 +147,20 @@ class IntanSplitFilesRecordingExtractor(ConcatenateSegmentRecording, AppendSegme
143147
def __init__(
144148
self,
145149
folder_path,
146-
mode: Literal["append" | "concatenate"] = "concatenate",
150+
mode: Literal["append", "concatenate"] = "concatenate",
147151
stream_id=None,
148152
stream_name=None,
149153
all_annotations=False,
150154
use_names_as_ids=False,
151155
ignore_integrity_checks: bool = False,
152156
):
157+
158+
if mode not in ("append", "concatenate"):
159+
mode_error = (
160+
"Possible options for the `mode` argument are 'concatenate' or 'append', you have entered " f"{mode}."
161+
)
162+
raise ValueError(mode_error)
163+
153164
folder_path = Path(folder_path)
154165

155166
if not folder_path.exists() or not folder_path.is_dir():

src/spikeinterface/extractors/tests/test_neoextractors.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,8 @@ class IntanSplitFilesRecordingTest(RecordingCommonTestSuite, unittest.TestCase):
190190
ExtractorClass = IntanSplitFilesRecordingExtractor
191191
downloads = ["intan"]
192192
entities = [
193-
"intan/test_tetrode_240502_162925",
193+
("intan/test_tetrode_240502_162925", {"mode": "concatenate"}),
194+
("intan/test_tetrode_240502_162925", {"mode": "append"}),
194195
]
195196

196197

0 commit comments

Comments
 (0)