File tree 2 files changed +7
-2
lines changed
2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -1264,7 +1264,7 @@ def write_imro(file: str | Path, probe: Probe):
1264
1264
f .write ("" .join (ret ))
1265
1265
1266
1266
1267
- def read_spikegadgets (file : str | Path ) -> ProbeGroup :
1267
+ def read_spikegadgets (file : str | Path , raise_error : bool = True ) -> ProbeGroup :
1268
1268
"""
1269
1269
Find active channels of the given Neuropixels probe from a SpikeGadgets .rec file.
1270
1270
SpikeGadgets headstages support up to three Neuropixels 1.0 probes (as of March 28, 2024),
@@ -1300,6 +1300,11 @@ def read_spikegadgets(file: str | Path) -> ProbeGroup:
1300
1300
probe_configs = [device for device in hconf if device .attrib ["name" ] == "NeuroPixels1" ]
1301
1301
n_probes = len (probe_configs )
1302
1302
1303
+ if n_probes == 0 :
1304
+ if raise_error :
1305
+ raise Exception ("No Neuropixels 1.0 probes found" )
1306
+ return None
1307
+
1303
1308
# Container to store Probe objects
1304
1309
probe_group = ProbeGroup ()
1305
1310
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ def test_parse_meta():
19
19
20
20
21
21
def test_neuropixels_1_reader ():
22
- probe_group = read_spikegadgets (data_path / test_file )
22
+ probe_group = read_spikegadgets (data_path / test_file , raise_error = False )
23
23
assert len (probe_group .probes ) == 2
24
24
for probe in probe_group .probes :
25
25
assert "1.0" in probe .model_name
You can’t perform that action at this time.
0 commit comments