From fd27a43110be683e5a14b8cf6f91668b4f886099 Mon Sep 17 00:00:00 2001 From: Sebastianw Wehling-Benatelli Date: Tue, 3 May 2016 15:09:51 +0200 Subject: [PATCH] fixing import problems --- pylot/core/io/phases.py | 16 ++++++++++++---- pylot/core/pick/utils.py | 4 ++-- 2 files changed, 14 insertions(+), 6 deletions(-) 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]