[change] restructure identifyPhase functions

This commit is contained in:
Marcel Paffrath 2017-08-21 14:59:28 +02:00
parent 55a54ae154
commit 2b0aa38b37
4 changed files with 11 additions and 7 deletions

View File

@ -74,7 +74,7 @@ from pylot.core.util.connection import checkurl
from pylot.core.util.dataprocessing import read_metadata, restitute_data from pylot.core.util.dataprocessing import read_metadata, restitute_data
from pylot.core.util.utils import fnConstructor, getLogin, \ from pylot.core.util.utils import fnConstructor, getLogin, \
full_range, readFilterInformation, trim_station_components, check4gaps, make_pen, pick_color_plt, \ full_range, readFilterInformation, trim_station_components, check4gaps, make_pen, pick_color_plt, \
pick_linestyle_plt, identifyPhase, loopIdentifyPhase, remove_underscores, check4doubled pick_linestyle_plt, remove_underscores, check4doubled, identifyPhaseID
from pylot.core.util.event import Event from pylot.core.util.event import Event
from pylot.core.io.location import create_creation_info, create_event from pylot.core.io.location import create_creation_info, create_event
from pylot.core.util.widgets import FilterOptionsDialog, NewEventDlg, \ from pylot.core.util.widgets import FilterOptionsDialog, NewEventDlg, \
@ -865,7 +865,7 @@ class MainWindow(QMainWindow):
return fnames return fnames
def getPhaseID(self, phase): def getPhaseID(self, phase):
return identifyPhase(loopIdentifyPhase(phase)) return identifyPhaseID(phase)
def get_current_event(self, eventbox=None): def get_current_event(self, eventbox=None):
''' '''

View File

@ -18,8 +18,8 @@ from pylot.core.pick.charfuns import HOScf, AICcf, ARZcf, ARHcf, AR3Ccf
from pylot.core.pick.picker import AICPicker, PragPicker from pylot.core.pick.picker import AICPicker, PragPicker
from pylot.core.pick.utils import checksignallength, checkZ4S, earllatepicker, \ from pylot.core.pick.utils import checksignallength, checkZ4S, earllatepicker, \
getSNR, fmpicker, checkPonsets, wadaticheck getSNR, fmpicker, checkPonsets, wadaticheck
from pylot.core.util.utils import getPatternLine, gen_Pool, identifyPhase, loopIdentifyPhase, \ from pylot.core.util.utils import getPatternLine, gen_Pool,\
real_Bool real_Bool, identifyPhaseID
from obspy.taup import TauPyModel from obspy.taup import TauPyModel
@ -254,7 +254,7 @@ def autopickstation(wfstream, pickparam, verbose=False,
phases = {'P': [], phases = {'P': [],
'S': []} 'S': []}
for arr in arrivals: for arr in arrivals:
phases[identifyPhase(loopIdentifyPhase(arr.phase.name))].append(arr) phases[identifyPhaseID(arr.phase.name)].append(arr)
# get first P and S onsets from arrivals list # get first P and S onsets from arrivals list
arrP, estFirstP = min([(arr, arr.time) for arr in phases['P']], key = lambda t: t[1]) arrP, estFirstP = min([(arr, arr.time) for arr in phases['P']], key = lambda t: t[1])

View File

@ -806,6 +806,9 @@ def identifyPhase(phase):
return False return False
def identifyPhaseID(phase):
return identifyPhase(loopIdentifyPhase(phase))
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -21,7 +21,8 @@ except:
pg = None pg = None
from matplotlib.figure import Figure from matplotlib.figure import Figure
from pylot.core.util.utils import find_horizontals, identifyPhase, loopIdentifyPhase, trim_station_components from pylot.core.util.utils import find_horizontals, identifyPhase, loopIdentifyPhase, trim_station_components, \
identifyPhaseID
try: try:
from matplotlib.backends.backend_qt4agg import FigureCanvas from matplotlib.backends.backend_qt4agg import FigureCanvas
@ -1285,7 +1286,7 @@ class PickDlg(QDialog):
self.currentPhase = str(self.s_button.text()) self.currentPhase = str(self.s_button.text())
def getPhaseID(self, phase): def getPhaseID(self, phase):
return identifyPhase(loopIdentifyPhase(phase)) return identifyPhaseID(phase)
def set_button_color(self, button, color=None): def set_button_color(self, button, color=None):
if type(color) == QtGui.QColor: if type(color) == QtGui.QColor: