Merge branch 'feature/parameter_limits' into develop
This commit is contained in:
commit
aba1a16f98
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Default parameters used for picking
|
Default parameters used for picking
|
||||||
@ -78,11 +79,15 @@ defaults = {'rootpath': {'type': str,
|
|||||||
'vp': {'type': float,
|
'vp': {'type': float,
|
||||||
'tooltip': 'average P-wave velocity',
|
'tooltip': 'average P-wave velocity',
|
||||||
'value': 3530.,
|
'value': 3530.,
|
||||||
|
'min': 0.,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'P-velocity'},
|
'namestring': 'P-velocity'},
|
||||||
|
|
||||||
'rho': {'type': float,
|
'rho': {'type': float,
|
||||||
'tooltip': 'average rock density [kg/m^3]',
|
'tooltip': 'average rock density [kg/m^3]',
|
||||||
'value': 2500.,
|
'value': 2500.,
|
||||||
|
'min': 0.,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'Density'},
|
'namestring': 'Density'},
|
||||||
|
|
||||||
'Qp': {'type': (float, float),
|
'Qp': {'type': (float, float),
|
||||||
@ -94,42 +99,58 @@ defaults = {'rootpath': {'type': str,
|
|||||||
'tooltip': 'start time [s] for calculating CF for P-picking (if TauPy:'
|
'tooltip': 'start time [s] for calculating CF for P-picking (if TauPy:'
|
||||||
' seconds relative to estimated onset)',
|
' seconds relative to estimated onset)',
|
||||||
'value': 15.0,
|
'value': 15.0,
|
||||||
|
'min': -np.inf,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'P start'},
|
'namestring': 'P start'},
|
||||||
|
|
||||||
'pstop': {'type': float,
|
'pstop': {'type': float,
|
||||||
'tooltip': 'end time [s] for calculating CF for P-picking (if TauPy:'
|
'tooltip': 'end time [s] for calculating CF for P-picking (if TauPy:'
|
||||||
' seconds relative to estimated onset)',
|
' seconds relative to estimated onset)',
|
||||||
'value': 60.0,
|
'value': 60.0,
|
||||||
|
'min': -np.inf,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'P stop'},
|
'namestring': 'P stop'},
|
||||||
|
|
||||||
'sstart': {'type': float,
|
'sstart': {'type': float,
|
||||||
'tooltip': 'start time [s] relative to P-onset for calculating CF for S-picking',
|
'tooltip': 'start time [s] relative to P-onset for calculating CF for S-picking',
|
||||||
'value': -1.0,
|
'value': -1.0,
|
||||||
|
'min': -np.inf,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'S start'},
|
'namestring': 'S start'},
|
||||||
|
|
||||||
'sstop': {'type': float,
|
'sstop': {'type': float,
|
||||||
'tooltip': 'end time [s] after P-onset for calculating CF for S-picking',
|
'tooltip': 'end time [s] after P-onset for calculating CF for S-picking',
|
||||||
'value': 10.0,
|
'value': 10.0,
|
||||||
|
'min': -np.inf,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'S stop'},
|
'namestring': 'S stop'},
|
||||||
|
|
||||||
'bpz1': {'type': (float, float),
|
'bpz1': {'type': (float, float),
|
||||||
'tooltip': 'lower/upper corner freq. of first band pass filter Z-comp. [Hz]',
|
'tooltip': 'lower/upper corner freq. of first band pass filter Z-comp. [Hz]',
|
||||||
'value': (2, 20),
|
'value': (2, 20),
|
||||||
|
'min': (0., 0.),
|
||||||
|
'max': (np.inf, np.inf),
|
||||||
'namestring': ('Z-bandpass 1', 'Lower', 'Upper')},
|
'namestring': ('Z-bandpass 1', 'Lower', 'Upper')},
|
||||||
|
|
||||||
'bpz2': {'type': (float, float),
|
'bpz2': {'type': (float, float),
|
||||||
'tooltip': 'lower/upper corner freq. of second band pass filter Z-comp. [Hz]',
|
'tooltip': 'lower/upper corner freq. of second band pass filter Z-comp. [Hz]',
|
||||||
'value': (2, 30),
|
'value': (2, 30),
|
||||||
|
'min': (0., 0.),
|
||||||
|
'max': (np.inf, np.inf),
|
||||||
'namestring': ('Z-bandpass 2', 'Lower', 'Upper')},
|
'namestring': ('Z-bandpass 2', 'Lower', 'Upper')},
|
||||||
|
|
||||||
'bph1': {'type': (float, float),
|
'bph1': {'type': (float, float),
|
||||||
'tooltip': 'lower/upper corner freq. of first band pass filter H-comp. [Hz]',
|
'tooltip': 'lower/upper corner freq. of first band pass filter H-comp. [Hz]',
|
||||||
'value': (2, 15),
|
'value': (2, 15),
|
||||||
|
'min': (0., 0.),
|
||||||
|
'max': (np.inf, np.inf),
|
||||||
'namestring': ('H-bandpass 1', 'Lower', 'Upper')},
|
'namestring': ('H-bandpass 1', 'Lower', 'Upper')},
|
||||||
|
|
||||||
'bph2': {'type': (float, float),
|
'bph2': {'type': (float, float),
|
||||||
'tooltip': 'lower/upper corner freq. of second band pass filter z-comp. [Hz]',
|
'tooltip': 'lower/upper corner freq. of second band pass filter z-comp. [Hz]',
|
||||||
'value': (2, 20),
|
'value': (2, 20),
|
||||||
|
'min': (0., 0.),
|
||||||
|
'max': (np.inf, np.inf),
|
||||||
'namestring': ('H-bandpass 2', 'Lower', 'Upper')},
|
'namestring': ('H-bandpass 2', 'Lower', 'Upper')},
|
||||||
|
|
||||||
'algoP': {'type': str,
|
'algoP': {'type': str,
|
||||||
@ -140,76 +161,106 @@ defaults = {'rootpath': {'type': str,
|
|||||||
'tlta': {'type': float,
|
'tlta': {'type': float,
|
||||||
'tooltip': 'for HOS-/AR-AIC-picker, length of LTA window [s]',
|
'tooltip': 'for HOS-/AR-AIC-picker, length of LTA window [s]',
|
||||||
'value': 7.0,
|
'value': 7.0,
|
||||||
|
'min': 0.,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'LTA window'},
|
'namestring': 'LTA window'},
|
||||||
|
|
||||||
'hosorder': {'type': int,
|
'hosorder': {'type': int,
|
||||||
'tooltip': 'for HOS-picker, order of Higher Order Statistics',
|
'tooltip': 'for HOS-picker, order of Higher Order Statistics',
|
||||||
'value': 4,
|
'value': 4,
|
||||||
|
'min': 0,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'HOS order'},
|
'namestring': 'HOS order'},
|
||||||
|
|
||||||
'Parorder': {'type': int,
|
'Parorder': {'type': int,
|
||||||
'tooltip': 'for AR-picker, order of AR process of Z-component',
|
'tooltip': 'for AR-picker, order of AR process of Z-component',
|
||||||
'value': 2,
|
'value': 2,
|
||||||
|
'min': 0,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'AR order P'},
|
'namestring': 'AR order P'},
|
||||||
|
|
||||||
'tdet1z': {'type': float,
|
'tdet1z': {'type': float,
|
||||||
'tooltip': 'for AR-picker, length of AR determination window [s] for Z-component, 1st pick',
|
'tooltip': 'for AR-picker, length of AR determination window [s] for Z-component, 1st pick',
|
||||||
'value': 1.2,
|
'value': 1.2,
|
||||||
|
'min': 0.,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'AR det. window Z 1'},
|
'namestring': 'AR det. window Z 1'},
|
||||||
|
|
||||||
'tpred1z': {'type': float,
|
'tpred1z': {'type': float,
|
||||||
'tooltip': 'for AR-picker, length of AR prediction window [s] for Z-component, 1st pick',
|
'tooltip': 'for AR-picker, length of AR prediction window [s] for Z-component, 1st pick',
|
||||||
'value': 0.4,
|
'value': 0.4,
|
||||||
|
'min': 0.,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'AR pred. window Z 1'},
|
'namestring': 'AR pred. window Z 1'},
|
||||||
|
|
||||||
'tdet2z': {'type': float,
|
'tdet2z': {'type': float,
|
||||||
'tooltip': 'for AR-picker, length of AR determination window [s] for Z-component, 2nd pick',
|
'tooltip': 'for AR-picker, length of AR determination window [s] for Z-component, 2nd pick',
|
||||||
'value': 0.6,
|
'value': 0.6,
|
||||||
|
'min': 0.,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'AR det. window Z 2'},
|
'namestring': 'AR det. window Z 2'},
|
||||||
|
|
||||||
'tpred2z': {'type': float,
|
'tpred2z': {'type': float,
|
||||||
'tooltip': 'for AR-picker, length of AR prediction window [s] for Z-component, 2nd pick',
|
'tooltip': 'for AR-picker, length of AR prediction window [s] for Z-component, 2nd pick',
|
||||||
'value': 0.2,
|
'value': 0.2,
|
||||||
|
'min': 0.,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'AR pred. window Z 2'},
|
'namestring': 'AR pred. window Z 2'},
|
||||||
|
|
||||||
'addnoise': {'type': float,
|
'addnoise': {'type': float,
|
||||||
'tooltip': 'add noise to seismogram for stable AR prediction',
|
'tooltip': 'add noise to seismogram for stable AR prediction',
|
||||||
'value': 0.001,
|
'value': 0.001,
|
||||||
|
'min': 0.,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'Add noise'},
|
'namestring': 'Add noise'},
|
||||||
|
|
||||||
'tsnrz': {'type': (float, float, float, float),
|
'tsnrz': {'type': (float, float, float, float),
|
||||||
'tooltip': 'for HOS/AR, window lengths for SNR-and slope estimation [tnoise, tsafetey, tsignal, tslope] [s]',
|
'tooltip': 'for HOS/AR, window lengths for SNR-and slope estimation [tnoise, tsafetey, tsignal, tslope] [s]',
|
||||||
'value': (3, 0.1, 0.5, 1.0),
|
'value': (3, 0.1, 0.5, 1.0),
|
||||||
|
'min': (0., 0., 0., 0.),
|
||||||
|
'max': (np.inf, np.inf, np.inf, np.inf),
|
||||||
'namestring': ('SNR windows P', 'Noise', 'Safety', 'Signal', 'Slope')},
|
'namestring': ('SNR windows P', 'Noise', 'Safety', 'Signal', 'Slope')},
|
||||||
|
|
||||||
'pickwinP': {'type': float,
|
'pickwinP': {'type': float,
|
||||||
'tooltip': 'for initial AIC pick, length of P-pick window [s]',
|
'tooltip': 'for initial AIC pick, length of P-pick window [s]',
|
||||||
'value': 3.0,
|
'value': 3.0,
|
||||||
|
'min': 0.,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'AIC window P'},
|
'namestring': 'AIC window P'},
|
||||||
|
|
||||||
'Precalcwin': {'type': float,
|
'Precalcwin': {'type': float,
|
||||||
'tooltip': 'for HOS/AR, window length [s] for recalculation of CF (relative to 1st pick)',
|
'tooltip': 'for HOS/AR, window length [s] for recalculation of CF (relative to 1st pick)',
|
||||||
'value': 6.0,
|
'value': 6.0,
|
||||||
|
'min': 0.,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'Recal. window P'},
|
'namestring': 'Recal. window P'},
|
||||||
|
|
||||||
'aictsmooth': {'type': float,
|
'aictsmooth': {'type': float,
|
||||||
'tooltip': 'for HOS/AR, take average of samples for smoothing of AIC-function [s]',
|
'tooltip': 'for HOS/AR, take average of samples for smoothing of AIC-function [s]',
|
||||||
'value': 0.2,
|
'value': 0.2,
|
||||||
|
'min': 0.,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'AIC smooth P'},
|
'namestring': 'AIC smooth P'},
|
||||||
|
|
||||||
'tsmoothP': {'type': float,
|
'tsmoothP': {'type': float,
|
||||||
'tooltip': 'for HOS/AR, take average of samples in this time window for smoothing CF [s]',
|
'tooltip': 'for HOS/AR, take average of samples in this time window for smoothing CF [s]',
|
||||||
'value': 0.1,
|
'value': 0.1,
|
||||||
|
'min': 0.,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'CF smooth P'},
|
'namestring': 'CF smooth P'},
|
||||||
|
|
||||||
'ausP': {'type': float,
|
'ausP': {'type': float,
|
||||||
'tooltip': 'for HOS/AR, artificial uplift of samples (aus) of CF (P)',
|
'tooltip': 'for HOS/AR, artificial uplift of samples (aus) of CF (P)',
|
||||||
'value': 0.001,
|
'value': 0.001,
|
||||||
|
'min': 0.,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'Artificial uplift P'},
|
'namestring': 'Artificial uplift P'},
|
||||||
|
|
||||||
'nfacP': {'type': float,
|
'nfacP': {'type': float,
|
||||||
'tooltip': 'for HOS/AR, noise factor for noise level determination (P)',
|
'tooltip': 'for HOS/AR, noise factor for noise level determination (P)',
|
||||||
'value': 1.3,
|
'value': 1.3,
|
||||||
|
'min': 0.,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'Noise factor P'},
|
'namestring': 'Noise factor P'},
|
||||||
|
|
||||||
'algoS': {'type': str,
|
'algoS': {'type': str,
|
||||||
@ -220,61 +271,85 @@ defaults = {'rootpath': {'type': str,
|
|||||||
'tdet1h': {'type': float,
|
'tdet1h': {'type': float,
|
||||||
'tooltip': 'for HOS/AR, length of AR-determination window [s], H-components, 1st pick',
|
'tooltip': 'for HOS/AR, length of AR-determination window [s], H-components, 1st pick',
|
||||||
'value': 0.8,
|
'value': 0.8,
|
||||||
|
'min': 0.,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'AR det. window H 1'},
|
'namestring': 'AR det. window H 1'},
|
||||||
|
|
||||||
'tpred1h': {'type': float,
|
'tpred1h': {'type': float,
|
||||||
'tooltip': 'for HOS/AR, length of AR-prediction window [s], H-components, 1st pick',
|
'tooltip': 'for HOS/AR, length of AR-prediction window [s], H-components, 1st pick',
|
||||||
'value': 0.4,
|
'value': 0.4,
|
||||||
|
'min': 0.,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'AR pred. window H 1'},
|
'namestring': 'AR pred. window H 1'},
|
||||||
|
|
||||||
'tdet2h': {'type': float,
|
'tdet2h': {'type': float,
|
||||||
'tooltip': 'for HOS/AR, length of AR-determinaton window [s], H-components, 2nd pick',
|
'tooltip': 'for HOS/AR, length of AR-determinaton window [s], H-components, 2nd pick',
|
||||||
'value': 0.6,
|
'value': 0.6,
|
||||||
|
'min': 0.,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'AR det. window H 2'},
|
'namestring': 'AR det. window H 2'},
|
||||||
|
|
||||||
'tpred2h': {'type': float,
|
'tpred2h': {'type': float,
|
||||||
'tooltip': 'for HOS/AR, length of AR-prediction window [s], H-components, 2nd pick',
|
'tooltip': 'for HOS/AR, length of AR-prediction window [s], H-components, 2nd pick',
|
||||||
'value': 0.3,
|
'value': 0.3,
|
||||||
|
'min': 0.,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'AR pred. window H 2'},
|
'namestring': 'AR pred. window H 2'},
|
||||||
|
|
||||||
'Sarorder': {'type': int,
|
'Sarorder': {'type': int,
|
||||||
'tooltip': 'for AR-picker, order of AR process of H-components',
|
'tooltip': 'for AR-picker, order of AR process of H-components',
|
||||||
'value': 4,
|
'value': 4,
|
||||||
|
'min': 0,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'AR order S'},
|
'namestring': 'AR order S'},
|
||||||
|
|
||||||
'Srecalcwin': {'type': float,
|
'Srecalcwin': {'type': float,
|
||||||
'tooltip': 'for AR-picker, window length [s] for recalculation of CF (2nd pick) (H)',
|
'tooltip': 'for AR-picker, window length [s] for recalculation of CF (2nd pick) (H)',
|
||||||
'value': 5.0,
|
'value': 5.0,
|
||||||
|
'min': 0.,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'Recal. window S'},
|
'namestring': 'Recal. window S'},
|
||||||
|
|
||||||
'pickwinS': {'type': float,
|
'pickwinS': {'type': float,
|
||||||
'tooltip': 'for initial AIC pick, length of S-pick window [s]',
|
'tooltip': 'for initial AIC pick, length of S-pick window [s]',
|
||||||
'value': 3.0,
|
'value': 3.0,
|
||||||
|
'min': 0.,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'AIC window S'},
|
'namestring': 'AIC window S'},
|
||||||
|
|
||||||
'tsnrh': {'type': (float, float, float, float),
|
'tsnrh': {'type': (float, float, float, float),
|
||||||
'tooltip': 'for ARH/AR3, window lengths for SNR-and slope estimation [tnoise, tsafetey, tsignal, tslope] [s]',
|
'tooltip': 'for ARH/AR3, window lengths for SNR-and slope estimation [tnoise, tsafetey, tsignal, tslope] [s]',
|
||||||
'value': (2, 0.2, 1.5, 0.5),
|
'value': (2, 0.2, 1.5, 0.5),
|
||||||
|
'min': (0., 0., 0., 0.),
|
||||||
|
'max': (np.inf, np.inf, np.inf, np.inf),
|
||||||
'namestring': ('SNR windows S', 'Noise', 'Safety', 'Signal', 'Slope')},
|
'namestring': ('SNR windows S', 'Noise', 'Safety', 'Signal', 'Slope')},
|
||||||
|
|
||||||
'aictsmoothS': {'type': float,
|
'aictsmoothS': {'type': float,
|
||||||
'tooltip': 'for AIC-picker, take average of samples in this time window for smoothing of AIC-function [s]',
|
'tooltip': 'for AIC-picker, take average of samples in this time window for smoothing of AIC-function [s]',
|
||||||
'value': 0.5,
|
'value': 0.5,
|
||||||
|
'min': 0.,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'AIC smooth S'},
|
'namestring': 'AIC smooth S'},
|
||||||
|
|
||||||
'tsmoothS': {'type': float,
|
'tsmoothS': {'type': float,
|
||||||
'tooltip': 'for AR-picker, take average of samples for smoothing CF [s] (S)',
|
'tooltip': 'for AR-picker, take average of samples for smoothing CF [s] (S)',
|
||||||
'value': 0.7,
|
'value': 0.7,
|
||||||
|
'min': 0.,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'CF smooth S'},
|
'namestring': 'CF smooth S'},
|
||||||
|
|
||||||
'ausS': {'type': float,
|
'ausS': {'type': float,
|
||||||
'tooltip': 'for HOS/AR, artificial uplift of samples (aus) of CF (S)',
|
'tooltip': 'for HOS/AR, artificial uplift of samples (aus) of CF (S)',
|
||||||
'value': 0.9,
|
'value': 0.9,
|
||||||
|
'min': 0.,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'Artificial uplift S'},
|
'namestring': 'Artificial uplift S'},
|
||||||
|
|
||||||
'nfacS': {'type': float,
|
'nfacS': {'type': float,
|
||||||
'tooltip': 'for AR-picker, noise factor for noise level determination (S)',
|
'tooltip': 'for AR-picker, noise factor for noise level determination (S)',
|
||||||
'value': 1.5,
|
'value': 1.5,
|
||||||
|
'min': 0.,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'Noise factor S'},
|
'namestring': 'Noise factor S'},
|
||||||
|
|
||||||
'minfmweight': {'type': int,
|
'minfmweight': {'type': int,
|
||||||
@ -285,103 +360,143 @@ defaults = {'rootpath': {'type': str,
|
|||||||
'minFMSNR': {'type': float,
|
'minFMSNR': {'type': float,
|
||||||
'tooltip': 'miniumum required SNR for first-motion determination',
|
'tooltip': 'miniumum required SNR for first-motion determination',
|
||||||
'value': 2.,
|
'value': 2.,
|
||||||
|
'min': 0.,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'Min SNR'},
|
'namestring': 'Min SNR'},
|
||||||
|
|
||||||
'fmpickwin': {'type': float,
|
'fmpickwin': {'type': float,
|
||||||
'tooltip': 'pick window [s] around P onset for calculating zero crossings',
|
'tooltip': 'pick window [s] around P onset for calculating zero crossings',
|
||||||
'value': 0.2,
|
'value': 0.2,
|
||||||
|
'min': 0.,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'Zero crossings window'},
|
'namestring': 'Zero crossings window'},
|
||||||
|
|
||||||
'timeerrorsP': {'type': (float, float, float, float),
|
'timeerrorsP': {'type': (float, float, float, float),
|
||||||
'tooltip': 'discrete time errors [s] corresponding to picking weights [0 1 2 3] for P',
|
'tooltip': 'discrete time errors [s] corresponding to picking weights [0 1 2 3] for P',
|
||||||
'value': (0.01, 0.02, 0.04, 0.08),
|
'value': (0.01, 0.02, 0.04, 0.08),
|
||||||
|
'min': (0., 0., 0., 0.),
|
||||||
|
'max': (np.inf, np.inf, np.inf, np.inf),
|
||||||
'namestring': ('Time errors P', '0', '1', '2', '3')},
|
'namestring': ('Time errors P', '0', '1', '2', '3')},
|
||||||
|
|
||||||
'timeerrorsS': {'type': (float, float, float, float),
|
'timeerrorsS': {'type': (float, float, float, float),
|
||||||
'tooltip': 'discrete time errors [s] corresponding to picking weights [0 1 2 3] for S',
|
'tooltip': 'discrete time errors [s] corresponding to picking weights [0 1 2 3] for S',
|
||||||
'value': (0.04, 0.08, 0.16, 0.32),
|
'value': (0.04, 0.08, 0.16, 0.32),
|
||||||
|
'min': (0., 0., 0., 0.),
|
||||||
|
'max': (np.inf, np.inf, np.inf, np.inf),
|
||||||
'namestring': ('Time errors S', '0', '1', '2', '3')},
|
'namestring': ('Time errors S', '0', '1', '2', '3')},
|
||||||
|
|
||||||
'minAICPslope': {'type': float,
|
'minAICPslope': {'type': float,
|
||||||
'tooltip': 'below this slope [counts/s] the initial P pick is rejected',
|
'tooltip': 'below this slope [counts/s] the initial P pick is rejected',
|
||||||
'value': 0.8,
|
'value': 0.8,
|
||||||
|
'min': 0.,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'Min. slope P'},
|
'namestring': 'Min. slope P'},
|
||||||
|
|
||||||
'minAICPSNR': {'type': float,
|
'minAICPSNR': {'type': float,
|
||||||
'tooltip': 'below this SNR the initial P pick is rejected',
|
'tooltip': 'below this SNR the initial P pick is rejected',
|
||||||
'value': 1.1,
|
'value': 1.1,
|
||||||
|
'min': 0.,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'Min. SNR P'},
|
'namestring': 'Min. SNR P'},
|
||||||
|
|
||||||
'minAICSslope': {'type': float,
|
'minAICSslope': {'type': float,
|
||||||
'tooltip': 'below this slope [counts/s] the initial S pick is rejected',
|
'tooltip': 'below this slope [counts/s] the initial S pick is rejected',
|
||||||
'value': 1.,
|
'value': 1.,
|
||||||
|
'min': 0.,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'Min. slope S'},
|
'namestring': 'Min. slope S'},
|
||||||
|
|
||||||
'minAICSSNR': {'type': float,
|
'minAICSSNR': {'type': float,
|
||||||
'tooltip': 'below this SNR the initial S pick is rejected',
|
'tooltip': 'below this SNR the initial S pick is rejected',
|
||||||
'value': 1.5,
|
'value': 1.5,
|
||||||
|
'min': 0.,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'Min. SNR S'},
|
'namestring': 'Min. SNR S'},
|
||||||
|
|
||||||
'minsiglength': {'type': float,
|
'minsiglength': {'type': float,
|
||||||
'tooltip': 'length of signal part for which amplitudes must exceed noiselevel [s]',
|
'tooltip': 'length of signal part for which amplitudes must exceed noiselevel [s]',
|
||||||
'value': 1.,
|
'value': 1.,
|
||||||
|
'min': 0.,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'Min. signal length'},
|
'namestring': 'Min. signal length'},
|
||||||
|
|
||||||
'noisefactor': {'type': float,
|
'noisefactor': {'type': float,
|
||||||
'tooltip': 'noiselevel*noisefactor=threshold',
|
'tooltip': 'noiselevel*noisefactor=threshold',
|
||||||
'value': 1.0,
|
'value': 1.0,
|
||||||
|
'min': 0.,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'Noise factor'},
|
'namestring': 'Noise factor'},
|
||||||
|
|
||||||
'minpercent': {'type': float,
|
'minpercent': {'type': float,
|
||||||
'tooltip': 'required percentage of amplitudes exceeding threshold',
|
'tooltip': 'required percentage of amplitudes exceeding threshold',
|
||||||
'value': 10.,
|
'value': 10.,
|
||||||
|
'min': 0.,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'Min amplitude [%]'},
|
'namestring': 'Min amplitude [%]'},
|
||||||
|
|
||||||
'zfac': {'type': float,
|
'zfac': {'type': float,
|
||||||
'tooltip': 'P-amplitude must exceed at least zfac times RMS-S amplitude',
|
'tooltip': 'P-amplitude must exceed at least zfac times RMS-S amplitude',
|
||||||
'value': 1.5,
|
'value': 1.5,
|
||||||
|
'min': 0.,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'Z factor'},
|
'namestring': 'Z factor'},
|
||||||
|
|
||||||
'mdttolerance': {'type': float,
|
'mdttolerance': {'type': float,
|
||||||
'tooltip': 'maximum allowed deviation of P picks from median [s]',
|
'tooltip': 'maximum allowed deviation of P picks from median [s]',
|
||||||
'value': 6.0,
|
'value': 6.0,
|
||||||
|
'min': 0.,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'Median tolerance'},
|
'namestring': 'Median tolerance'},
|
||||||
|
|
||||||
'wdttolerance': {'type': float,
|
'wdttolerance': {'type': float,
|
||||||
'tooltip': 'maximum allowed deviation from Wadati-diagram',
|
'tooltip': 'maximum allowed deviation from Wadati-diagram',
|
||||||
'value': 1.0,
|
'value': 1.0,
|
||||||
|
'min': 0.,
|
||||||
|
'max': np.inf,
|
||||||
'namestring': 'Wadati tolerance'},
|
'namestring': 'Wadati tolerance'},
|
||||||
|
|
||||||
'jackfactor': {'type': float,
|
'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',
|
'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,
|
'value': 5.0,
|
||||||
'namestring': 'Jackknife safety factor'},
|
'min': 0.,
|
||||||
|
'max': np.inf,
|
||||||
|
'namestring': 'Jackknife safety factor'},
|
||||||
|
|
||||||
'WAscaling': {'type': (float, float, float),
|
'WAscaling': {'type': (float, float, float),
|
||||||
'tooltip': 'Scaling relation (log(Ao)+Alog(r)+Br+C) of Wood-Anderson amplitude Ao [nm] \
|
'tooltip': 'Scaling relation (log(Ao)+Alog(r)+Br+C) of Wood-Anderson amplitude Ao [nm] \
|
||||||
If zeros are set, original Richter magnitude is calculated!',
|
If zeros are set, original Richter magnitude is calculated!',
|
||||||
'value': (0., 0., 0.),
|
'value': (0., 0., 0.),
|
||||||
|
'min': (0., 0., 0.),
|
||||||
|
'max': (np.inf, np.inf, np.inf),
|
||||||
'namestring': ('Wood-Anderson scaling', '', '', '')},
|
'namestring': ('Wood-Anderson scaling', '', '', '')},
|
||||||
|
|
||||||
'magscaling': {'type': (float, float),
|
'magscaling': {'type': (float, float),
|
||||||
'tooltip': 'Scaling relation for derived local magnitude [a*Ml+b]. \
|
'tooltip': 'Scaling relation for derived local magnitude [a*Ml+b]. \
|
||||||
If zeros are set, no scaling of network magnitude is applied!',
|
If zeros are set, no scaling of network magnitude is applied!',
|
||||||
'value': (0., 0.),
|
'value': (0., 0.),
|
||||||
|
'min': (0., 0.),
|
||||||
|
'max': (np.inf, np.inf),
|
||||||
'namestring': ('Local mag. scaling', '', '')},
|
'namestring': ('Local mag. scaling', '', '')},
|
||||||
|
|
||||||
'minfreq': {'type': (float, float),
|
'minfreq': {'type': (float, float),
|
||||||
'tooltip': 'Lower filter frequency [P, S]',
|
'tooltip': 'Lower filter frequency [P, S]',
|
||||||
'value': (1.0, 1.0),
|
'value': (1.0, 1.0),
|
||||||
|
'min': (0., 0.),
|
||||||
|
'max': (np.inf, np.inf),
|
||||||
'namestring': ('Lower freq.', 'P', 'S')},
|
'namestring': ('Lower freq.', 'P', 'S')},
|
||||||
|
|
||||||
'maxfreq': {'type': (float, float),
|
'maxfreq': {'type': (float, float),
|
||||||
'tooltip': 'Upper filter frequency [P, S]',
|
'tooltip': 'Upper filter frequency [P, S]',
|
||||||
'value': (10.0, 10.0),
|
'value': (10.0, 10.0),
|
||||||
|
'min': (0., 0.),
|
||||||
|
'max': (np.inf, np.inf),
|
||||||
'namestring': ('Upper freq.', 'P', 'S')},
|
'namestring': ('Upper freq.', 'P', 'S')},
|
||||||
|
|
||||||
'filter_order': {'type': (int, int),
|
'filter_order': {'type': (int, int),
|
||||||
'tooltip': 'filter order [P, S]',
|
'tooltip': 'filter order [P, S]',
|
||||||
'value': (2, 2),
|
'value': (2, 2),
|
||||||
|
'min': (0, 0),
|
||||||
|
'max': (np.inf, np.inf),
|
||||||
'namestring': ('Order', 'P', 'S')},
|
'namestring': ('Order', 'P', 'S')},
|
||||||
|
|
||||||
'filter_type': {'type': (str, str),
|
'filter_type': {'type': (str, str),
|
||||||
|
@ -93,6 +93,11 @@ class PylotParameter(object):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
def __setitem__(self, key, value):
|
def __setitem__(self, key, value):
|
||||||
|
try:
|
||||||
|
value = self.check_range(value, self.__defaults[key]['max'], self.__defaults[key]['min'])
|
||||||
|
except KeyError:
|
||||||
|
# no min/max values in defaults
|
||||||
|
pass
|
||||||
self.__parameter[key] = value
|
self.__parameter[key] = value
|
||||||
|
|
||||||
def __delitem__(self, key):
|
def __delitem__(self, key):
|
||||||
@ -190,6 +195,32 @@ class PylotParameter(object):
|
|||||||
all_names += self.get_special_para_names()['quality']
|
all_names += self.get_special_para_names()['quality']
|
||||||
return all_names
|
return all_names
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def check_range(value, max_value, min_value):
|
||||||
|
"""
|
||||||
|
Check if value is within the min/max values defined in default_parameters. Works for tuple and scalar values.
|
||||||
|
:param value: Value to be checked against min/max range
|
||||||
|
:param max_value: Maximum allowed value, tuple or scalar
|
||||||
|
:param min_value: Minimum allowed value, tuple or scalar
|
||||||
|
:return: value tuple/scalar clamped to the valid range
|
||||||
|
|
||||||
|
>>> checkRange(-5, 10, 0)
|
||||||
|
0
|
||||||
|
>>> checkRange((-5., 100.), (10., 10.), (0., 0.))
|
||||||
|
(0.0, 10.0)
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
# Try handling tuples by comparing their elements
|
||||||
|
comparisons = [(a > b) for a, b in zip(value, max_value)]
|
||||||
|
if True in comparisons:
|
||||||
|
value = tuple(max_value[i] if comp else value[i] for i, comp in enumerate(comparisons))
|
||||||
|
comparisons = [(a < b) for a, b in zip(value, min_value)]
|
||||||
|
if True in comparisons:
|
||||||
|
value = tuple(min_value[i] if comp else value[i] for i, comp in enumerate(comparisons))
|
||||||
|
except TypeError:
|
||||||
|
value = max(min_value, min(max_value, value))
|
||||||
|
return value
|
||||||
|
|
||||||
def checkValue(self, param, value):
|
def checkValue(self, param, value):
|
||||||
"""
|
"""
|
||||||
Check type of value against expected type of param.
|
Check type of value against expected type of param.
|
||||||
|
Loading…
Reference in New Issue
Block a user