Change checkZ4S so it extracts the required parameters

This commit is contained in:
Darius Arnold 2019-04-09 17:05:51 +02:00
parent c45f52510b
commit d45a5ccf0d
2 changed files with 15 additions and 7 deletions

View File

@ -800,7 +800,7 @@ class AutopickStation(object):
return 1 return 1
if self.iplot > 1: self.set_current_figure('checkZ4s') 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) self.current_figure, self.current_linecolor)
if Pflag == 0: if Pflag == 0:
self.p_results.marked = 'SinsteadP' self.p_results.marked = 'SinsteadP'

View File

@ -1065,7 +1065,7 @@ def jackknife(X, phi, h=1):
return PHI_jack, PHI_pseudo, PHI_sub 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 Function to compare energy content of vertical trace with
energy content of horizontal traces to detect spuriously 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` :type X: `~obspy.core.stream.Stream`
:param pick: initial (AIC) P onset time :param pick: initial (AIC) P onset time
:type pick: float :type pick: float
:param zfac: factor for threshold determination, vertical energy must :param pickparams: PylotParameter instance that holds the current picker settings loaded from a .in file
exceed coda level times zfac to declare a pick as P onset :type pickparams: PylotParameter
:type zfac: float
:param checkwin: window length [s] for calculating P-coda engergy content
:type checkwin: float
:param iplot: if iplot > 1, energy content and threshold are shown :param iplot: if iplot > 1, energy content and threshold are shown
:type iplot: int :type iplot: int
:param fig: Matplotlib figure to plot results in :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 :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 plt_flag = 0
try: try:
iplot = int(iplot) iplot = int(iplot)