diff --git a/element_array_ephys/ephys_organoids.py b/element_array_ephys/ephys_organoids.py index c22dce9c..e7258312 100644 --- a/element_array_ephys/ephys_organoids.py +++ b/element_array_ephys/ephys_organoids.py @@ -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 @@ -1092,6 +1092,11 @@ 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}") @@ -1099,7 +1104,8 @@ def make(self, key): 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")