Skip to content

Commit cbefcde

Browse files
bendichterkabilar
andauthored
Update element_array_ephys/export/nwb/nwb.py
Co-authored-by: Kabilar Gunalan <kabilar@datajoint.com>
1 parent a7b2abb commit cbefcde

File tree

1 file changed

+5
-3
lines changed
  • element_array_ephys/export/nwb

1 file changed

+5
-3
lines changed

element_array_ephys/export/nwb/nwb.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ def add_electrodes_to_nwb(session_key: dict, nwbfile: pynwb.NWBFile):
113113
for this_probe in (ephys.ProbeInsertion * probe.Probe & session_key).fetch(
114114
as_dict=True
115115
):
116-
insertion_record = (ephys.InsertionLocation & this_probe).fetch1()
117-
if insertion_record:
116+
insertion_record = (ephys.InsertionLocation & this_probe).fetch()
117+
if len(insertion_record)==1:
118118
insert_location = json.dumps(
119119
{
120120
k: v
@@ -123,8 +123,10 @@ def add_electrodes_to_nwb(session_key: dict, nwbfile: pynwb.NWBFile):
123123
},
124124
cls=DecimalEncoder,
125125
)
126-
else:
126+
elif len(insertion_record)==0:
127127
insert_location = "unknown"
128+
else:
129+
raise DataJointError(f'Found multiple insertion locations for {this_probe}')
128130

129131
device = nwbfile.create_device(
130132
name=this_probe["probe"],

0 commit comments

Comments
 (0)