From db351e9da36e2e944446d5c3d71c8eb7990121ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaquier=20Aur=C3=A9lien=20Tristan?= Date: Thu, 18 Jul 2024 11:49:02 +0200 Subject: [PATCH] handling mismatch in bAP plot Change-Id: Ia2a8551c56b2754fdee844293b659801ac2060f9 --- bluepyemodel/emodel_pipeline/plotting.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/bluepyemodel/emodel_pipeline/plotting.py b/bluepyemodel/emodel_pipeline/plotting.py index 4508da95..ad6f14a1 100644 --- a/bluepyemodel/emodel_pipeline/plotting.py +++ b/bluepyemodel/emodel_pipeline/plotting.py @@ -930,6 +930,14 @@ def plot_bAP( if 0 in basal_distances: basal_x_fit, basal_y_fit = bAP_fit(basal_feature, basal_distances, basal_values) + if len(apical_distances) != len(apical_values) or len(basal_distances) != len(basal_values): + logger.warning( + "Cannot plot figure for bAP because of mismatch between " + "distances list and feature values list. This can happen when " + "the emodel is bad and cannot even compute curent threshold." + ) + return fig, ax + ax.scatter( apical_distances, apical_values, @@ -1029,6 +1037,16 @@ def plot_EPSP( if 0 in basal_distances: basal_x_fit, basal_y_fit = EPSP_fit(basal_basalrec_feat, basal_distances, basal_attenuation) + if len(apical_distances) != len(apical_attenuation) or len(basal_distances) != len( + basal_attenuation + ): + logger.warning( + "Cannot plot figure for bAP because of mismatch between " + "distances list and feature values list. This can happen when " + "the emodel is bad and cannot even compute curent threshold." + ) + return fig, ax + ax.scatter( apical_distances, apical_attenuation,