From 3845e7291ea52fcc47f94910d6a01e4ef4a3011b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludger=20K=C3=BCperkoch?= Date: Mon, 25 Jun 2018 15:56:15 +0200 Subject: [PATCH] Relaxed condition for slope determination, plot interims results even if picking failed. --- pylot/core/pick/picker.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pylot/core/pick/picker.py b/pylot/core/pick/picker.py index 381000b0..56db3df2 100644 --- a/pylot/core/pick/picker.py +++ b/pylot/core/pick/picker.py @@ -253,7 +253,7 @@ class AICPicker(AutoPicker): except IndexError: print("Slope Calculation: empty array islope, check signal window") return - if len(dataslope) <= 2: + if len(dataslope) < 2: print('No or not enough data in slope window found!') return try: @@ -300,8 +300,9 @@ class AICPicker(AutoPicker): datafit = np.polyval(P, xslope) if datafit[0] >= datafit[-1]: print('AICPicker: Negative slope, bad onset skipped!') - return - self.slope = 1 / (len(dataslope) * self.Data[0].stats.delta) * (datafit[-1] - datafit[0]) + #return + else: + self.slope = 1 / (len(dataslope) * self.Data[0].stats.delta) * (datafit[-1] - datafit[0]) else: self.SNR = None @@ -342,8 +343,11 @@ class AICPicker(AutoPicker): label='Slope Window') ax2.plot(self.Tcf[iislope], datafit, 'g', linewidth=2, label='Slope') - ax1.set_title('Station %s, SNR=%7.2f, Slope= %12.2f counts/s' % (self.Data[0].stats.station, - self.SNR, self.slope)) + if self.slope is not None: + ax1.set_title('Station %s, SNR=%7.2f, Slope= %12.2f counts/s' % (self.Data[0].stats.station, + self.SNR, self.slope)) + else: + ax1.set_title('Station %s, SNR=%7.2f' % (self.Data[0].stats.station, self.SNR)) ax2.set_xlabel('Time [s] since %s' % self.Data[0].stats.starttime) ax2.set_ylabel('Counts') ax2.set_yticks([])