Skip to content

Commit 86bb8d7

Browse files
committed
improve try except logic
1 parent 0ccbec9 commit 86bb8d7

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

element_array_ephys/ephys_no_curation.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,25 +1043,20 @@ def make(self, key):
10431043
) # {channel: electrode}
10441044

10451045
# Get unit id to quality label mapping
1046-
cluster_quality_label_map = {}
10471046
try:
10481047
cluster_quality_label_map = pd.read_csv(
10491048
sorting_dir / "sorter_output" / "cluster_KSLabel.tsv",
10501049
delimiter="\t",
10511050
)
1051+
except FileNotFoundError:
1052+
cluster_quality_label_map = {}
1053+
else:
10521054
cluster_quality_label_map: dict[
10531055
int, str
10541056
] = cluster_quality_label_map.set_index("cluster_id")[
10551057
"KSLabel"
10561058
].to_dict() # {unit: quality_label}
1057-
except FileNotFoundError:
1058-
pass
1059-
1060-
# Get channel to electrode mapping
1061-
channel2depth_map = dict(
1062-
zip(*electrode_query.fetch("channel_idx", "y_coord"))
1063-
) # {channel: depth}
1064-
1059+
10651060
peak_electrode_ind = np.array(
10661061
[
10671062
channel_info[unit_peak_channel_map[unit_id]]["electrode"]

0 commit comments

Comments
 (0)