@@ -93,8 +93,8 @@ class UnitLevelReport(dj.Computed):
93
93
definition = """
94
94
-> ephys.CuratedClustering.Unit
95
95
---
96
- cluster_quality_label : varchar(100)
97
- waveform_plotly : longblob
96
+ cluster_quality_label : varchar(100)
97
+ waveform_plotly : longblob
98
98
autocorrelogram_plotly : longblob
99
99
depth_waveform_plotly : longblob
100
100
"""
@@ -151,11 +151,14 @@ class QualityMetricCutoffs(dj.Lookup):
151
151
152
152
def insert_new_cutoffs (
153
153
cls ,
154
- cutoffs_id : int ,
155
- amplitude_cutoff_maximum : float ,
156
- presence_ratio_minimum : float ,
157
- isi_violations_maximum : float ,
154
+ cutoffs_id : int = None ,
155
+ amplitude_cutoff_maximum : float = None ,
156
+ presence_ratio_minimum : float = None ,
157
+ isi_violations_maximum : float = None ,
158
158
):
159
+ if not cutoffs_id :
160
+ cutoffs_id = (dj .U ().aggr (cls , n = "max(cutoffs_id)" ).fetch1 ("n" ) or 0 ) + 1
161
+
159
162
insert1_skip_full_duplicates ( # depends on element-interface/pull/43
160
163
cls ,
161
164
dict (
@@ -179,43 +182,19 @@ class QualityMetricSet(dj.Manual):
179
182
class QualityMetricReport (dj .Computed ):
180
183
definition = """
181
184
-> QualityMetricSet
185
+ ---
186
+ plot_grid : longblob
182
187
"""
183
188
184
- class Cluster (dj .Part ):
185
- definition = """
186
- -> master
187
- ---
188
- firing_rate_plot : longblob
189
- presence_ratio_plot : longblob
190
- amp_cutoff_plot : longblob
191
- isi_violation_plot : longblob
192
- snr_plot : longblob
193
- iso_dist_plot : longblob
194
- d_prime_plot : longblob
195
- nn_hit_plot : longblob
196
- """
197
-
198
189
def make (self , key ):
199
190
from .plotting .qc import QualityMetricFigs
200
191
201
192
cutoffs = (QualityMetricCutoffs & key ).fetch1 ()
202
193
qc_key = ephys .QualityMetrics & key
203
- qc_figs = QualityMetricFigs (qc_key , ** cutoffs )
204
-
205
- # ADD SAVEFIG?
206
194
207
- self .insert1 (key )
208
- self .Cluster .insert1 (
209
- dict (
210
- ** key ,
211
- firing_rate_plot = qc_figs .firing_rate_plot ().to_plotly_json (),
212
- presence_ratio_plot = qc_figs .presence_ratio_plot ().to_plotly_json (),
213
- amp_cutoff_plot = qc_figs .amp_cutoff_plot ().to_plotly_json (),
214
- isi_violation_plot = qc_figs .isi_violation_plot ().to_plotly_json (),
215
- snr_plot = qc_figs .snr_plot ().to_plotly_json (),
216
- iso_dist_plot = qc_figs .iso_dist_plot ().to_plotly_json (),
217
- d_prime_plot = qc_figs .d_prime_plot ().to_plotly_json (),
218
- nn_hit_plot = qc_figs .nn_hit_plot ().to_plotly_json (),
195
+ self .insert1 (
196
+ key .update (
197
+ dict (plot_grid = QualityMetricFigs (qc_key , ** cutoffs ).get_grid ().to_json )
219
198
)
220
199
)
221
200
0 commit comments