Modified to run new function run_autopicking.

This commit is contained in:
Ludger Küperkoch 2015-05-29 16:26:31 +02:00
parent 0c76c496fb
commit 6c73e30754

View File

@ -6,15 +6,17 @@ import os
import argparse import argparse
import glob import glob
import matplotlib.pyplot as plt
from obspy.core import read
from pylot.core.util import _getVersionString from pylot.core.util import _getVersionString
from pylot.core.read import Data, AutoPickParameter from pylot.core.read import Data, AutoPickParameter
from pylot.core.pick.CharFuns import HOScf, AICcf from pylot.core.pick.run_autopicking import run_autopicking
from pylot.core.util.structure import DATASTRUCTURE from pylot.core.util.structure import DATASTRUCTURE
__version__ = _getVersionString() __version__ = _getVersionString()
METHOD = {'HOS':HOScf, 'AIC':AICcf} #METHOD = {'HOS':HOScf, 'AIC':AICcf}
def autoPyLoT(inputfile): def autoPyLoT(inputfile):
''' '''
@ -37,16 +39,6 @@ def autoPyLoT(inputfile):
data = Data() data = Data()
# declaring parameter variables (only for convenience)
meth = parameter.getParam('algoP')
tsnr1 = parameter.getParam('tsnr1')
tsnr2 = parameter.getParam('tsnr2')
tnoise = parameter.getParam('pnoiselen')
tsignal = parameter.getParam('tlim')
order = parameter.getParam('hosorder')
thosmw = parameter.getParam('tlta')
# getting information on data structure # getting information on data structure
if parameter.hasParam('datastructure'): if parameter.hasParam('datastructure'):
@ -64,26 +56,34 @@ def autoPyLoT(inputfile):
datastructure.setExpandFields(exf) datastructure.setExpandFields(exf)
# process each event in database # get streams
# process each event in database # read each event in database
datapath = datastructure.expandDataPath() datapath = datastructure.expandDataPath()
if not parameter.hasParam('eventID'): if not parameter.hasParam('eventID'):
for event in [events for events in for event in [events for events in glob.glob(os.path.join(datapath, '*')) if os.path.isdir(events)]:
glob.glob(os.path.join(datapath, '*')) print 'Reading %s' %event
if os.path.isdir(events)]:
data.setWFData(glob.glob(os.path.join(datapath, event, '*'))) data.setWFData(glob.glob(os.path.join(datapath, event, '*')))
print data #for single event processing
else: else:
data.setWFData(glob.glob(os.path.join(datapath, data.setWFData(glob.glob(os.path.join(datapath, parameter.getParam('eventID'), '*')))
parameter.getParam('eventID'),
'*')))
print data print data
wfdat = data.getWFData() # all available streams
##########################################################
# !automated picking starts here!
for i in range(len(wfdat) - 2):
stationID = wfdat[i].stats.station
#find corresponding streams
statdat = wfdat.select(station=stationID)
run_autopicking(statdat, parameter)
if __name__ == "__main__": if __name__ == "__main__":
# parse arguments # parse arguments
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description='''This program ''') description='''autoPyLoT automatically picks phase onset times using higher order statistics,
autoregressive prediction and AIC''')
parser.add_argument('-i', '-I', '--inputfile', type=str, parser.add_argument('-i', '-I', '--inputfile', type=str,
action='store', action='store',