From d45a5ccf0de947a6b0be3108dc4e9d20adcdc041 Mon Sep 17 00:00:00 2001 From: Darius Arnold Date: Tue, 9 Apr 2019 17:05:51 +0200 Subject: [PATCH] Change checkZ4S so it extracts the required parameters --- pylot/core/pick/autopick.py | 2 +- pylot/core/pick/utils.py | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/pylot/core/pick/autopick.py b/pylot/core/pick/autopick.py index 9134178c..0058ef08 100644 --- a/pylot/core/pick/autopick.py +++ b/pylot/core/pick/autopick.py @@ -800,7 +800,7 @@ class AutopickStation(object): return 1 if self.iplot > 1: self.set_current_figure('checkZ4s') - Pflag = checkZ4S(zne, aicpick.getpick(), self.s_params.zfac, self.p_params.tsnrz[2], self.iplot, + Pflag = checkZ4S(zne, aicpick.getpick(), self.pickparams, self.iplot, self.current_figure, self.current_linecolor) if Pflag == 0: self.p_results.marked = 'SinsteadP' diff --git a/pylot/core/pick/utils.py b/pylot/core/pick/utils.py index 11fe3093..c459b30c 100644 --- a/pylot/core/pick/utils.py +++ b/pylot/core/pick/utils.py @@ -1065,7 +1065,7 @@ def jackknife(X, phi, h=1): return PHI_jack, PHI_pseudo, PHI_sub -def checkZ4S(X, pick, zfac, checkwin, iplot, fig=None, linecolor='k'): +def checkZ4S(X, pick, pickparams, iplot, fig=None, linecolor='k'): """ Function to compare energy content of vertical trace with energy content of horizontal traces to detect spuriously @@ -1082,11 +1082,8 @@ def checkZ4S(X, pick, zfac, checkwin, iplot, fig=None, linecolor='k'): :type X: `~obspy.core.stream.Stream` :param pick: initial (AIC) P onset time :type pick: float - :param zfac: factor for threshold determination, vertical energy must - exceed coda level times zfac to declare a pick as P onset - :type zfac: float - :param checkwin: window length [s] for calculating P-coda engergy content - :type checkwin: float + :param pickparams: PylotParameter instance that holds the current picker settings loaded from a .in file + :type pickparams: PylotParameter :param iplot: if iplot > 1, energy content and threshold are shown :type iplot: int :param fig: Matplotlib figure to plot results in @@ -1097,6 +1094,17 @@ def checkZ4S(X, pick, zfac, checkwin, iplot, fig=None, linecolor='k'): :rtype: int """ + """ + Extract required parameters from pickparams + :param zfac: factor for threshold determination, vertical energy must + exceed coda level times zfac to declare a pick as P onset + :type zfac: float + :param checkwin: window length [s] for calculating P-coda engergy content + :type checkwin: float + """ + zfac = pickparams["zfac"] + checkwin = pickparams["tsnrz"][2] + plt_flag = 0 try: iplot = int(iplot)