Skip to content

Commit 6a3a52d

Browse files
committed
Handle empty niXDChans1 field in nidq.meta
1 parent 3761176 commit 6a3a52d

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

neo/rawio/spikeglxrawio.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -566,10 +566,12 @@ def extract_stream_info(meta_file, meta):
566566
info["digital_channels"] = []
567567
info["analog_channels"] = [channel for channel in info["channel_names"] if not channel.startswith("XD")]
568568
# Digital/event channels are encoded within the digital word, so that will need more handling
569-
for item in meta["niXDChans1"].split(","):
570-
if ":" in item:
571-
start, end = map(int, item.split(":"))
572-
info["digital_channels"].extend([f"XD{i}" for i in range(start, end + 1)])
573-
else:
574-
info["digital_channels"].append(f"XD{int(item)}")
569+
if meta["niXDChans1"] != "":
570+
nixd_chans1_items = meta["niXDChans1"].split(",")
571+
for item in nixd_chans1_items:
572+
if ":" in item:
573+
start, end = map(int, item.split(":"))
574+
info["digital_channels"].extend([f"XD{i}" for i in range(start, end + 1)])
575+
else:
576+
info["digital_channels"].append(f"XD{int(item)}")
575577
return info

0 commit comments

Comments
 (0)