Commit a44742d0 authored by Semih Demir's avatar Semih Demir
Browse files

AICD and Pphase picker working as well as set time after which processing starts

parent 3e793bea
......@@ -10,15 +10,11 @@ from obspy import read, Trace
from dug_seis.processing.Pickers.P_Phase_Picker_USGS.Statelevels import statelevel
# from matplotlib import pyplot as plt
def pphasepicker(test):
dt = 1/test.stats.sampling_rate
def pphasepicker(input,Tn,xi):
dt = 1/input.stats.sampling_rate
# x_d = test.detrend(type='simple')
x_d=test
# xnew=xd
Tn = 0.01
xi = 0.6
# x_d = input.detrend(type='simple')
x_d=input
# # Construct a fixed-base viscously damped SDF oscillator
omegan = 2 * np.pi / Tn; # natural frequency in radian/second
......
......@@ -27,7 +27,7 @@ from dug_seis.processing.Pickers.PhasePApy_Austin_Holland import fbpicker
from obspy.core import *
from dug_seis.processing.Pickers.PhasePApy_Austin_Holland import aicdpicker
from dug_seis.processing.Pickers.PhasePApy_Austin_Holland import ktpicker
from dug_seis.processing.Pickers.P_Phase_Picker_USGS import pphasepicker
from dug_seis.processing.Pickers.P_Phase_Picker_USGS.pphasepicker import pphasepicker
#
class Event(ObsPyEvent):
......@@ -170,7 +170,6 @@ class Event(ObsPyEvent):
channel_code='001', location_code='00'),
method_id='AICD'))
pickaverage=np.mean(picksav)*1000
print(pickaverage)
logging.info('Event ' + str(self.event_id) + ': ' + str(len(self.picks)) + ' picks.')
if piparam['algorithm'] == 'sta_lta':
......@@ -195,9 +194,12 @@ class Event(ObsPyEvent):
logging.info('Event ' + str(self.event_id) + ': ' + str(len(self.picks)) + ' picks.')
if piparam['algorithm'] == 'Pphase':
Tn = 0.01
xi = 0.6
for j in range(len(self.wf_stream)): # do picking for each trace in 20ms snippet
loc = pphasepicker(self.wf_stream[j])
loc = pphasepicker(self.wf_stream[j],Tn,xi)
if loc != 'nopick':
t_picks = loc
t_pick_UTC = self.wf_stream[0].stats[
......
......@@ -54,8 +54,15 @@ def processing(param):
# print(koek)
# if tparam['processing time'] == True:
new_files = sorted([f for f in os.listdir(asdf_folder) if f.endswith('.h5') and int(re.findall('\d+', f)[3])>= tparam['Hr'] and int(re.findall('\d+', f)[4])>=tparam['Min']]) # generates a list of the .asdf files in asdf_folder
# int(f[11:13]) >= tparam['Hr']
new_files = sorted([f for f in os.listdir(asdf_folder) if f.endswith('.h5') and int(re.findall('\d+', f)[3])>= tparam['Hr']]) # generates a list of the .asdf files in asdf_folder
if len(new_files):
if int(re.findall('\d+', new_files[0])[3]) > tparam['Hr']:
new_files = new_files
else:
new_files = sorted([f for f in new_files if int(re.findall('\d+', f)[4]) >= tparam['Min']])
processed_files = []
while 1:
......@@ -117,6 +124,11 @@ def processing(param):
else:
flist = sorted([f for f in os.listdir(asdf_folder) if f.endswith('.h5') and int(re.findall('\d+', f)[3])>= tparam['Hr'] and int(re.findall('\d+', f)[4])>=tparam['Min']])
if len(flist):
if int(re.findall('\d+', flist[0])[3]) > tparam['Hr']:
flist = flist
else:
flist = sorted([f for f in flist if int(re.findall('\d+', f)[4]) >= tparam['Min']])
new_files = [f for f in flist if f not in processed_files]
if not len(new_files):
logging.info('Waiting for new files.')
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment