From 537b7cb4a393336f058e2342ebd6e6c4d485daa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludger=20K=C3=BCperkoch?= Date: Fri, 11 Aug 2017 16:57:10 +0200 Subject: [PATCH 1/3] [Bugfix] Take into account different formats of input arguments iplot and fig. --- pylot/core/pick/utils.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pylot/core/pick/utils.py b/pylot/core/pick/utils.py index 5f1a8d43..212928d0 100644 --- a/pylot/core/pick/utils.py +++ b/pylot/core/pick/utils.py @@ -975,6 +975,15 @@ def checkZ4S(X, pick, zfac, checkwin, iplot, fig=None): are shown : type: int ''' + + try: + iplot = int(iplot) + except: + if iplot == True or iplot == 'True': + iplot = 2 + else: + iplot = 0 + assert isinstance(X, Stream), "%s is not a stream object" % str(X) @@ -1052,10 +1061,14 @@ def checkZ4S(X, pick, zfac, checkwin, iplot, fig=None): t = np.arange(diff_dict[key], trace.stats.npts / trace.stats.sampling_rate + diff_dict[key], trace.stats.delta) if i == 0: + if fig == None or fig == 'None': + fig = plt.figure() # self.iplot) ### WHY? MP MP ax1 = fig.add_subplot(3, 1, i + 1) ax = ax1 ax.set_title('CheckZ4S, Station %s' % zdat[0].stats.station) else: + if fig == None or fig == 'None': + fig = plt.figure() # self.iplot) ### WHY? MP MP ax = fig.add_subplot(3, 1, i + 1, sharex=ax1) ax.plot(t, abs(trace.data), color='b', label='abs') ax.plot(t, trace.data, color='k') From df2d5929d3c97cb9261b0818f3c68eb503b66f8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludger=20K=C3=BCperkoch?= Date: Fri, 11 Aug 2017 17:32:59 +0200 Subject: [PATCH 2/3] [Bugfix] If Sweight >= 4, SNR and/or slope might be None. --- pylot/core/pick/autopick.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pylot/core/pick/autopick.py b/pylot/core/pick/autopick.py index bdf76c5b..dc22eb90 100644 --- a/pylot/core/pick/autopick.py +++ b/pylot/core/pick/autopick.py @@ -863,7 +863,7 @@ def autopickstation(wfstream, pickparam, verbose=False, if Pweight < 4: ax2.plot(arhcf1.getTimeArray(), arhcf1.getCF() / max(arhcf1.getCF()), 'b', label='CF1') - if aicSflag == 1: + if aicSflag == 1 and Sweight < 4: ax2.plot(arhcf2.getTimeArray(), arhcf2.getCF() / max(arhcf2.getCF()), 'm', label='CF2') ax2.plot( From f1f6082cd860a1612b8a1885ed014e604025605f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludger=20K=C3=BCperkoch?= Date: Fri, 11 Aug 2017 17:33:41 +0200 Subject: [PATCH 3/3] Enabled terminal based plotting. --- pylot/core/pick/utils.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pylot/core/pick/utils.py b/pylot/core/pick/utils.py index 1f73b22f..fad3d04f 100644 --- a/pylot/core/pick/utils.py +++ b/pylot/core/pick/utils.py @@ -980,6 +980,7 @@ def checkZ4S(X, pick, zfac, checkwin, iplot, fig=None): : type: int ''' + plt_flag = 0 try: iplot = int(iplot) except: @@ -1067,12 +1068,14 @@ def checkZ4S(X, pick, zfac, checkwin, iplot, fig=None): if i == 0: if fig == None or fig == 'None': fig = plt.figure() # self.iplot) ### WHY? MP MP + plt_flag = 1 ax1 = fig.add_subplot(3, 1, i + 1) ax = ax1 ax.set_title('CheckZ4S, Station %s' % zdat[0].stats.station) else: if fig == None or fig == 'None': fig = plt.figure() # self.iplot) ### WHY? MP MP + plt_flag = 1 ax = fig.add_subplot(3, 1, i + 1, sharex=ax1) ax.plot(t, abs(trace.data), color='b', label='abs') ax.plot(t, trace.data, color='k') @@ -1084,6 +1087,10 @@ def checkZ4S(X, pick, zfac, checkwin, iplot, fig=None): lw=0) ax.legend() ax.set_xlabel('Time [s] since %s' % zdat[0].stats.starttime) + if plt_flag == 1: + fig.show() + raw_input() + plt.close(fig) return returnflag def getQualityfromUncertainty(uncertainty, Errors):