From 8bc21182e48c218d3e42326361b8e0bbdbc305cb Mon Sep 17 00:00:00 2001 From: Miles Wells Date: Wed, 18 Oct 2023 15:08:31 +0300 Subject: [PATCH] Handle empty bnc data in task qc plot --- task_qc_viewer/task_qc.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/task_qc_viewer/task_qc.py b/task_qc_viewer/task_qc.py index 3595139..04be494 100644 --- a/task_qc_viewer/task_qc.py +++ b/task_qc_viewer/task_qc.py @@ -145,8 +145,10 @@ def create_plots(self, axes, bnc2 = self.extractor.audio_ttls trial_data = self.extractor.data - plots.squares(bnc1['times'], bnc1['polarities'] * 0.4 + 1, ax=axes, color='k') - plots.squares(bnc2['times'], bnc2['polarities'] * 0.4 + 2, ax=axes, color='k') + if bnc1['times'].size: + plots.squares(bnc1['times'], bnc1['polarities'] * 0.4 + 1, ax=axes, color='k') + if bnc2['times'].size: + plots.squares(bnc2['times'], bnc2['polarities'] * 0.4 + 2, ax=axes, color='k') linestyle = linestyle or random.choices(('-', '--', '-.', ':'), k=len(trial_events)) if self.extractor.bpod_ttls is not None: