diff --git a/PyLoT.py b/PyLoT.py index 7c718c10..1c790609 100755 --- a/PyLoT.py +++ b/PyLoT.py @@ -67,7 +67,7 @@ from pylot.core.io.data import Data from pylot.core.io.inputs import FilterOptions, PylotParameter from autoPyLoT import autoPyLoT from pylot.core.pick.compare import Comparison -from pylot.core.pick.utils import symmetrize_error, getQualityFromUncertainty +from pylot.core.pick.utils import symmetrize_error, get_quality_class from pylot.core.io.phases import picksdict_from_picks import pylot.core.loc.nll as nll from pylot.core.util.defaults import FILTERDEFAULTS, SetChannelComponents @@ -1243,7 +1243,7 @@ class MainWindow(QMainWindow): for phasename, pick in picks.items(): if not type(pick) in [dict, AttribDict]: continue - if getQualityFromUncertainty(has_spe(pick), phaseErrors[self.getPhaseID(phasename)]) < 4: + if get_quality_class(has_spe(pick), phaseErrors[self.getPhaseID(phasename)]) < 4: ma_count[ma] += 1 event_ref = event.isRefEvent() @@ -2519,10 +2519,10 @@ class MainWindow(QMainWindow): # get quality classes if self.getPhaseID(phase) == 'P': - quality = getQualityFromUncertainty(picks['spe'], self._inputs['timeerrorsP']) + quality = get_quality_class(picks['spe'], self._inputs['timeerrorsP']) phaseID = 'P' elif self.getPhaseID(phase) == 'S': - quality = getQualityFromUncertainty(picks['spe'], self._inputs['timeerrorsS']) + quality = get_quality_class(picks['spe'], self._inputs['timeerrorsS']) phaseID = 'S' mpp = picks['mpp'] - stime @@ -2870,7 +2870,7 @@ class MainWindow(QMainWindow): for phasename, pick in picks.items(): if not type(pick) in [dict, AttribDict]: continue - if getQualityFromUncertainty(has_spe(pick), phaseErrors[self.getPhaseID(phasename)]) < 4: + if get_quality_class(has_spe(pick), phaseErrors[self.getPhaseID(phasename)]) < 4: ma_count[ma] += 1 # init table items for current row diff --git a/pylot/core/io/phases.py b/pylot/core/io/phases.py index fa0e7587..874ac308 100644 --- a/pylot/core/io/phases.py +++ b/pylot/core/io/phases.py @@ -943,7 +943,7 @@ def getQualitiesfromxml(xmlnames, ErrorsP, ErrorsS, plotflag=1): :rtype: """ - from pylot.core.pick.utils import getQualityFromUncertainty + from pylot.core.pick.utils import get_quality_class from pylot.core.util.utils import loopIdentifyPhase, identifyPhase # read all onset weights @@ -991,7 +991,7 @@ def getQualitiesfromxml(xmlnames, ErrorsP, ErrorsS, plotflag=1): for Pick in arrivals_copy: phase = identifyPhase(loopIdentifyPhase(Pick.phase_hint)) if phase == 'P': - Pqual = getQualityFromUncertainty(Pick.time_errors.uncertainty, ErrorsP) + Pqual = get_quality_class(Pick.time_errors.uncertainty, ErrorsP) if Pqual == 0: Pw0.append(Pick.time_errors.uncertainty) elif Pqual == 1: @@ -1003,7 +1003,7 @@ def getQualitiesfromxml(xmlnames, ErrorsP, ErrorsS, plotflag=1): elif Pqual == 4: Pw4.append(Pick.time_errors.uncertainty) elif phase == 'S': - Squal = getQualityFromUncertainty(Pick.time_errors.uncertainty, ErrorsS) + Squal = get_quality_class(Pick.time_errors.uncertainty, ErrorsS) if Squal == 0: Sw0.append(Pick.time_errors.uncertainty) elif Squal == 1: diff --git a/pylot/core/pick/autopick.py b/pylot/core/pick/autopick.py index 54532f92..0cd92f76 100644 --- a/pylot/core/pick/autopick.py +++ b/pylot/core/pick/autopick.py @@ -15,7 +15,7 @@ from pylot.core.pick.charfuns import CharacteristicFunction from pylot.core.pick.charfuns import HOScf, AICcf, ARZcf, ARHcf, AR3Ccf from pylot.core.pick.picker import AICPicker, PragPicker from pylot.core.pick.utils import checksignallength, checkZ4S, earllatepicker, \ - getSNR, fmpicker, checkPonsets, wadaticheck, get_pickparams + getSNR, fmpicker, checkPonsets, wadaticheck, get_pickparams, get_quality_class from pylot.core.util.utils import getPatternLine, gen_Pool,\ real_Bool, identifyPhaseID diff --git a/pylot/core/pick/utils.py b/pylot/core/pick/utils.py index 2e99a583..c140af40 100644 --- a/pylot/core/pick/utils.py +++ b/pylot/core/pick/utils.py @@ -1194,7 +1194,7 @@ def checkZ4S(X, pick, zfac, checkwin, iplot, fig=None, linecolor='k'): return returnflag -def getQualityFromUncertainty(uncertainty, Errors): +def get_quality_class(uncertainty, weight_classes): """ Script to transform uncertainty into quality classes 0-4 regarding adjusted time errors :param uncertainty: symmetric picking error of picks diff --git a/pylot/core/util/utils.py b/pylot/core/util/utils.py index a973f622..38024cc0 100644 --- a/pylot/core/util/utils.py +++ b/pylot/core/util/utils.py @@ -141,7 +141,7 @@ def excludeQualityClasses(picks, qClasses, timeerrorsP, timeerrorsS): :return: dictionary containing only picks above the excluded quality class(es) :rtype: dict """ - from pylot.core.pick.utils import getQualityFromUncertainty + from pylot.core.pick.utils import get_quality_class if type(qClasses) in [int, float]: qClasses = [qClasses] @@ -156,7 +156,7 @@ def excludeQualityClasses(picks, qClasses, timeerrorsP, timeerrorsS): if not type(pick) in [AttribDict, dict]: continue pickerror = phaseError[identifyPhaseID(phase)] - quality = getQualityFromUncertainty(pick['spe'], pickerror) + quality = get_quality_class(pick['spe'], pickerror) if not quality in qClasses: if not station in picksdict_new: picksdict_new[station] = {} diff --git a/pylot/core/util/widgets.py b/pylot/core/util/widgets.py index 56dc16dd..cf03abac 100644 --- a/pylot/core/util/widgets.py +++ b/pylot/core/util/widgets.py @@ -42,7 +42,7 @@ from obspy.taup.utils import get_phase_names from pylot.core.io.data import Data from pylot.core.io.inputs import FilterOptions, PylotParameter from pylot.core.pick.utils import getSNR, earllatepicker, getnoisewin, \ - getResolutionWindow, getQualityFromUncertainty + getResolutionWindow, get_quality_class from pylot.core.pick.compare import Comparison from pylot.core.util.defaults import OUTPUTFORMATS, FILTERDEFAULTS, \ SetChannelComponents @@ -2259,10 +2259,10 @@ class PickDlg(QDialog): # get quality classes if self.getPhaseID(phase) == 'P': - quality = getQualityFromUncertainty(picks['spe'], self.parameter['timeerrorsP']) + quality = get_quality_class(picks['spe'], self.parameter['timeerrorsP']) phaseID = 'P' elif self.getPhaseID(phase) == 'S': - quality = getQualityFromUncertainty(picks['spe'], self.parameter['timeerrorsS']) + quality = get_quality_class(picks['spe'], self.parameter['timeerrorsS']) phaseID = 'S' mpp = picks['mpp'] - self.getStartTime() @@ -3180,8 +3180,8 @@ class TuneAutopicker(QWidget): ('refSpick', 0), ('el_S1pick', 0), ('el_S2pick', 0)] - qualityPpick = getQualityFromUncertainty(picks['P']['spe'], self.parameter['timeerrorsP']) - qualitySpick = getQualityFromUncertainty(picks['S']['spe'], self.parameter['timeerrorsS']) + qualityPpick = get_quality_class(picks['P']['spe'], self.parameter['timeerrorsP']) + qualitySpick = get_quality_class(picks['S']['spe'], self.parameter['timeerrorsS']) for p_ax in p_axes: axes = self.parent().fig_dict[p_ax[0]].axes if not axes: diff --git a/tests/test_get_quality_class.py b/tests/test_get_quality_class.py index 13678b58..729609ec 100644 --- a/tests/test_get_quality_class.py +++ b/tests/test_get_quality_class.py @@ -1,5 +1,5 @@ import unittest -from pylot.core.pick.utils import getQualityFromUncertainty as get_quality_class +from pylot.core.pick.utils import get_quality_class class TestQualityClassFromUncertainty(unittest.TestCase):