Merge branch 'develop' of ariadne.geophysik.ruhr-uni-bochum.de:/data/git/pylot into develop
This commit is contained in:
commit
d8a764db31
@ -43,7 +43,7 @@ from obspy import UTCDateTime
|
|||||||
from pylot.core.io.data import Data
|
from pylot.core.io.data import Data
|
||||||
from pylot.core.io.inputs import FilterOptions, AutoPickParameter
|
from pylot.core.io.inputs import FilterOptions, AutoPickParameter
|
||||||
from pylot.core.pick.autopick import autopickevent
|
from pylot.core.pick.autopick import autopickevent
|
||||||
from pylot.core.io.phases import picks_from_evt
|
from pylot.core.io.phases import picks_to_dict
|
||||||
from pylot.core.loc.nll import locate as locateNll
|
from pylot.core.loc.nll import locate as locateNll
|
||||||
from pylot.core.util.defaults import FILTERDEFAULTS, COMPNAME_MAP,\
|
from pylot.core.util.defaults import FILTERDEFAULTS, COMPNAME_MAP,\
|
||||||
AUTOMATIC_DEFAULTS
|
AUTOMATIC_DEFAULTS
|
||||||
@ -735,7 +735,7 @@ class MainWindow(QMainWindow):
|
|||||||
return rval
|
return rval
|
||||||
|
|
||||||
def updatePicks(self, type='manual'):
|
def updatePicks(self, type='manual'):
|
||||||
picks = picks_from_evt(evt=self.getData().getEvtData())
|
picks = picks_to_dict(evt=self.getData().getEvtData())
|
||||||
if type == 'manual':
|
if type == 'manual':
|
||||||
self.picks.update(picks)
|
self.picks.update(picks)
|
||||||
elif type == 'auto':
|
elif type == 'auto':
|
||||||
|
66
autoPyLoT.py
66
autoPyLoT.py
@ -55,15 +55,15 @@ def autoPyLoT(inputfile):
|
|||||||
# getting information on data structure
|
# getting information on data structure
|
||||||
|
|
||||||
if parameter.hasParam('datastructure'):
|
if parameter.hasParam('datastructure'):
|
||||||
datastructure = DATASTRUCTURE[parameter.getParam('datastructure')]()
|
datastructure = DATASTRUCTURE[parameter.get('datastructure')]()
|
||||||
dsfields = {'root': parameter.getParam('rootpath'),
|
dsfields = {'root': parameter.get('rootpath'),
|
||||||
'dpath': parameter.getParam('datapath'),
|
'dpath': parameter.get('datapath'),
|
||||||
'dbase': parameter.getParam('database')}
|
'dbase': parameter.get('database')}
|
||||||
|
|
||||||
exf = ['root', 'dpath', 'dbase']
|
exf = ['root', 'dpath', 'dbase']
|
||||||
|
|
||||||
if parameter.hasParam('eventID'):
|
if parameter.hasParam('eventID'):
|
||||||
dsfields['eventID'] = parameter.getParam('eventID')
|
dsfields['eventID'] = parameter.get('eventID')
|
||||||
exf.append('eventID')
|
exf.append('eventID')
|
||||||
|
|
||||||
datastructure.modifyFields(**dsfields)
|
datastructure.modifyFields(**dsfields)
|
||||||
@ -73,20 +73,20 @@ def autoPyLoT(inputfile):
|
|||||||
if parameter.hasParam('nllocbin'):
|
if parameter.hasParam('nllocbin'):
|
||||||
locflag = 1
|
locflag = 1
|
||||||
# get NLLoc-root path
|
# get NLLoc-root path
|
||||||
nllocroot = parameter.getParam('nllocroot')
|
nllocroot = parameter.get('nllocroot')
|
||||||
# get path to NLLoc executable
|
# get path to NLLoc executable
|
||||||
nllocbin = parameter.getParam('nllocbin')
|
nllocbin = parameter.get('nllocbin')
|
||||||
nlloccall = '%s/NLLoc' % nllocbin
|
nlloccall = '%s/NLLoc' % nllocbin
|
||||||
# get name of phase file
|
# get name of phase file
|
||||||
phasef = parameter.getParam('phasefile')
|
phasef = parameter.get('phasefile')
|
||||||
phasefile = '%s/obs/%s' % (nllocroot, phasef)
|
phasefile = '%s/obs/%s' % (nllocroot, phasef)
|
||||||
# get name of NLLoc-control file
|
# get name of NLLoc-control file
|
||||||
ctrf = parameter.getParam('ctrfile')
|
ctrf = parameter.get('ctrfile')
|
||||||
ctrfile = '%s/run/%s' % (nllocroot, ctrf)
|
ctrfile = '%s/run/%s' % (nllocroot, ctrf)
|
||||||
# pattern of NLLoc ttimes from location grid
|
# pattern of NLLoc ttimes from location grid
|
||||||
ttpat = parameter.getParam('ttpatter')
|
ttpat = parameter.get('ttpatter')
|
||||||
# pattern of NLLoc-output file
|
# pattern of NLLoc-output file
|
||||||
nllocoutpatter = parameter.getParam('outpatter')
|
nllocoutpatter = parameter.get('outpatter')
|
||||||
maxnumit = 3 # maximum number of iterations for re-picking
|
maxnumit = 3 # maximum number of iterations for re-picking
|
||||||
else:
|
else:
|
||||||
locflag = 0
|
locflag = 0
|
||||||
@ -140,10 +140,10 @@ def autoPyLoT(inputfile):
|
|||||||
# get latest NLLoc-location file if several are available
|
# get latest NLLoc-location file if several are available
|
||||||
nllocfile = max(glob.glob(locsearch), key=os.path.getctime)
|
nllocfile = max(glob.glob(locsearch), key=os.path.getctime)
|
||||||
# calculating seismic moment Mo and moment magnitude Mw
|
# calculating seismic moment Mo and moment magnitude Mw
|
||||||
finalpicks = M0Mw(wfdat, None, None, parameter.getParam('iplot'), \
|
finalpicks = M0Mw(wfdat, None, None, parameter.get('iplot'), \
|
||||||
nllocfile, picks, parameter.getParam('rho'), \
|
nllocfile, picks, parameter.get('rho'), \
|
||||||
parameter.getParam('vp'), parameter.getParam('Qp'), \
|
parameter.get('vp'), parameter.get('Qp'), \
|
||||||
parameter.getParam('invdir'))
|
parameter.get('invdir'))
|
||||||
else:
|
else:
|
||||||
print("autoPyLoT: No NLLoc-location file available!")
|
print("autoPyLoT: No NLLoc-location file available!")
|
||||||
print("No source parameter estimation possible!")
|
print("No source parameter estimation possible!")
|
||||||
@ -182,10 +182,10 @@ def autoPyLoT(inputfile):
|
|||||||
nlloccounter = maxnumit
|
nlloccounter = maxnumit
|
||||||
|
|
||||||
# calculating seismic moment Mo and moment magnitude Mw
|
# calculating seismic moment Mo and moment magnitude Mw
|
||||||
finalpicks = M0Mw(wfdat, None, None, parameter.getParam('iplot'), \
|
finalpicks = M0Mw(wfdat, None, None, parameter.get('iplot'), \
|
||||||
nllocfile, picks, parameter.getParam('rho'), \
|
nllocfile, picks, parameter.get('rho'), \
|
||||||
parameter.getParam('vp'), parameter.getParam('Qp'), \
|
parameter.get('vp'), parameter.get('Qp'), \
|
||||||
parameter.getParam('invdir'))
|
parameter.get('invdir'))
|
||||||
# get network moment magntiude
|
# get network moment magntiude
|
||||||
netMw = []
|
netMw = []
|
||||||
for key in finalpicks.getpicdic():
|
for key in finalpicks.getpicdic():
|
||||||
@ -222,8 +222,8 @@ def autoPyLoT(inputfile):
|
|||||||
|
|
||||||
# single event processing
|
# single event processing
|
||||||
else:
|
else:
|
||||||
data.setWFData(glob.glob(os.path.join(datapath, parameter.getParam('eventID'), '*')))
|
data.setWFData(glob.glob(os.path.join(datapath, parameter.get('eventID'), '*')))
|
||||||
print("Working on event {0}".format(parameter.getParam('eventID')))
|
print("Working on event {0}".format(parameter.get('eventID')))
|
||||||
print(data)
|
print(data)
|
||||||
|
|
||||||
wfdat = data.getWFData() # all available streams
|
wfdat = data.getWFData() # all available streams
|
||||||
@ -238,7 +238,7 @@ def autoPyLoT(inputfile):
|
|||||||
picksExport(picks, 'NLLoc', phasefile)
|
picksExport(picks, 'NLLoc', phasefile)
|
||||||
|
|
||||||
# For locating the event the NLLoc-control file has to be modified!
|
# For locating the event the NLLoc-control file has to be modified!
|
||||||
nllocout = '%s_%s' % (parameter.getParam('eventID'), nllocoutpatter)
|
nllocout = '%s_%s' % (parameter.get('eventID'), nllocoutpatter)
|
||||||
# create comment line for NLLoc-control file
|
# create comment line for NLLoc-control file
|
||||||
modifyInputFile(ctrf, nllocroot, nllocout, phasef, ttpat)
|
modifyInputFile(ctrf, nllocroot, nllocout, phasef, ttpat)
|
||||||
|
|
||||||
@ -261,10 +261,10 @@ def autoPyLoT(inputfile):
|
|||||||
# get latest NLLOc-location file if several are available
|
# get latest NLLOc-location file if several are available
|
||||||
nllocfile = max(glob.glob(locsearch), key=os.path.getctime)
|
nllocfile = max(glob.glob(locsearch), key=os.path.getctime)
|
||||||
# calculating seismic moment Mo and moment magnitude Mw
|
# calculating seismic moment Mo and moment magnitude Mw
|
||||||
finalpicks = M0Mw(wfdat, None, None, parameter.getParam('iplot'), \
|
finalpicks = M0Mw(wfdat, None, None, parameter.get('iplot'), \
|
||||||
nllocfile, picks, parameter.getParam('rho'), \
|
nllocfile, picks, parameter.get('rho'), \
|
||||||
parameter.getParam('vp'), parameter.getParam('Qp'), \
|
parameter.get('vp'), parameter.get('Qp'), \
|
||||||
parameter.getParam('invdir'))
|
parameter.get('invdir'))
|
||||||
else:
|
else:
|
||||||
print("autoPyLoT: No NLLoc-location file available!")
|
print("autoPyLoT: No NLLoc-location file available!")
|
||||||
print("No source parameter estimation possible!")
|
print("No source parameter estimation possible!")
|
||||||
@ -303,10 +303,10 @@ def autoPyLoT(inputfile):
|
|||||||
nlloccounter = maxnumit
|
nlloccounter = maxnumit
|
||||||
|
|
||||||
# calculating seismic moment Mo and moment magnitude Mw
|
# calculating seismic moment Mo and moment magnitude Mw
|
||||||
finalpicks = M0Mw(wfdat, None, None, parameter.getParam('iplot'), \
|
finalpicks = M0Mw(wfdat, None, None, parameter.get('iplot'), \
|
||||||
nllocfile, picks, parameter.getParam('rho'), \
|
nllocfile, picks, parameter.get('rho'), \
|
||||||
parameter.getParam('vp'), parameter.getParam('Qp'), \
|
parameter.get('vp'), parameter.get('Qp'), \
|
||||||
parameter.getParam('invdir'))
|
parameter.get('invdir'))
|
||||||
# get network moment magntiude
|
# get network moment magntiude
|
||||||
netMw = []
|
netMw = []
|
||||||
for key in finalpicks.getpicdic():
|
for key in finalpicks.getpicdic():
|
||||||
@ -319,7 +319,7 @@ def autoPyLoT(inputfile):
|
|||||||
##########################################################
|
##########################################################
|
||||||
# write phase files for various location routines
|
# write phase files for various location routines
|
||||||
# HYPO71
|
# HYPO71
|
||||||
hypo71file = '%s/%s/autoPyLoT_HYPO71.pha' % (datapath, parameter.getParam('eventID'))
|
hypo71file = '%s/%s/autoPyLoT_HYPO71.pha' % (datapath, parameter.get('eventID'))
|
||||||
if hasattr(finalpicks, 'getpicdic'):
|
if hasattr(finalpicks, 'getpicdic'):
|
||||||
if finalpicks.getpicdic() is not None:
|
if finalpicks.getpicdic() is not None:
|
||||||
writephases(finalpicks.getpicdic(), 'HYPO71', hypo71file)
|
writephases(finalpicks.getpicdic(), 'HYPO71', hypo71file)
|
||||||
@ -330,13 +330,13 @@ def autoPyLoT(inputfile):
|
|||||||
else:
|
else:
|
||||||
writephases(picks, 'HYPO71', hypo71file)
|
writephases(picks, 'HYPO71', hypo71file)
|
||||||
data.applyEVTData(picks)
|
data.applyEVTData(picks)
|
||||||
fnqml = '%s/%s/autoPyLoT' % (datapath, parameter.getParam('eventID'))
|
fnqml = '%s/%s/autoPyLoT' % (datapath, parameter.get('eventID'))
|
||||||
data.exportEvent(fnqml)
|
data.exportEvent(fnqml)
|
||||||
|
|
||||||
endsplash = '''------------------------------------------\n'
|
endsplash = '''------------------------------------------\n'
|
||||||
-----Finished event %s!-----\n'
|
-----Finished event %s!-----\n'
|
||||||
------------------------------------------'''.format \
|
------------------------------------------'''.format \
|
||||||
(version=_getVersionString()) % parameter.getParam('eventID')
|
(version=_getVersionString()) % parameter.get('eventID')
|
||||||
print(endsplash)
|
print(endsplash)
|
||||||
if locflag == 0:
|
if locflag == 0:
|
||||||
print("autoPyLoT was running in non-location mode!")
|
print("autoPyLoT was running in non-location mode!")
|
||||||
|
@ -3,13 +3,13 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import glob
|
import glob
|
||||||
import warnings
|
|
||||||
from obspy.io.xseed import Parser
|
from obspy.io.xseed import Parser
|
||||||
from obspy.core import read, Stream, UTCDateTime
|
from obspy.core import read, Stream, UTCDateTime
|
||||||
from obspy import read_events, read_inventory
|
from obspy import read_events, read_inventory
|
||||||
from obspy.core.event import Event, ResourceIdentifier, Pick, WaveformStreamID
|
from obspy.core.event import Event, ResourceIdentifier, Pick, WaveformStreamID
|
||||||
|
|
||||||
from pylot.core.io.phases import readPILOTEvent
|
from pylot.core.io.phases import readPILOTEvent, picks_from_dict
|
||||||
from pylot.core.util.utils import fnConstructor, getGlobalTimes
|
from pylot.core.util.utils import fnConstructor, getGlobalTimes
|
||||||
from pylot.core.util.errors import FormatError, OverwriteError
|
from pylot.core.util.errors import FormatError, OverwriteError
|
||||||
|
|
||||||
@ -414,35 +414,8 @@ class Data(object):
|
|||||||
firstonset = None
|
firstonset = None
|
||||||
if self.getEvtData().picks:
|
if self.getEvtData().picks:
|
||||||
raise OverwriteError('Actual picks would be overwritten!')
|
raise OverwriteError('Actual picks would be overwritten!')
|
||||||
for station, onsets in picks.items():
|
picks, firstonset = picks_from_dict(picks)
|
||||||
print('Reading picks on station %s' % station)
|
self.getEvtData().picks = picks
|
||||||
for label, phase in onsets.items():
|
|
||||||
if not isinstance(phase, dict):
|
|
||||||
continue
|
|
||||||
onset = phase['mpp']
|
|
||||||
epp = phase['epp']
|
|
||||||
lpp = phase['lpp']
|
|
||||||
error = phase['spe']
|
|
||||||
try:
|
|
||||||
picker = phase['picker']
|
|
||||||
except KeyError as e:
|
|
||||||
warnings.warn(str(e), Warning)
|
|
||||||
picker = 'Unknown'
|
|
||||||
pick = Pick()
|
|
||||||
pick.time = onset
|
|
||||||
pick.time_errors.lower_uncertainty = onset - epp
|
|
||||||
pick.time_errors.upper_uncertainty = lpp - onset
|
|
||||||
pick.time_errors.uncertainty = error
|
|
||||||
pick.phase_hint = label
|
|
||||||
pick.method_id = ResourceIdentifier(id=picker)
|
|
||||||
pick.waveform_id = WaveformStreamID(station_code=station)
|
|
||||||
self.getEvtData().picks.append(pick)
|
|
||||||
try:
|
|
||||||
polarity = phase['fm']
|
|
||||||
except KeyError as e:
|
|
||||||
print('No polarity information found for %s' % phase)
|
|
||||||
if firstonset is None or firstonset > onset:
|
|
||||||
firstonset = onset
|
|
||||||
|
|
||||||
if 'smi:local' in self.getID() and firstonset:
|
if 'smi:local' in self.getID() and firstonset:
|
||||||
fonset_str = firstonset.strftime('%Y_%m_%d_%H_%M_%S')
|
fonset_str = firstonset.strftime('%Y_%m_%d_%H_%M_%S')
|
||||||
@ -501,7 +474,7 @@ class GenericDataStructure(object):
|
|||||||
if not self.extraAllowed():
|
if not self.extraAllowed():
|
||||||
kwargs = self.updateNotAllowed(kwargs)
|
kwargs = self.updateNotAllowed(kwargs)
|
||||||
|
|
||||||
for key, value in kwargs.iteritems():
|
for key, value in kwargs.items():
|
||||||
key = str(key).lower()
|
key = str(key).lower()
|
||||||
if value is not None:
|
if value is not None:
|
||||||
if type(value) not in (str, int, float):
|
if type(value) not in (str, int, float):
|
||||||
|
@ -131,7 +131,7 @@ class AutoPickParameter(object):
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def getParam(self, *args):
|
def get(self, *args):
|
||||||
try:
|
try:
|
||||||
for param in args:
|
for param in args:
|
||||||
try:
|
try:
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import glob
|
||||||
|
import warnings
|
||||||
import scipy.io as sio
|
import scipy.io as sio
|
||||||
import obspy.core.event as ope
|
import obspy.core.event as ope
|
||||||
from obspy.core import UTCDateTime
|
from obspy.core import UTCDateTime
|
||||||
@ -173,7 +174,7 @@ def convert_pilot_times(time_array):
|
|||||||
return UTCDateTime(*times)
|
return UTCDateTime(*times)
|
||||||
|
|
||||||
|
|
||||||
def picks_from_obs(fn):
|
def picksdict_from_obs(fn):
|
||||||
picks = dict()
|
picks = dict()
|
||||||
station_name = str()
|
station_name = str()
|
||||||
for line in open(fn, 'r'):
|
for line in open(fn, 'r'):
|
||||||
@ -191,7 +192,7 @@ def picks_from_obs(fn):
|
|||||||
return picks
|
return picks
|
||||||
|
|
||||||
|
|
||||||
def picks_from_evt(evt):
|
def picks_to_dict(evt):
|
||||||
'''
|
'''
|
||||||
Takes an Event object and return the pick dictionary commonly used within
|
Takes an Event object and return the pick dictionary commonly used within
|
||||||
PyLoT
|
PyLoT
|
||||||
@ -228,6 +229,82 @@ def picks_from_evt(evt):
|
|||||||
picks[station] = onsets.copy()
|
picks[station] = onsets.copy()
|
||||||
return picks
|
return picks
|
||||||
|
|
||||||
|
def picks_from_dict(picks):
|
||||||
|
firstonset = None
|
||||||
|
for station, onsets in picks.items():
|
||||||
|
print('Reading picks on station %s' % station)
|
||||||
|
for label, phase in onsets.items():
|
||||||
|
if not isinstance(phase, dict):
|
||||||
|
continue
|
||||||
|
onset = phase['mpp']
|
||||||
|
epp = phase['epp']
|
||||||
|
lpp = phase['lpp']
|
||||||
|
error = phase['spe']
|
||||||
|
try:
|
||||||
|
picker = phase['picker']
|
||||||
|
except KeyError as e:
|
||||||
|
warnings.warn(str(e), Warning)
|
||||||
|
picker = 'Unknown'
|
||||||
|
pick = ope.Pick()
|
||||||
|
pick.time = onset
|
||||||
|
pick.time_errors.lower_uncertainty = onset - epp
|
||||||
|
pick.time_errors.upper_uncertainty = lpp - onset
|
||||||
|
pick.time_errors.uncertainty = error
|
||||||
|
pick.phase_hint = label
|
||||||
|
pick.method_id = ope.ResourceIdentifier(id=picker)
|
||||||
|
pick.waveform_id = ope.WaveformStreamID(station_code=station)
|
||||||
|
try:
|
||||||
|
polarity = phase['fm']
|
||||||
|
if polarity == 'U' or '+':
|
||||||
|
pick.polarity = 'positive'
|
||||||
|
elif polarity == 'D' or '-':
|
||||||
|
pick.polarity = 'negative'
|
||||||
|
else:
|
||||||
|
pick.polarity = 'undecidable'
|
||||||
|
except KeyError as e:
|
||||||
|
print('No polarity information found for %s' % phase)
|
||||||
|
if firstonset is None or firstonset > onset:
|
||||||
|
firstonset = onset
|
||||||
|
|
||||||
|
|
||||||
|
def reassess_pilot_event(root_dir, event_id):
|
||||||
|
from obspy import read
|
||||||
|
from pylot.core.util.defaults import AUTOMATIC_DEFAULTS
|
||||||
|
from pylot.core.io.inputs import AutoPickParameter
|
||||||
|
from pylot.core.pick.utils import earllatepicker
|
||||||
|
|
||||||
|
default = AutoPickParameter(AUTOMATIC_DEFAULTS)
|
||||||
|
|
||||||
|
search_base = os.path.join(root_dir, event_id)
|
||||||
|
phases_file = glob.glob(os.path.join(search_base, 'PHASES.mat'))
|
||||||
|
picks_dict = picks_from_pilot(phases_file)
|
||||||
|
for station in picks_dict.keys():
|
||||||
|
fn_pattern = os.path.join(search_base, '{0}*'.format(station))
|
||||||
|
try:
|
||||||
|
st = read(fn_pattern)
|
||||||
|
except TypeError as e:
|
||||||
|
print(e.message)
|
||||||
|
st = read(fn_pattern, format='GSE2')
|
||||||
|
if not st:
|
||||||
|
raise RuntimeError('no waveform data found for station {station}'.format(station=station))
|
||||||
|
for phase in picks_dict[station].keys():
|
||||||
|
try:
|
||||||
|
mpp = picks_dict[station][phase]['mpp']
|
||||||
|
except KeyError as e:
|
||||||
|
print(e.message, station)
|
||||||
|
continue
|
||||||
|
epp, lpp, spe = earllatepicker(st,
|
||||||
|
default.get('nfac{0}'.format(phase)),
|
||||||
|
default.get('tsnrz' if phase == 'P' else 'tsnrh'),
|
||||||
|
mpp
|
||||||
|
)
|
||||||
|
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)
|
||||||
|
evt.picks = picks_from_dict(picks_dict)
|
||||||
|
# write phase information to file
|
||||||
|
evt.write('{0}.xml'.format(event_id), format='QUAKEML')
|
||||||
|
|
||||||
|
|
||||||
def writephases(arrivals, fformat, filename):
|
def writephases(arrivals, fformat, filename):
|
||||||
'''
|
'''
|
||||||
|
@ -28,9 +28,9 @@ def autopickevent(data, param):
|
|||||||
|
|
||||||
# get some parameters for quality control from
|
# get some parameters for quality control from
|
||||||
# parameter input file (usually autoPyLoT.in).
|
# parameter input file (usually autoPyLoT.in).
|
||||||
wdttolerance = param.getParam('wdttolerance')
|
wdttolerance = param.get('wdttolerance')
|
||||||
mdttolerance = param.getParam('mdttolerance')
|
mdttolerance = param.get('mdttolerance')
|
||||||
iplot = param.getParam('iplot')
|
iplot = param.get('iplot')
|
||||||
for n in range(len(data)):
|
for n in range(len(data)):
|
||||||
station = data[n].stats.station
|
station = data[n].stats.station
|
||||||
if station not in stations:
|
if station not in stations:
|
||||||
@ -66,60 +66,60 @@ def autopickstation(wfstream, pickparam, verbose=False):
|
|||||||
# read your autoPyLoT.in for details!
|
# read your autoPyLoT.in for details!
|
||||||
|
|
||||||
# special parameters for P picking
|
# special parameters for P picking
|
||||||
algoP = pickparam.getParam('algoP')
|
algoP = pickparam.get('algoP')
|
||||||
iplot = pickparam.getParam('iplot')
|
iplot = pickparam.get('iplot')
|
||||||
pstart = pickparam.getParam('pstart')
|
pstart = pickparam.get('pstart')
|
||||||
pstop = pickparam.getParam('pstop')
|
pstop = pickparam.get('pstop')
|
||||||
thosmw = pickparam.getParam('tlta')
|
thosmw = pickparam.get('tlta')
|
||||||
tsnrz = pickparam.getParam('tsnrz')
|
tsnrz = pickparam.get('tsnrz')
|
||||||
hosorder = pickparam.getParam('hosorder')
|
hosorder = pickparam.get('hosorder')
|
||||||
bpz1 = pickparam.getParam('bpz1')
|
bpz1 = pickparam.get('bpz1')
|
||||||
bpz2 = pickparam.getParam('bpz2')
|
bpz2 = pickparam.get('bpz2')
|
||||||
pickwinP = pickparam.getParam('pickwinP')
|
pickwinP = pickparam.get('pickwinP')
|
||||||
tsmoothP = pickparam.getParam('tsmoothP')
|
tsmoothP = pickparam.get('tsmoothP')
|
||||||
ausP = pickparam.getParam('ausP')
|
ausP = pickparam.get('ausP')
|
||||||
nfacP = pickparam.getParam('nfacP')
|
nfacP = pickparam.get('nfacP')
|
||||||
tpred1z = pickparam.getParam('tpred1z')
|
tpred1z = pickparam.get('tpred1z')
|
||||||
tdet1z = pickparam.getParam('tdet1z')
|
tdet1z = pickparam.get('tdet1z')
|
||||||
Parorder = pickparam.getParam('Parorder')
|
Parorder = pickparam.get('Parorder')
|
||||||
addnoise = pickparam.getParam('addnoise')
|
addnoise = pickparam.get('addnoise')
|
||||||
Precalcwin = pickparam.getParam('Precalcwin')
|
Precalcwin = pickparam.get('Precalcwin')
|
||||||
minAICPslope = pickparam.getParam('minAICPslope')
|
minAICPslope = pickparam.get('minAICPslope')
|
||||||
minAICPSNR = pickparam.getParam('minAICPSNR')
|
minAICPSNR = pickparam.get('minAICPSNR')
|
||||||
timeerrorsP = pickparam.getParam('timeerrorsP')
|
timeerrorsP = pickparam.get('timeerrorsP')
|
||||||
# special parameters for S picking
|
# special parameters for S picking
|
||||||
algoS = pickparam.getParam('algoS')
|
algoS = pickparam.get('algoS')
|
||||||
sstart = pickparam.getParam('sstart')
|
sstart = pickparam.get('sstart')
|
||||||
sstop = pickparam.getParam('sstop')
|
sstop = pickparam.get('sstop')
|
||||||
bph1 = pickparam.getParam('bph1')
|
bph1 = pickparam.get('bph1')
|
||||||
bph2 = pickparam.getParam('bph2')
|
bph2 = pickparam.get('bph2')
|
||||||
tsnrh = pickparam.getParam('tsnrh')
|
tsnrh = pickparam.get('tsnrh')
|
||||||
pickwinS = pickparam.getParam('pickwinS')
|
pickwinS = pickparam.get('pickwinS')
|
||||||
tpred1h = pickparam.getParam('tpred1h')
|
tpred1h = pickparam.get('tpred1h')
|
||||||
tdet1h = pickparam.getParam('tdet1h')
|
tdet1h = pickparam.get('tdet1h')
|
||||||
tpred2h = pickparam.getParam('tpred2h')
|
tpred2h = pickparam.get('tpred2h')
|
||||||
tdet2h = pickparam.getParam('tdet2h')
|
tdet2h = pickparam.get('tdet2h')
|
||||||
Sarorder = pickparam.getParam('Sarorder')
|
Sarorder = pickparam.get('Sarorder')
|
||||||
aictsmoothS = pickparam.getParam('aictsmoothS')
|
aictsmoothS = pickparam.get('aictsmoothS')
|
||||||
tsmoothS = pickparam.getParam('tsmoothS')
|
tsmoothS = pickparam.get('tsmoothS')
|
||||||
ausS = pickparam.getParam('ausS')
|
ausS = pickparam.get('ausS')
|
||||||
minAICSslope = pickparam.getParam('minAICSslope')
|
minAICSslope = pickparam.get('minAICSslope')
|
||||||
minAICSSNR = pickparam.getParam('minAICSSNR')
|
minAICSSNR = pickparam.get('minAICSSNR')
|
||||||
Srecalcwin = pickparam.getParam('Srecalcwin')
|
Srecalcwin = pickparam.get('Srecalcwin')
|
||||||
nfacS = pickparam.getParam('nfacS')
|
nfacS = pickparam.get('nfacS')
|
||||||
timeerrorsS = pickparam.getParam('timeerrorsS')
|
timeerrorsS = pickparam.get('timeerrorsS')
|
||||||
# parameters for first-motion determination
|
# parameters for first-motion determination
|
||||||
minFMSNR = pickparam.getParam('minFMSNR')
|
minFMSNR = pickparam.get('minFMSNR')
|
||||||
fmpickwin = pickparam.getParam('fmpickwin')
|
fmpickwin = pickparam.get('fmpickwin')
|
||||||
minfmweight = pickparam.getParam('minfmweight')
|
minfmweight = pickparam.get('minfmweight')
|
||||||
# parameters for checking signal length
|
# parameters for checking signal length
|
||||||
minsiglength = pickparam.getParam('minsiglength')
|
minsiglength = pickparam.get('minsiglength')
|
||||||
minpercent = pickparam.getParam('minpercent')
|
minpercent = pickparam.get('minpercent')
|
||||||
nfacsl = pickparam.getParam('noisefactor')
|
nfacsl = pickparam.get('noisefactor')
|
||||||
# parameter to check for spuriously picked S onset
|
# parameter to check for spuriously picked S onset
|
||||||
zfac = pickparam.getParam('zfac')
|
zfac = pickparam.get('zfac')
|
||||||
# path to inventory-, dataless- or resp-files
|
# path to inventory-, dataless- or resp-files
|
||||||
invdir = pickparam.getParam('invdir')
|
invdir = pickparam.get('invdir')
|
||||||
|
|
||||||
# initialize output
|
# initialize output
|
||||||
Pweight = 4 # weight for P onset
|
Pweight = 4 # weight for P onset
|
||||||
@ -857,39 +857,39 @@ def iteratepicker(wf, NLLocfile, picks, badpicks, pickparameter):
|
|||||||
wf2pick = wf.select(station=badpicks[i][0])
|
wf2pick = wf.select(station=badpicks[i][0])
|
||||||
|
|
||||||
# modify some picking parameters
|
# modify some picking parameters
|
||||||
pstart_old = pickparameter.getParam('pstart')
|
pstart_old = pickparameter.get('pstart')
|
||||||
pstop_old = pickparameter.getParam('pstop')
|
pstop_old = pickparameter.get('pstop')
|
||||||
sstop_old = pickparameter.getParam('sstop')
|
sstop_old = pickparameter.get('sstop')
|
||||||
pickwinP_old = pickparameter.getParam('pickwinP')
|
pickwinP_old = pickparameter.get('pickwinP')
|
||||||
Precalcwin_old = pickparameter.getParam('Precalcwin')
|
Precalcwin_old = pickparameter.get('Precalcwin')
|
||||||
noisefactor_old = pickparameter.getParam('noisefactor')
|
noisefactor_old = pickparameter.get('noisefactor')
|
||||||
zfac_old = pickparameter.getParam('zfac')
|
zfac_old = pickparameter.get('zfac')
|
||||||
pickparameter.setParam(
|
pickparameter.setParam(
|
||||||
pstart=max([0, badpicks[i][1] - wf2pick[0].stats.starttime \
|
pstart=max([0, badpicks[i][1] - wf2pick[0].stats.starttime \
|
||||||
- pickparameter.getParam('tlta')]))
|
- pickparameter.get('tlta')]))
|
||||||
pickparameter.setParam(pstop=pickparameter.getParam('pstart') + \
|
pickparameter.setParam(pstop=pickparameter.get('pstart') + \
|
||||||
(3 * pickparameter.getParam('tlta')))
|
(3 * pickparameter.get('tlta')))
|
||||||
pickparameter.setParam(sstop=pickparameter.getParam('sstop') / 2)
|
pickparameter.setParam(sstop=pickparameter.get('sstop') / 2)
|
||||||
pickparameter.setParam(pickwinP=pickparameter.getParam('pickwinP') / 2)
|
pickparameter.setParam(pickwinP=pickparameter.get('pickwinP') / 2)
|
||||||
pickparameter.setParam(
|
pickparameter.setParam(
|
||||||
Precalcwin=pickparameter.getParam('Precalcwin') / 2)
|
Precalcwin=pickparameter.get('Precalcwin') / 2)
|
||||||
pickparameter.setParam(noisefactor=1.0)
|
pickparameter.setParam(noisefactor=1.0)
|
||||||
pickparameter.setParam(zfac=1.0)
|
pickparameter.setParam(zfac=1.0)
|
||||||
print(
|
print(
|
||||||
"iteratepicker: The following picking parameters have been modified for iterative picking:")
|
"iteratepicker: The following picking parameters have been modified for iterative picking:")
|
||||||
print(
|
print(
|
||||||
"pstart: %fs => %fs" % (pstart_old, pickparameter.getParam('pstart')))
|
"pstart: %fs => %fs" % (pstart_old, pickparameter.get('pstart')))
|
||||||
print(
|
print(
|
||||||
"pstop: %fs => %fs" % (pstop_old, pickparameter.getParam('pstop')))
|
"pstop: %fs => %fs" % (pstop_old, pickparameter.get('pstop')))
|
||||||
print(
|
print(
|
||||||
"sstop: %fs => %fs" % (sstop_old, pickparameter.getParam('sstop')))
|
"sstop: %fs => %fs" % (sstop_old, pickparameter.get('sstop')))
|
||||||
print("pickwinP: %fs => %fs" % (
|
print("pickwinP: %fs => %fs" % (
|
||||||
pickwinP_old, pickparameter.getParam('pickwinP')))
|
pickwinP_old, pickparameter.get('pickwinP')))
|
||||||
print("Precalcwin: %fs => %fs" % (
|
print("Precalcwin: %fs => %fs" % (
|
||||||
Precalcwin_old, pickparameter.getParam('Precalcwin')))
|
Precalcwin_old, pickparameter.get('Precalcwin')))
|
||||||
print("noisefactor: %f => %f" % (
|
print("noisefactor: %f => %f" % (
|
||||||
noisefactor_old, pickparameter.getParam('noisefactor')))
|
noisefactor_old, pickparameter.get('noisefactor')))
|
||||||
print("zfac: %f => %f" % (zfac_old, pickparameter.getParam('zfac')))
|
print("zfac: %f => %f" % (zfac_old, pickparameter.get('zfac')))
|
||||||
|
|
||||||
# repick station
|
# repick station
|
||||||
newpicks = autopickstation(wf2pick, pickparameter)
|
newpicks = autopickstation(wf2pick, pickparameter)
|
||||||
|
@ -9,7 +9,7 @@ import matplotlib.pyplot as plt
|
|||||||
|
|
||||||
from obspy import read_events
|
from obspy import read_events
|
||||||
|
|
||||||
from pylot.core.io.phases import picks_from_evt
|
from pylot.core.io.phases import picks_to_dict
|
||||||
from pylot.core.util.pdf import ProbabilityDensityFunction
|
from pylot.core.util.pdf import ProbabilityDensityFunction
|
||||||
from pylot.core.util.version import get_git_version as _getVersionString
|
from pylot.core.util.version import get_git_version as _getVersionString
|
||||||
|
|
||||||
@ -227,7 +227,7 @@ class PDFDictionary(object):
|
|||||||
if len(cat) > 1:
|
if len(cat) > 1:
|
||||||
raise NotImplementedError('reading more than one event at the same '
|
raise NotImplementedError('reading more than one event at the same '
|
||||||
'time is not implemented yet! Sorry!')
|
'time is not implemented yet! Sorry!')
|
||||||
return PDFDictionary(picks_from_evt(cat[0]))
|
return PDFDictionary(picks_to_dict(cat[0]))
|
||||||
|
|
||||||
def pdf_data(self, type='exp'):
|
def pdf_data(self, type='exp'):
|
||||||
"""
|
"""
|
||||||
|
@ -938,6 +938,10 @@ def checkZ4S(X, pick, zfac, checkwin, iplot):
|
|||||||
return returnflag
|
return returnflag
|
||||||
|
|
||||||
|
|
||||||
|
def reassess_pilot_event():
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import doctest
|
import doctest
|
||||||
|
|
||||||
|
@ -2,17 +2,24 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
|
from pylot.core.pick.utils import reassess_pilot_event
|
||||||
from pylot.core.util.version import get_git_version as _getVersionString
|
from pylot.core.util.version import get_git_version as _getVersionString
|
||||||
from pylot.core.io.phases import reasses_pilot_event
|
from pylot.core.io.phases import reassess_pilot_event
|
||||||
|
|
||||||
__version__ = _getVersionString()
|
__version__ = _getVersionString()
|
||||||
__author__ = 'sebastianw'
|
__author__ = 'sebastianw'
|
||||||
|
|
||||||
def reassess_pilot_event():
|
|
||||||
pass
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
'--directory', '-d', type=str, help='specifies the root directory (in '
|
||||||
|
'most cases PILOT database folder)'
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'--eventid', '-i', type=str, help='PILOT event identifier'
|
||||||
|
)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
reasses_pilot_event(args.id)
|
reassess_pilot_event(args.dir, args.id)
|
||||||
|
3
setup.py
3
setup.py
@ -1,3 +1,5 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
from distutils.core import setup
|
from distutils.core import setup
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
@ -6,6 +8,7 @@ setup(
|
|||||||
packages=['pylot', 'pylot.core', 'pylot.core.loc', 'pylot.core.pick',
|
packages=['pylot', 'pylot.core', 'pylot.core.loc', 'pylot.core.pick',
|
||||||
'pylot.core.io', 'pylot.core.util', 'pylot.core.active',
|
'pylot.core.io', 'pylot.core.util', 'pylot.core.active',
|
||||||
'pylot.core.analysis', 'pylot.testing'],
|
'pylot.core.analysis', 'pylot.testing'],
|
||||||
|
requires=['obspy', 'PySide'],
|
||||||
url='dummy',
|
url='dummy',
|
||||||
license='LGPLv3',
|
license='LGPLv3',
|
||||||
author='Sebastian Wehling-Benatelli',
|
author='Sebastian Wehling-Benatelli',
|
||||||
|
Loading…
Reference in New Issue
Block a user