diff --git a/pylot/core/io/phases.py b/pylot/core/io/phases.py index 707b57ed..4604576a 100644 --- a/pylot/core/io/phases.py +++ b/pylot/core/io/phases.py @@ -10,8 +10,7 @@ from obspy.core import UTCDateTime from pylot.core.pick.utils import select_for_phase from pylot.core.util.utils import getOwner, createPick, createArrival, \ - createEvent, createOrigin, createMagnitude -from pylot.core.util.defaults import AUTOMATIC_DEFAULTS + createEvent, createOrigin, createMagnitude, getGlobalTimes def readPILOTEvent(phasfn=None, locfn=None, authority_id=None, **kwargs): """ @@ -268,12 +267,16 @@ def picks_from_picksdict(picks): return picks_list -def reassess_pilot_event(root_dir, event_id, fn_param=AUTOMATIC_DEFAULTS): +def reassess_pilot_event(root_dir, event_id, fn_param=None): from obspy import read from pylot.core.io.inputs import AutoPickParameter from pylot.core.pick.utils import earllatepicker + if fn_param is None: + import pylot.core.util.defaults as defaults + fn_param = defaults.AUTOMATIC_DEFAULTS + default = AutoPickParameter(fn_param) search_base = os.path.join(root_dir, event_id) @@ -297,11 +300,16 @@ def reassess_pilot_event(root_dir, event_id, fn_param=AUTOMATIC_DEFAULTS): print(e.message, station) continue sel_st = select_for_phase(st, phase) + stime, etime = getGlobalTimes(sel_st) + rel_pick = mpp - stime epp, lpp, spe = earllatepicker(sel_st, default.get('nfac{0}'.format(phase)), default.get('tsnrz' if phase == 'P' else 'tsnrh'), - mpp, None, True + Pick1=rel_pick, + iplot=None, ) + epp = stime + epp + lpp = stime + lpp picks_dict[station][phase] = dict(epp=epp, mpp=mpp, lpp=lpp, spe=spe) # create Event object for export evt = ope.Event(resource_id=event_id) diff --git a/pylot/core/pick/utils.py b/pylot/core/pick/utils.py index 1577abb3..e603cfa4 100644 --- a/pylot/core/pick/utils.py +++ b/pylot/core/pick/utils.py @@ -479,12 +479,12 @@ def select_for_phase(st, phase): from pylot.core.util.defaults import COMPNAME_MAP sel_st = Stream() - if phase.upper() is 'P': + if phase.upper() == 'P': comp = 'Z' alter_comp = COMPNAME_MAP[comp] sel_st += st.select(component=comp) sel_st += st.select(component=alter_comp) - elif phase.upper() is 'S': + elif phase.upper() == 'S': comps = 'NE' for comp in comps: alter_comp = COMPNAME_MAP[comp]