From ab6e74c4823b69930d1783ff61d14a2f8d8eaee2 Mon Sep 17 00:00:00 2001 From: Darius Arnold Date: Tue, 9 Apr 2019 17:30:05 +0200 Subject: [PATCH] Add init to HOScf that extracts parameters from pickparams --- pylot/core/pick/autopick.py | 4 ++-- pylot/core/pick/charfuns.py | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/pylot/core/pick/autopick.py b/pylot/core/pick/autopick.py index 0058ef08..89665616 100644 --- a/pylot/core/pick/autopick.py +++ b/pylot/core/pick/autopick.py @@ -834,7 +834,7 @@ class AutopickStation(object): # calculate first CF if self.p_params.algoP == 'HOS': - self.cf1 = HOScf(z_copy, cuttimes, self.p_params.tlta, self.p_params.hosorder) + self.cf1 = HOScf(z_copy, cuttimes, self.pickparams) elif self.p_params.algoP == 'ARZ': self.cf1 = ARZcf(z_copy, cuttimes, self.p_params.tpred1z, self.p_params.Parorder, self.p_params.tdet1z, self.p_params.addnoise) @@ -884,7 +884,7 @@ class AutopickStation(object): # determine new times around initial onset cuttimes2 = self._calculate_cuttimes('P', 2) if self.p_params.algoP == 'HOS': - self.cf2 = HOScf(z_copy, cuttimes2, self.p_params.tlta, self.p_params.hosorder) + self.cf2 = HOScf(z_copy, cuttimes2, self.pickparams) elif self.p_params.algoP == 'ARZ': self.cf2 = ARZcf(z_copy, cuttimes2, self.p_params.tpred2z, self.p_params.Parorder, self.p_params.tdet2z, self.p_params.addnoise) else: diff --git a/pylot/core/pick/charfuns.py b/pylot/core/pick/charfuns.py index f3aa8a64..2b0ff706 100644 --- a/pylot/core/pick/charfuns.py +++ b/pylot/core/pick/charfuns.py @@ -243,6 +243,13 @@ class AICcf(CharacteristicFunction): class HOScf(CharacteristicFunction): + def __init__(self, data, cut, pickparams): + """ + Call parent constructor while extracting the right parameters: + :param pickparams: PylotParameters instance + """ + super(HOScf, self).__init__(data, cut, pickparams["tlta"], pickparams["hosorder"]) + def calcCF(self, data): """ Function to calculate skewness (statistics of order 3) or kurtosis