Skip to content

Commit

Permalink
Pull changes from upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
kabilar committed Aug 24, 2023
1 parent 9c7fa45 commit 315886c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions element_array_ephys/ephys_organoids.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ def make(self, key):
raise ValueError(f"Unknown task mode: {task_mode}")

creation_time, _, _ = kilosort.extract_clustering_info(kilosort_dir)
self.insert1({**key, "clustering_time": creation_time})
self.insert1({**key, "clustering_time": creation_time, "package_version": ""})


@schema
Expand Down Expand Up @@ -1092,14 +1092,20 @@ def make(self, key):
kilosort_dir = find_full_path(get_ephys_root_data_dir(), output_dir)

metric_fp = kilosort_dir / "metrics.csv"
rename_dict = {
"isi_viol": "isi_violation",
"num_viol": "number_violation",
"contam_rate": "contamination_rate",
}

if not metric_fp.exists():
raise FileNotFoundError(f"QC metrics file not found: {metric_fp}")

metrics_df = pd.read_csv(metric_fp)
metrics_df.set_index("cluster_id", inplace=True)
metrics_df.replace([np.inf, -np.inf], np.nan, inplace=True)

metrics_df.columns = metrics_df.columns.str.lower()
metrics_df.rename(columns=rename_dict, inplace=True)
metrics_list = [
dict(metrics_df.loc[unit_key["unit"]], **unit_key)
for unit_key in (CuratedClustering.Unit & key).fetch("KEY")
Expand Down

0 comments on commit 315886c

Please sign in to comment.