From 5e92d9aa5edfca9c6c012a63e4a906afea0535d0 Mon Sep 17 00:00:00 2001 From: Mayo Faulkner Date: Fri, 12 Jan 2024 11:39:59 +0000 Subject: [PATCH] fix for offline case with different metrics file --- atlaselectrophysiology/plot_data.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/atlaselectrophysiology/plot_data.py b/atlaselectrophysiology/plot_data.py index f4a358f..b0214e6 100644 --- a/atlaselectrophysiology/plot_data.py +++ b/atlaselectrophysiology/plot_data.py @@ -600,7 +600,12 @@ def get_autocorr(self, clust_idx): autocorr = xcorr(self.data['spikes']['times'][idx], self.data['spikes']['clusters'][idx], AUTOCORR_BIN_SIZE, AUTOCORR_WIN_SIZE) - return autocorr[0, 0, :], self.data['clusters'].metrics.cluster_id[self.clust_id[clust_idx]] + if self.data['clusters'].get('metrics', {}).get('cluster_id', None) is None: + clust_id = self.clust_id[clust_idx] + else: + clust_id = self.data['clusters'].metrics.cluster_id[self.clust_id[clust_idx]] + + return autocorr[0, 0, :], clust_id def get_template_wf(self, clust_idx): template_wf = (self.data['clusters']['waveforms'][self.clust_id[clust_idx], :, 0])