File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
Expand file tree Collapse file tree 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):
12641264 f .write ("" .join (ret ))
12651265
12661266
1267- def read_spikegadgets (file : str | Path ) -> ProbeGroup :
1267+ def read_spikegadgets (file : str | Path , raise_error : bool = True ) -> ProbeGroup :
12681268 """
12691269 Find active channels of the given Neuropixels probe from a SpikeGadgets .rec file.
12701270 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:
13001300 probe_configs = [device for device in hconf if device .attrib ["name" ] == "NeuroPixels1" ]
13011301 n_probes = len (probe_configs )
13021302
1303+ if n_probes == 0 :
1304+ if raise_error :
1305+ raise Exception ("No Neuropixels 1.0 probes found" )
1306+ return None
1307+
13031308 # Container to store Probe objects
13041309 probe_group = ProbeGroup ()
13051310
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ def test_parse_meta():
1919
2020
2121def 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 )
2323 assert len (probe_group .probes ) == 2
2424 for probe in probe_group .probes :
2525 assert "1.0" in probe .model_name
You can’t perform that action at this time.
0 commit comments