From 790cf803d718f24a36e5784fe607f412280f9795 Mon Sep 17 00:00:00 2001 From: Darius Arnold Date: Tue, 9 Apr 2019 17:43:30 +0200 Subject: [PATCH] Add init to ARZcf that extracts parameters from pickparams t1, t2 cant be extracted in the init function since they are not the same during the first and the second instantiation. --- pylot/core/pick/autopick.py | 5 ++--- pylot/core/pick/charfuns.py | 3 +++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pylot/core/pick/autopick.py b/pylot/core/pick/autopick.py index 89665616..9a8c7bc7 100644 --- a/pylot/core/pick/autopick.py +++ b/pylot/core/pick/autopick.py @@ -836,8 +836,7 @@ class AutopickStation(object): if self.p_params.algoP == 'HOS': 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) + self.cf1 = ARZcf(z_copy, cuttimes, self.pickparams["tdet1z"], self.pickparams["tpred1z"], self.pickparams) else: self.cf1 = None assert isinstance(self.cf1, CharacteristicFunction), 'cf1 is not set correctly: maybe the algorithm name ({})' \ @@ -886,7 +885,7 @@ class AutopickStation(object): if self.p_params.algoP == 'HOS': 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) + self.cf2 = ARZcf(z_copy, cuttimes2, self.pickparams["tdet2z"], self.pickparams["tpred2z"], self.pickparams) else: self.cf2 = None assert isinstance(self.cf2, CharacteristicFunction), 'cf2 is not set correctly: maybe the algorithm name () is ' \ diff --git a/pylot/core/pick/charfuns.py b/pylot/core/pick/charfuns.py index 2b0ff706..ec879865 100644 --- a/pylot/core/pick/charfuns.py +++ b/pylot/core/pick/charfuns.py @@ -306,6 +306,9 @@ class HOScf(CharacteristicFunction): class ARZcf(CharacteristicFunction): + def __init__(self, data, cut, t1, t2, pickparams): + super(ARZcf, self).__init__(data, cut, t1=t1, t2=t2, order=pickparams["Parorder"], fnoise=pickparams["addnoise"]) + def calcCF(self, data): """ function used to calculate the AR prediction error from a single vertical trace. Can be used to pick