From e9a0be347cff520b3d1384020023975ec75f27d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludger=20K=C3=BCperkoch?= Date: Fri, 11 Aug 2017 12:48:43 +0200 Subject: [PATCH] [Bugfix] Take into account different formats of input argument iplot. --- pylot/core/analysis/magnitude.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/pylot/core/analysis/magnitude.py b/pylot/core/analysis/magnitude.py index 89c4ff11..51093aab 100644 --- a/pylot/core/analysis/magnitude.py +++ b/pylot/core/analysis/magnitude.py @@ -192,6 +192,14 @@ class LocalMagnitude(Magnitude): def peak_to_peak(self, st, t0): + try: + iplot = int(self.plot_flag) + except: + if self.plot_flag == True or self.plot_flag == 'True': + iplot = 2 + else: + iplot = 0 + # simulate Wood-Anderson response st.simulate(paz_remove=None, paz_simulate=self._paz) @@ -224,7 +232,7 @@ class LocalMagnitude(Magnitude): # check for plot flag (for debugging only) fig = None - if self.plot_flag > 1: + if iplot > 1: st.plot() fig = plt.figure() ax = fig.add_subplot(111) @@ -455,6 +463,14 @@ def calcsourcespec(wfstream, onset, vp, delta, azimuth, incidence, if verbosity: print("Calculating source spectrum for station %s ...." % wfstream[0].stats.station) + try: + iplot = int(iplot) + except: + if iplot == True or iplot == 'True': + iplot = 2 + else: + iplot = 0 + # get Q value Q, A = qp @@ -651,6 +667,14 @@ def fitSourceModel(f, S, fc0, iplot, verbosity=False): :type: float ''' + try: + iplot = int(iplot) + except: + if iplot == True or iplot == 'True': + iplot = 2 + else: + iplot = 0 + w0 = [] stdw0 = [] fc = []