File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
element_array_ephys/export Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -85,6 +85,9 @@ def curated_clusterings_to_nwb(curated_clustering_keys, nwbfile):
8585 location = electrode_group .location )
8686
8787 # ---- Units ----
88+ electrode_df = nwbfile .electrodes .to_dataframe ()
89+ electrode_ind = electrode_df .index [electrode_df .group_name == electrode_group .name ]
90+
8891 unit_query = clustering_query @ ephys .CuratedClustering .Unit
8992 for unit in unit_query .fetch (as_dict = True ):
9093 if ephys .WaveformSet & curated_clustering_key & {'unit' : unit ['unit' ]}:
@@ -99,7 +102,7 @@ def curated_clusterings_to_nwb(curated_clustering_keys, nwbfile):
99102 waveform_mean = waveform_std = np .full (1 , np .nan )
100103
101104 nwbfile .add_unit (id = unit ['unit' ],
102- electrodes = np .where (nwbfile . electrodes . id . data == int ( unit ['electrode' ]) )[0 ],
105+ electrodes = np .where (electrode_ind == unit ['electrode' ])[0 ],
103106 electrode_group = electrode_group ,
104107 sampling_rate = unit ['sampling_rate' ],
105108 cluster_quality_label = unit ['cluster_quality_label' ],
You can’t perform that action at this time.
0 commit comments