From bac6d6f5ece8cbbea8e08f394b6b265a6cd614ef Mon Sep 17 00:00:00 2001 From: Darius Arnold Date: Sat, 26 Aug 2017 17:22:28 +0200 Subject: [PATCH] [add] jackknife safety factor no longer hardcoded, GUI parameter added --- pylot/core/io/default_parameters.py | 8 +++++++- pylot/core/pick/autopick.py | 3 ++- pylot/core/pick/utils.py | 6 +++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/pylot/core/io/default_parameters.py b/pylot/core/io/default_parameters.py index a8e648b5..4a6e75b7 100644 --- a/pylot/core/io/default_parameters.py +++ b/pylot/core/io/default_parameters.py @@ -348,6 +348,11 @@ defaults = {'rootpath': {'type': str, 'value': 1.0, 'namestring': 'Wadati tolerance'}, + 'jackfactor': {'type': float, + 'tooltip': 'pick is removed if the variance of the subgroup with the pick removed is larger than the mean variance of all subgroups times safety factor', + 'value': 5.0, + 'namestring': 'Jackknife safety factor'}, + 'WAscaling': {'type': (float, float, float), 'tooltip': 'Scaling relation (log(Ao)+Alog(r)+Br+C) of Wood-Anderson amplitude Ao [nm] \ If zeros are set, original Richter magnitude is calculated!', @@ -481,5 +486,6 @@ settings_special_pick = { 'minpercent', 'zfac', 'mdttolerance', - 'wdttolerance'] + 'wdttolerance', + 'jackfactor'], } diff --git a/pylot/core/pick/autopick.py b/pylot/core/pick/autopick.py index 0b60f4f7..5b8c4d96 100644 --- a/pylot/core/pick/autopick.py +++ b/pylot/core/pick/autopick.py @@ -41,6 +41,7 @@ def autopickevent(data, param, iplot=0, fig_dict=None, fig_dict_wadatijack=None, # parameter input file (usually autoPyLoT.in). wdttolerance = param.get('wdttolerance') mdttolerance = param.get('mdttolerance') + jackfactor = param.get('jackfactor') apverbose = param.get('apverbose') for n in range(len(data)): station = data[n].stats.station @@ -80,7 +81,7 @@ def autopickevent(data, param, iplot=0, fig_dict=None, fig_dict_wadatijack=None, # quality control # median check and jackknife on P-onset times - jk_checked_onsets = checkPonsets(all_onsets, mdttolerance, 1, fig_dict_wadatijack) + jk_checked_onsets = checkPonsets(all_onsets, mdttolerance, jackfactor, 1, fig_dict_wadatijack) #return jk_checked_onsets # check S-P times (Wadati) wadationsets = wadaticheck(jk_checked_onsets, wdttolerance, 1, fig_dict_wadatijack) diff --git a/pylot/core/pick/utils.py b/pylot/core/pick/utils.py index 3a5e2892..049d2d44 100644 --- a/pylot/core/pick/utils.py +++ b/pylot/core/pick/utils.py @@ -803,7 +803,7 @@ def checksignallength(X, pick, TSNR, minsiglength, nfac, minpercent, iplot=0, fi return returnflag -def checkPonsets(pickdic, dttolerance, iplot=0, fig_dict=None): +def checkPonsets(pickdic, dttolerance, jackfactor, iplot=0, fig_dict=None): ''' Function to check statistics of P-onset times: Control deviation from median (maximum adjusted deviation = dttolerance) and apply pseudo- @@ -840,9 +840,9 @@ def checkPonsets(pickdic, dttolerance, iplot=0, fig_dict=None): return # get pseudo variances smaller than average variances # (times safety factor), these picks passed jackknife test - ij = np.where(PHI_pseudo <= 5 * xjack) + ij = np.where(PHI_pseudo <= jackfactor * xjack) # these picks did not pass jackknife test - badjk = np.where(PHI_pseudo > 5 * xjack) + badjk = np.where(PHI_pseudo > jackfactor * xjack) badjkstations = np.array(stations)[badjk] print("checkPonsets: %d pick(s) did not pass jackknife test!" % len(badjkstations)) print(badjkstations)