2014-11-20 09:06:13 +01:00
|
|
|
#!/usr/bin/python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
"""
|
2015-03-30 16:20:41 +02:00
|
|
|
Script to run autoPyLoT-script "run_makeCF.py".
|
2014-11-20 09:06:13 +01:00
|
|
|
Only for test purposes!
|
|
|
|
"""
|
|
|
|
|
2015-10-19 11:25:15 +02:00
|
|
|
from obspy.core import read
|
|
|
|
import matplotlib.pyplot as plt
|
2014-11-20 09:06:13 +01:00
|
|
|
import numpy as np
|
2016-03-21 11:14:16 +01:00
|
|
|
from pylot.core.pick.charfuns import CharacteristicFunction
|
|
|
|
from pylot.core.pick.picker import AutoPicker
|
2015-03-30 16:20:41 +02:00
|
|
|
from pylot.core.pick.utils import *
|
2014-11-20 09:06:13 +01:00
|
|
|
import glob
|
|
|
|
import argparse
|
|
|
|
|
|
|
|
def run_makeCF(project, database, event, iplot, station=None):
|
|
|
|
#parameters for CF calculation
|
2015-03-04 13:49:02 +01:00
|
|
|
t2 = 7 #length of moving window for HOS calculation [sec]
|
|
|
|
p = 4 #order of HOS
|
|
|
|
cuttimes = [10, 50] #start and end time for CF calculation
|
|
|
|
bpz = [2, 30] #corner frequencies of bandpass filter, vertical component
|
|
|
|
bph = [2, 15] #corner frequencies of bandpass filter, horizontal components
|
|
|
|
tdetz= 1.2 #length of AR-determination window [sec], vertical component
|
|
|
|
tdeth= 0.8 #length of AR-determination window [sec], horizontal components
|
|
|
|
tpredz = 0.4 #length of AR-prediction window [sec], vertical component
|
|
|
|
tpredh = 0.4 #length of AR-prediction window [sec], horizontal components
|
|
|
|
addnoise = 0.001 #add noise to seismogram for stable AR prediction
|
|
|
|
arzorder = 2 #chosen order of AR process, vertical component
|
|
|
|
arhorder = 4 #chosen order of AR process, horizontal components
|
2015-03-18 14:45:08 +01:00
|
|
|
TSNRhos = [5, 0.5, 1, .6] #window lengths [s] for calculating SNR for earliest/latest pick and quality assessment
|
2015-03-04 15:53:18 +01:00
|
|
|
#from HOS-CF [noise window, safety gap, signal window, slope determination window]
|
2015-03-18 14:45:08 +01:00
|
|
|
TSNRarz = [5, 0.5, 1, 1.0] #window lengths [s] for calculating SNR for earliest/lates pick and quality assessment
|
2015-03-04 15:53:18 +01:00
|
|
|
#from ARZ-CF
|
2014-11-20 09:06:13 +01:00
|
|
|
#get waveform data
|
|
|
|
if station:
|
2015-02-25 09:56:23 +01:00
|
|
|
dpz = '/DATA/%s/EVENT_DATA/LOCAL/%s/%s/%s*HZ.msd' % (project, database, event, station)
|
|
|
|
dpe = '/DATA/%s/EVENT_DATA/LOCAL/%s/%s/%s*HE.msd' % (project, database, event, station)
|
|
|
|
dpn = '/DATA/%s/EVENT_DATA/LOCAL/%s/%s/%s*HN.msd' % (project, database, event, station)
|
2014-12-05 16:32:55 +01:00
|
|
|
#dpz = '/DATA/%s/EVENT_DATA/LOCAL/%s/%s/%s*_z.gse' % (project, database, event, station)
|
|
|
|
#dpe = '/DATA/%s/EVENT_DATA/LOCAL/%s/%s/%s*_e.gse' % (project, database, event, station)
|
|
|
|
#dpn = '/DATA/%s/EVENT_DATA/LOCAL/%s/%s/%s*_n.gse' % (project, database, event, station)
|
2014-11-20 09:06:13 +01:00
|
|
|
else:
|
2015-02-25 09:56:23 +01:00
|
|
|
dpz = '/DATA/%s/EVENT_DATA/LOCAL/%s/%s/*HZ.msd' % (project, database, event)
|
|
|
|
dpe = '/DATA/%s/EVENT_DATA/LOCAL/%s/%s/*HE.msd' % (project, database, event)
|
|
|
|
dpn = '/DATA/%s/EVENT_DATA/LOCAL/%s/%s/*HN.msd' % (project, database, event)
|
2014-11-20 09:06:13 +01:00
|
|
|
wfzfiles = glob.glob(dpz)
|
|
|
|
wfefiles = glob.glob(dpe)
|
|
|
|
wfnfiles = glob.glob(dpn)
|
|
|
|
if wfzfiles:
|
2014-12-05 16:32:55 +01:00
|
|
|
for i in range(len(wfzfiles)):
|
|
|
|
print 'Vertical component data found ...'
|
|
|
|
print wfzfiles[i]
|
|
|
|
st = read('%s' % wfzfiles[i])
|
|
|
|
st_copy = st.copy()
|
|
|
|
#filter and taper data
|
|
|
|
tr_filt = st[0].copy()
|
2015-10-19 11:25:15 +02:00
|
|
|
tr_filt.filter('bandpass', freqmin=bpz[0], freqmax=bpz[1], zerophase=False)
|
2014-12-05 16:32:55 +01:00
|
|
|
tr_filt.taper(max_percentage=0.05, type='hann')
|
|
|
|
st_copy[0].data = tr_filt.data
|
|
|
|
##############################################################
|
|
|
|
#calculate HOS-CF using subclass HOScf of class CharacteristicFunction
|
|
|
|
hoscf = HOScf(st_copy, cuttimes, t2, p) #instance of HOScf
|
|
|
|
##############################################################
|
|
|
|
#calculate AIC-HOS-CF using subclass AICcf of class CharacteristicFunction
|
|
|
|
#class needs stream object => build it
|
|
|
|
tr_aic = tr_filt.copy()
|
|
|
|
tr_aic.data = hoscf.getCF()
|
|
|
|
st_copy[0].data = tr_aic.data
|
2015-02-25 09:56:23 +01:00
|
|
|
aiccf = AICcf(st_copy, cuttimes) #instance of AICcf
|
2014-12-05 16:32:55 +01:00
|
|
|
##############################################################
|
2014-12-15 15:04:48 +01:00
|
|
|
#get prelimenary onset time from AIC-HOS-CF using subclass AICPicker of class AutoPicking
|
2015-03-18 14:45:08 +01:00
|
|
|
aicpick = AICPicker(aiccf, TSNRhos, 3, 10, None, 0.1)
|
2014-12-05 16:32:55 +01:00
|
|
|
##############################################################
|
2014-12-15 15:04:48 +01:00
|
|
|
#get refined onset time from HOS-CF using class Picker
|
2015-03-18 14:45:08 +01:00
|
|
|
hospick = PragPicker(hoscf, TSNRhos, 2, 10, 0.001, 0.2, aicpick.getpick())
|
|
|
|
#############################################################
|
2015-02-25 09:56:23 +01:00
|
|
|
#get earliest and latest possible picks
|
2015-03-19 14:36:56 +01:00
|
|
|
st_copy[0].data = tr_filt.data
|
|
|
|
[lpickhos, epickhos, pickerrhos] = earllatepicker(st_copy, 1.5, TSNRhos, hospick.getpick(), 10)
|
|
|
|
#############################################################
|
2015-03-30 16:20:41 +02:00
|
|
|
#get SNR
|
|
|
|
[SNR, SNRdB] = getSNR(st_copy, TSNRhos, hospick.getpick())
|
|
|
|
print 'SNR:', SNR, 'SNR[dB]:', SNRdB
|
|
|
|
##########################################################
|
2015-03-19 14:36:56 +01:00
|
|
|
#get first motion of onset
|
|
|
|
hosfm = fmpicker(st, st_copy, 0.2, hospick.getpick(), 11)
|
2014-12-15 15:04:48 +01:00
|
|
|
##############################################################
|
2014-12-05 16:32:55 +01:00
|
|
|
#calculate ARZ-CF using subclass ARZcf of class CharcteristicFunction
|
2015-03-18 14:45:08 +01:00
|
|
|
arzcf = ARZcf(st, cuttimes, tpredz, arzorder, tdetz, addnoise) #instance of ARZcf
|
2014-12-05 16:32:55 +01:00
|
|
|
##############################################################
|
|
|
|
#calculate AIC-ARZ-CF using subclass AICcf of class CharacteristicFunction
|
|
|
|
#class needs stream object => build it
|
|
|
|
tr_arzaic = tr_filt.copy()
|
|
|
|
tr_arzaic.data = arzcf.getCF()
|
|
|
|
st_copy[0].data = tr_arzaic.data
|
2014-12-11 15:57:25 +01:00
|
|
|
araiccf = AICcf(st_copy, cuttimes, tpredz, 0, tdetz) #instance of AICcf
|
|
|
|
##############################################################
|
|
|
|
#get onset time from AIC-ARZ-CF using subclass AICPicker of class AutoPicking
|
2015-03-18 14:45:08 +01:00
|
|
|
aicarzpick = AICPicker(araiccf, TSNRarz, 2, 10, None, 0.1)
|
2014-12-15 15:04:48 +01:00
|
|
|
##############################################################
|
|
|
|
#get refined onset time from ARZ-CF using class Picker
|
2015-03-18 14:45:08 +01:00
|
|
|
arzpick = PragPicker(arzcf, TSNRarz, 2.0, 10, 0.1, 0.05, aicarzpick.getpick())
|
2015-02-25 09:56:23 +01:00
|
|
|
#get earliest and latest possible picks
|
2015-03-19 14:36:56 +01:00
|
|
|
st_copy[0].data = tr_filt.data
|
|
|
|
[lpickarz, epickarz, pickerrarz] = earllatepicker(st_copy, 1.5, TSNRarz, arzpick.getpick(), 10)
|
2014-11-20 09:06:13 +01:00
|
|
|
elif not wfzfiles:
|
2014-12-05 16:32:55 +01:00
|
|
|
print 'No vertical component data found!'
|
2014-11-20 09:06:13 +01:00
|
|
|
|
|
|
|
if wfefiles and wfnfiles:
|
2014-12-05 16:32:55 +01:00
|
|
|
for i in range(len(wfefiles)):
|
|
|
|
print 'Horizontal component data found ...'
|
|
|
|
print wfefiles[i]
|
|
|
|
print wfnfiles[i]
|
|
|
|
#merge streams
|
|
|
|
H = read('%s' % wfefiles[i])
|
|
|
|
H += read('%s' % wfnfiles[i])
|
|
|
|
H_copy = H.copy()
|
|
|
|
#filter and taper data
|
|
|
|
trH1_filt = H[0].copy()
|
|
|
|
trH2_filt = H[1].copy()
|
2015-10-19 11:25:15 +02:00
|
|
|
trH1_filt.filter('bandpass', freqmin=bph[0], freqmax=bph[1], zerophase=False)
|
|
|
|
trH2_filt.filter('bandpass', freqmin=bph[0], freqmax=bph[1], zerophase=False)
|
2014-12-05 16:32:55 +01:00
|
|
|
trH1_filt.taper(max_percentage=0.05, type='hann')
|
|
|
|
trH2_filt.taper(max_percentage=0.05, type='hann')
|
|
|
|
H_copy[0].data = trH1_filt.data
|
|
|
|
H_copy[1].data = trH2_filt.data
|
2015-02-25 09:56:23 +01:00
|
|
|
|
2014-12-05 16:32:55 +01:00
|
|
|
##############################################################
|
|
|
|
#calculate ARH-CF using subclass ARHcf of class CharcteristicFunction
|
|
|
|
arhcf = ARHcf(H_copy, cuttimes, tpredh, arhorder, tdeth, addnoise) #instance of ARHcf
|
|
|
|
##############################################################
|
2014-12-11 15:57:25 +01:00
|
|
|
#calculate AIC-ARH-CF using subclass AICcf of class CharacteristicFunction
|
|
|
|
#class needs stream object => build it
|
|
|
|
tr_arhaic = trH1_filt.copy()
|
|
|
|
tr_arhaic.data = arhcf.getCF()
|
|
|
|
H_copy[0].data = tr_arhaic.data
|
|
|
|
#calculate ARH-AIC-CF
|
|
|
|
arhaiccf = AICcf(H_copy, cuttimes, tpredh, 0, tdeth) #instance of AICcf
|
|
|
|
##############################################################
|
|
|
|
#get onset time from AIC-ARH-CF using subclass AICPicker of class AutoPicking
|
2015-03-18 14:45:08 +01:00
|
|
|
aicarhpick = AICPicker(arhaiccf, TSNRarz, 4, 10, None, 0.1)
|
2014-12-11 15:57:25 +01:00
|
|
|
###############################################################
|
2015-02-25 09:56:23 +01:00
|
|
|
#get refined onset time from ARH-CF using class Picker
|
2015-03-18 14:45:08 +01:00
|
|
|
arhpick = PragPicker(arhcf, TSNRarz, 2.5, 10, 0.1, 0.05, aicarhpick.getpick())
|
2015-02-25 09:56:23 +01:00
|
|
|
#get earliest and latest possible picks
|
2015-03-18 14:45:08 +01:00
|
|
|
H_copy[0].data = trH1_filt.data
|
|
|
|
[lpickarh1, epickarh1, pickerrarh1] = earllatepicker(H_copy, 1.5, TSNRarz, arhpick.getpick(), 10)
|
|
|
|
H_copy[0].data = trH2_filt.data
|
|
|
|
[lpickarh2, epickarh2, pickerrarh2] = earllatepicker(H_copy, 1.5, TSNRarz, arhpick.getpick(), 10)
|
|
|
|
#get earliest pick of both earliest possible picks
|
|
|
|
epick = [epickarh1, epickarh2]
|
|
|
|
lpick = [lpickarh1, lpickarh2]
|
|
|
|
pickerr = [pickerrarh1, pickerrarh2]
|
|
|
|
ipick =np.argmin([epickarh1, epickarh2])
|
|
|
|
epickarh = epick[ipick]
|
|
|
|
lpickarh = lpick[ipick]
|
|
|
|
pickerrarh = pickerr[ipick]
|
2015-02-25 09:56:23 +01:00
|
|
|
|
2014-12-05 16:32:55 +01:00
|
|
|
#create stream with 3 traces
|
|
|
|
#merge streams
|
|
|
|
AllC = read('%s' % wfefiles[i])
|
|
|
|
AllC += read('%s' % wfnfiles[i])
|
|
|
|
AllC += read('%s' % wfzfiles[i])
|
|
|
|
#filter and taper data
|
|
|
|
All1_filt = AllC[0].copy()
|
|
|
|
All2_filt = AllC[1].copy()
|
|
|
|
All3_filt = AllC[2].copy()
|
2015-10-19 11:25:15 +02:00
|
|
|
All1_filt.filter('bandpass', freqmin=bph[0], freqmax=bph[1], zerophase=False)
|
|
|
|
All2_filt.filter('bandpass', freqmin=bph[0], freqmax=bph[1], zerophase=False)
|
|
|
|
All3_filt.filter('bandpass', freqmin=bpz[0], freqmax=bpz[1], zerophase=False)
|
2014-12-05 16:32:55 +01:00
|
|
|
All1_filt.taper(max_percentage=0.05, type='hann')
|
|
|
|
All2_filt.taper(max_percentage=0.05, type='hann')
|
|
|
|
All3_filt.taper(max_percentage=0.05, type='hann')
|
|
|
|
AllC[0].data = All1_filt.data
|
|
|
|
AllC[1].data = All2_filt.data
|
|
|
|
AllC[2].data = All3_filt.data
|
|
|
|
#calculate AR3C-CF using subclass AR3Ccf of class CharacteristicFunction
|
|
|
|
ar3ccf = AR3Ccf(AllC, cuttimes, tpredz, arhorder, tdetz, addnoise) #instance of AR3Ccf
|
|
|
|
##############################################################
|
|
|
|
if iplot:
|
|
|
|
#plot vertical trace
|
|
|
|
plt.figure()
|
|
|
|
tr = st[0]
|
|
|
|
tdata = np.arange(0, tr.stats.npts / tr.stats.sampling_rate, tr.stats.delta)
|
2015-01-26 10:54:58 +01:00
|
|
|
p1, = plt.plot(tdata, tr_filt.data/max(tr_filt.data), 'k')
|
|
|
|
p2, = plt.plot(hoscf.getTimeArray(), hoscf.getCF() / max(hoscf.getCF()), 'r')
|
|
|
|
p3, = plt.plot(aiccf.getTimeArray(), aiccf.getCF()/max(aiccf.getCF()), 'b')
|
|
|
|
p4, = plt.plot(arzcf.getTimeArray(), arzcf.getCF()/max(arzcf.getCF()), 'g')
|
|
|
|
p5, = plt.plot(araiccf.getTimeArray(), araiccf.getCF()/max(araiccf.getCF()), 'y')
|
2014-12-11 15:57:25 +01:00
|
|
|
plt.plot([aicpick.getpick(), aicpick.getpick()], [-1, 1], 'b--')
|
2014-12-05 16:32:55 +01:00
|
|
|
plt.plot([aicpick.getpick()-0.5, aicpick.getpick()+0.5], [1, 1], 'b')
|
|
|
|
plt.plot([aicpick.getpick()-0.5, aicpick.getpick()+0.5], [-1, -1], 'b')
|
2015-02-25 09:56:23 +01:00
|
|
|
plt.plot([hospick.getpick(), hospick.getpick()], [-1.3, 1.3], 'r', linewidth=2)
|
2014-12-15 15:04:48 +01:00
|
|
|
plt.plot([hospick.getpick()-0.5, hospick.getpick()+0.5], [1.3, 1.3], 'r')
|
|
|
|
plt.plot([hospick.getpick()-0.5, hospick.getpick()+0.5], [-1.3, -1.3], 'r')
|
2015-03-18 14:45:08 +01:00
|
|
|
plt.plot([lpickhos, lpickhos], [-1.1, 1.1], 'r--')
|
|
|
|
plt.plot([epickhos, epickhos], [-1.1, 1.1], 'r--')
|
2015-02-25 09:56:23 +01:00
|
|
|
plt.plot([aicarzpick.getpick(), aicarzpick.getpick()], [-1.2, 1.2], 'y', linewidth=2)
|
2014-12-11 15:57:25 +01:00
|
|
|
plt.plot([aicarzpick.getpick()-0.5, aicarzpick.getpick()+0.5], [1.2, 1.2], 'y')
|
|
|
|
plt.plot([aicarzpick.getpick()-0.5, aicarzpick.getpick()+0.5], [-1.2, -1.2], 'y')
|
2015-02-25 09:56:23 +01:00
|
|
|
plt.plot([arzpick.getpick(), arzpick.getpick()], [-1.4, 1.4], 'g', linewidth=2)
|
2014-12-15 15:04:48 +01:00
|
|
|
plt.plot([arzpick.getpick()-0.5, arzpick.getpick()+0.5], [1.4, 1.4], 'g')
|
|
|
|
plt.plot([arzpick.getpick()-0.5, arzpick.getpick()+0.5], [-1.4, -1.4], 'g')
|
2015-03-18 14:45:08 +01:00
|
|
|
plt.plot([lpickarz, lpickarz], [-1.2, 1.2], 'g--')
|
|
|
|
plt.plot([epickarz, epickarz], [-1.2, 1.2], 'g--')
|
2014-12-05 16:32:55 +01:00
|
|
|
plt.yticks([])
|
2015-02-25 09:56:23 +01:00
|
|
|
plt.ylim([-1.5, 1.5])
|
2014-12-05 16:32:55 +01:00
|
|
|
plt.xlabel('Time [s]')
|
|
|
|
plt.ylabel('Normalized Counts')
|
2015-10-19 11:25:15 +02:00
|
|
|
plt.title('%s, %s, CF-SNR=%7.2f, CF-Slope=%12.2f' % (tr.stats.station,
|
|
|
|
tr.stats.channel, aicpick.getSNR(), aicpick.getSlope()))
|
2014-12-05 16:32:55 +01:00
|
|
|
plt.suptitle(tr.stats.starttime)
|
2015-10-19 11:25:15 +02:00
|
|
|
plt.legend([p1, p2, p3, p4, p5], ['Data', 'HOS-CF', 'HOSAIC-CF', 'ARZ-CF', 'ARZAIC-CF'])
|
2014-12-05 16:32:55 +01:00
|
|
|
#plot horizontal traces
|
|
|
|
plt.figure(2)
|
2015-01-26 10:54:58 +01:00
|
|
|
plt.subplot(2,1,1)
|
2015-10-19 11:25:15 +02:00
|
|
|
tsteph = tpredh / 4
|
2014-12-05 16:32:55 +01:00
|
|
|
th1data = np.arange(0, trH1_filt.stats.npts / trH1_filt.stats.sampling_rate, trH1_filt.stats.delta)
|
|
|
|
th2data = np.arange(0, trH2_filt.stats.npts / trH2_filt.stats.sampling_rate, trH2_filt.stats.delta)
|
|
|
|
tarhcf = np.arange(0, len(arhcf.getCF()) * tsteph, tsteph) + cuttimes[0] + tdeth +tpredh
|
2015-01-26 10:54:58 +01:00
|
|
|
p21, = plt.plot(th1data, trH1_filt.data/max(trH1_filt.data), 'k')
|
2015-10-19 11:25:15 +02:00
|
|
|
p22, = plt.plot(arhcf.getTimeArray(), arhcf.getCF()/max(arhcf.getCF()), 'r')
|
2015-01-26 10:54:58 +01:00
|
|
|
p23, = plt.plot(arhaiccf.getTimeArray(), arhaiccf.getCF()/max(arhaiccf.getCF()))
|
2015-02-25 09:56:23 +01:00
|
|
|
plt.plot([aicarhpick.getpick(), aicarhpick.getpick()], [-1, 1], 'b')
|
2014-12-11 15:57:25 +01:00
|
|
|
plt.plot([aicarhpick.getpick()-0.5, aicarhpick.getpick()+0.5], [1, 1], 'b')
|
|
|
|
plt.plot([aicarhpick.getpick()-0.5, aicarhpick.getpick()+0.5], [-1, -1], 'b')
|
2015-02-25 09:56:23 +01:00
|
|
|
plt.plot([arhpick.getpick(), arhpick.getpick()], [-1, 1], 'r')
|
|
|
|
plt.plot([arhpick.getpick()-0.5, arhpick.getpick()+0.5], [1, 1], 'r')
|
|
|
|
plt.plot([arhpick.getpick()-0.5, arhpick.getpick()+0.5], [-1, -1], 'r')
|
2015-03-18 14:45:08 +01:00
|
|
|
plt.plot([lpickarh, lpickarh], [-0.8, 0.8], 'r--')
|
|
|
|
plt.plot([epickarh, epickarh], [-0.8, 0.8], 'r--')
|
|
|
|
plt.plot([arhpick.getpick() + pickerrarh, arhpick.getpick() + pickerrarh], [-0.2, 0.2], 'r--')
|
|
|
|
plt.plot([arhpick.getpick() - pickerrarh, arhpick.getpick() - pickerrarh], [-0.2, 0.2], 'r--')
|
2014-12-05 16:32:55 +01:00
|
|
|
plt.yticks([])
|
2015-02-25 09:56:23 +01:00
|
|
|
plt.ylim([-1.5, 1.5])
|
2014-12-05 16:32:55 +01:00
|
|
|
plt.ylabel('Normalized Counts')
|
|
|
|
plt.title([trH1_filt.stats.station, trH1_filt.stats.channel])
|
|
|
|
plt.suptitle(trH1_filt.stats.starttime)
|
2015-10-19 11:25:15 +02:00
|
|
|
plt.legend([p21, p22, p23], ['Data', 'ARH-CF', 'ARHAIC-CF'])
|
2015-01-26 10:54:58 +01:00
|
|
|
plt.subplot(2,1,2)
|
2014-12-11 15:57:25 +01:00
|
|
|
plt.plot(th2data, trH2_filt.data/max(trH2_filt.data), 'k')
|
2015-10-19 11:25:15 +02:00
|
|
|
plt.plot(arhcf.getTimeArray(), arhcf.getCF()/max(arhcf.getCF()), 'r')
|
2014-12-11 15:57:25 +01:00
|
|
|
plt.plot(arhaiccf.getTimeArray(), arhaiccf.getCF()/max(arhaiccf.getCF()))
|
2015-02-25 09:56:23 +01:00
|
|
|
plt.plot([aicarhpick.getpick(), aicarhpick.getpick()], [-1, 1], 'b')
|
2014-12-11 15:57:25 +01:00
|
|
|
plt.plot([aicarhpick.getpick()-0.5, aicarhpick.getpick()+0.5], [1, 1], 'b')
|
|
|
|
plt.plot([aicarhpick.getpick()-0.5, aicarhpick.getpick()+0.5], [-1, -1], 'b')
|
2015-02-25 09:56:23 +01:00
|
|
|
plt.plot([arhpick.getpick(), arhpick.getpick()], [-1, 1], 'r')
|
|
|
|
plt.plot([arhpick.getpick()-0.5, arhpick.getpick()+0.5], [1, 1], 'r')
|
|
|
|
plt.plot([arhpick.getpick()-0.5, arhpick.getpick()+0.5], [-1, -1], 'r')
|
2015-03-18 14:45:08 +01:00
|
|
|
plt.plot([lpickarh, lpickarh], [-0.8, 0.8], 'r--')
|
|
|
|
plt.plot([epickarh, epickarh], [-0.8, 0.8], 'r--')
|
|
|
|
plt.plot([arhpick.getpick() + pickerrarh, arhpick.getpick() + pickerrarh], [-0.2, 0.2], 'r--')
|
|
|
|
plt.plot([arhpick.getpick() - pickerrarh, arhpick.getpick() - pickerrarh], [-0.2, 0.2], 'r--')
|
2014-12-05 16:32:55 +01:00
|
|
|
plt.title([trH2_filt.stats.station, trH2_filt.stats.channel])
|
|
|
|
plt.yticks([])
|
2015-02-25 09:56:23 +01:00
|
|
|
plt.ylim([-1.5, 1.5])
|
2014-12-05 16:32:55 +01:00
|
|
|
plt.xlabel('Time [s]')
|
|
|
|
plt.ylabel('Normalized Counts')
|
|
|
|
#plot 3-component window
|
|
|
|
plt.figure(3)
|
2015-01-26 10:54:58 +01:00
|
|
|
plt.subplot(3,1,1)
|
|
|
|
p31, = plt.plot(tdata, tr_filt.data/max(tr_filt.data), 'k')
|
2015-02-25 09:56:23 +01:00
|
|
|
p32, = plt.plot(ar3ccf.getTimeArray(), ar3ccf.getCF()/max(ar3ccf.getCF()), 'r')
|
|
|
|
plt.plot([arhpick.getpick(), arhpick.getpick()], [-1, 1], 'b')
|
|
|
|
plt.plot([arhpick.getpick()-0.5, arhpick.getpick()+0.5], [-1, -1], 'b')
|
|
|
|
plt.plot([arhpick.getpick()-0.5, arhpick.getpick()+0.5], [1, 1], 'b')
|
2014-12-05 16:32:55 +01:00
|
|
|
plt.yticks([])
|
|
|
|
plt.xticks([])
|
|
|
|
plt.ylabel('Normalized Counts')
|
|
|
|
plt.title([tr.stats.station, tr.stats.channel])
|
2015-02-25 09:56:23 +01:00
|
|
|
plt.suptitle(trH1_filt.stats.starttime)
|
2015-10-19 11:25:15 +02:00
|
|
|
plt.legend([p31, p32], ['Data', 'AR3C-CF'])
|
2015-01-26 10:54:58 +01:00
|
|
|
plt.subplot(3,1,2)
|
2014-12-05 16:32:55 +01:00
|
|
|
plt.plot(th1data, trH1_filt.data/max(trH1_filt.data), 'k')
|
2015-02-25 09:56:23 +01:00
|
|
|
plt.plot(ar3ccf.getTimeArray(), ar3ccf.getCF()/max(ar3ccf.getCF()), 'r')
|
|
|
|
plt.plot([arhpick.getpick(), arhpick.getpick()], [-1, 1], 'b')
|
|
|
|
plt.plot([arhpick.getpick()-0.5, arhpick.getpick()+0.5], [-1, -1], 'b')
|
|
|
|
plt.plot([arhpick.getpick()-0.5, arhpick.getpick()+0.5], [1, 1], 'b')
|
2014-12-05 16:32:55 +01:00
|
|
|
plt.yticks([])
|
|
|
|
plt.xticks([])
|
|
|
|
plt.ylabel('Normalized Counts')
|
|
|
|
plt.title([trH1_filt.stats.station, trH1_filt.stats.channel])
|
2015-01-26 10:54:58 +01:00
|
|
|
plt.subplot(3,1,3)
|
2014-12-05 16:32:55 +01:00
|
|
|
plt.plot(th2data, trH2_filt.data/max(trH2_filt.data), 'k')
|
2015-02-25 09:56:23 +01:00
|
|
|
plt.plot(ar3ccf.getTimeArray(), ar3ccf.getCF()/max(ar3ccf.getCF()), 'r')
|
|
|
|
plt.plot([arhpick.getpick(), arhpick.getpick()], [-1, 1], 'b')
|
|
|
|
plt.plot([arhpick.getpick()-0.5, arhpick.getpick()+0.5], [-1, -1], 'b')
|
|
|
|
plt.plot([arhpick.getpick()-0.5, arhpick.getpick()+0.5], [1, 1], 'b')
|
2014-12-05 16:32:55 +01:00
|
|
|
plt.yticks([])
|
|
|
|
plt.ylabel('Normalized Counts')
|
|
|
|
plt.title([trH2_filt.stats.station, trH2_filt.stats.channel])
|
|
|
|
plt.xlabel('Time [s]')
|
|
|
|
plt.show()
|
|
|
|
raw_input()
|
|
|
|
plt.close()
|
|
|
|
|
2014-11-20 09:06:13 +01:00
|
|
|
parser = argparse.ArgumentParser()
|
|
|
|
parser.add_argument('--project', type=str, help='project name (e.g. Insheim)')
|
|
|
|
parser.add_argument('--database', type=str, help='event data base (e.g. 2014.09_Insheim)')
|
|
|
|
parser.add_argument('--event', type=str, help='event ID (e.g. e0010.015.14)')
|
|
|
|
parser.add_argument('--iplot', help='anything, if set, figure occurs')
|
|
|
|
parser.add_argument('--station', type=str, help='Station ID (e.g. INS3) (optional)')
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
run_makeCF(args.project, args.database, args.event, args.iplot, args.station)
|