From c7f22373881271dc4bbbc78460a9e1e54e7c3bef Mon Sep 17 00:00:00 2001
From: Dmitry Kalinkin <dkalinkin@bnl.gov>
Date: Wed, 9 Apr 2025 18:53:44 -0400
Subject: [PATCH] truth_reconstruction.py: check for `np.isnan(Y_error[0][4])`

---
 benchmarks/Inclusive/dis/analysis/truth_reconstruction.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/benchmarks/Inclusive/dis/analysis/truth_reconstruction.py b/benchmarks/Inclusive/dis/analysis/truth_reconstruction.py
index b7b6494e..c2444ea4 100644
--- a/benchmarks/Inclusive/dis/analysis/truth_reconstruction.py
+++ b/benchmarks/Inclusive/dis/analysis/truth_reconstruction.py
@@ -222,10 +222,12 @@ for i in range(len(MC_list)): #Repeat the following steps for each variable (mom
             ax6.errorbar(Y_error[5][0], Y_error[5][1], yerr=Y_error[5][3], xerr=Y_error[5][2] ,fmt='None', ecolor = 'orange', elinewidth = 1)
 
             if i == 0:  # for momentum
-                ax1.set_ylim(1-(Y_error[0][4]*10),1+(Y_error[0][4]*10))
+                if not np.isnan(Y_error[0][4]):
+                    ax1.set_ylim(1-(Y_error[0][4]*10),1+(Y_error[0][4]*10))
                 center = 1
             else:       # for angles
-                ax1.set_ylim(0-(Y_error[0][4]*10),0+(Y_error[0][4]*10))
+                if not np.isnan(Y_error[0][4]):
+                    ax1.set_ylim(0-(Y_error[0][4]*10),0+(Y_error[0][4]*10))
                 center = 0
             for each_bin in range(len(Y_error[0][0])):
                 ax1.text(x=Y_error[0][0][each_bin],y=center + Y_error[0][4]*7, s= '\u03BC = %.3f\n\u03C3 = %.3f' % (Y_error[0][1][each_bin],Y_error[0][3][each_bin]),size=text_size,horizontalalignment='center',verticalalignment='top')
-- 
GitLab