Skip to content

Commit 1f559fe

Browse files
authored
Merge pull request #90 from LorenFrankLab/null_reference
Fix case of no reference defined in header
2 parents eb87f8a + ced5b92 commit 1f559fe

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/trodes_to_nwb/convert_rec_header.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,16 @@ def make_ref_electrode_map(
205205
)
206206

207207
for group in spike_config:
208+
# define the current ntrode group's nwb id
209+
ntrode_id = group.attrib["id"]
210+
nwb_group_id = ntrode_id_to_nwb[ntrode_id]
208211
if "refNTrodeID" in group.attrib:
209-
# define the current ntrode group's nwb id
210-
ntrode_id = group.attrib["id"]
211-
nwb_group_id = ntrode_id_to_nwb[ntrode_id]
212-
# find channel map for ref group
213212
ntrode_ref_group_id = group.attrib["refNTrodeID"]
213+
# if reference defined on null ntrode value, set to -1
214+
if int(ntrode_ref_group_id) <= 0:
215+
ref_electrode_map[nwb_group_id] = (-1, -1)
216+
continue
217+
# find channel map for ref group
214218
ref_channel_map = None
215219
for test_meta in metadata["ntrode_electrode_group_channel_map"]:
216220
if str(test_meta["ntrode_id"]) == ntrode_ref_group_id:

0 commit comments

Comments
 (0)