Closes Ticket #143, uses now None instead of -1

This commit is contained in:
Ludger Küperkoch 2015-02-23 15:04:39 +01:00
parent d15441900e
commit 125728f2b1

View File

@ -16,7 +16,9 @@ autoregressive prediction: application ot local and regional distances, Geophys.
""" """
import numpy as np import numpy as np
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
from pylot.core.pick.CharFuns import CharacteristicFunction from CharFuns import *
#from pylot.core.pick.CharFuns import CharacteristicFunction
import pdb
class AutoPicking(object): class AutoPicking(object):
''' '''
@ -52,7 +54,6 @@ class AutoPicking(object):
''' '''
assert isinstance(cf, CharacteristicFunction), "%s is not a CharacteristicFunction object" % str(cf) assert isinstance(cf, CharacteristicFunction), "%s is not a CharacteristicFunction object" % str(cf)
#wie kann man hier isinstance benutzen?
self.cf = cf.getCF() self.cf = cf.getCF()
self.Tcf = cf.getTimeArray() self.Tcf = cf.getTimeArray()
@ -142,7 +143,7 @@ class AICPicker(AutoPicking):
print 'Get onset time (pick) from AIC-CF ...' print 'Get onset time (pick) from AIC-CF ...'
self.Pick = -1 self.Pick = None
#taper AIC-CF to get rid off side maxima #taper AIC-CF to get rid off side maxima
tap = np.hanning(len(self.cf)) tap = np.hanning(len(self.cf))
aic = tap * self.cf + max(abs(self.cf)) aic = tap * self.cf + max(abs(self.cf))
@ -155,7 +156,7 @@ class AICPicker(AutoPicking):
if aic[i - 1] >= aic[i]: if aic[i - 1] >= aic[i]:
self.Pick = self.Tcf[i] self.Pick = self.Tcf[i]
break break
if self.Pick == -1: if self.Pick == None:
print 'AICPicker: Could not find minimum, picking window too short?' print 'AICPicker: Could not find minimum, picking window too short?'
return self.Pick return self.Pick
@ -170,7 +171,7 @@ class PragPicker(AutoPicking):
if self.getpick1() is not None: if self.getpick1() is not None:
print 'Get onset time (pick) from HOS- or AR-CF using pragmatic picking algorithm ...' print 'Get onset time (pick) from HOS- or AR-CF using pragmatic picking algorithm ...'
self.Pick = -1 self.Pick = None
#smooth CF #smooth CF
ismooth = int(round(self.Tsmooth / self.dt)) ismooth = int(round(self.Tsmooth / self.dt))
cfsmooth = np.zeros(len(self.cf)) cfsmooth = np.zeros(len(self.cf))
@ -238,7 +239,7 @@ class PragPicker(AutoPicking):
self.Pick = pick_r self.Pick = pick_r
else: else:
self.Pick = -1 self.Pick = None
print 'PragPicker: No initial onset time given! Check input!' print 'PragPicker: No initial onset time given! Check input!'
return return