9
9
import numpy as np
10
10
import pandas as pd
11
11
import spikeinterface as si
12
- from element_interface .utils import (dict_to_uuid , find_full_path ,
13
- find_root_directory )
12
+ from element_interface .utils import dict_to_uuid , find_full_path , find_root_directory
14
13
from spikeinterface import exporters , postprocessing , qualitymetrics , sorters
15
14
16
15
from . import ephys_report , probe
@@ -1032,7 +1031,7 @@ def make(self, key):
1032
1031
probe .ProbeType .Electrode * probe .ElectrodeConfig .Electrode
1033
1032
& electrode_config_key
1034
1033
) * (dj .U ("electrode" , "channel_idx" ) & EphysRecording .Channel )
1035
-
1034
+
1036
1035
channel2electrode_map = dict (
1037
1036
zip (* electrode_query .fetch ("channel_idx" , "electrode" ))
1038
1037
) # {channel: electrode}
@@ -1053,7 +1052,9 @@ def make(self, key):
1053
1052
pass
1054
1053
1055
1054
# Get channel to electrode mapping
1056
- channel2depth_map = dict (zip (* electrode_query .fetch ("channel_idx" , "y_coord" ))) # {channel: depth}
1055
+ channel2depth_map = dict (
1056
+ zip (* electrode_query .fetch ("channel_idx" , "y_coord" ))
1057
+ ) # {channel: depth}
1057
1058
1058
1059
peak_electrode_ind = np .array (
1059
1060
[
@@ -1570,9 +1571,14 @@ class Waveform(dj.Part):
1570
1571
def make (self , key ):
1571
1572
"""Populates tables with quality metrics data."""
1572
1573
# Load metrics.csv
1573
- output_dir = (ClusteringTask & key ).fetch1 ("clustering_output_dir" )
1574
+ clustering_method , output_dir = (
1575
+ ClusteringTask * ClusteringParamSet & key
1576
+ ).fetch1 ("clustering_method" , "clustering_output_dir" )
1574
1577
output_dir = find_full_path (get_ephys_root_data_dir (), output_dir )
1575
- metric_fp = output_dir / "metrics.csv"
1578
+ sorter_name = (
1579
+ "kilosort2_5" if clustering_method == "kilosort2.5" else clustering_method
1580
+ )
1581
+ metric_fp = output_dir / sorter_name / "metrics" / "metrics.csv"
1576
1582
if not metric_fp .exists ():
1577
1583
raise FileNotFoundError (f"QC metrics file not found: { metric_fp } " )
1578
1584
metrics_df = pd .read_csv (metric_fp )
0 commit comments