debugged some code fragments while trying to solve the load event data problem
This commit is contained in:
commit
2b42583999
37
QtPyLoT.py
37
QtPyLoT.py
@ -36,7 +36,7 @@ from PySide.QtGui import QMainWindow, QInputDialog, QIcon, QFileDialog, \
|
|||||||
QDialog, QErrorMessage, QApplication, QPixmap, QMessageBox, QSplashScreen, \
|
QDialog, QErrorMessage, QApplication, QPixmap, QMessageBox, QSplashScreen, \
|
||||||
QActionGroup, QListWidget, QDockWidget
|
QActionGroup, QListWidget, QDockWidget
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from obspy.core import UTCDateTime
|
from obspy import UTCDateTime, readEvents
|
||||||
|
|
||||||
from pylot.core.read.data import Data
|
from pylot.core.read.data import Data
|
||||||
from pylot.core.read.inputs import FilterOptions, AutoPickParameter
|
from pylot.core.read.inputs import FilterOptions, AutoPickParameter
|
||||||
@ -339,6 +339,8 @@ class MainWindow(QMainWindow):
|
|||||||
return settings.value("data/dataRoot")
|
return settings.value("data/dataRoot")
|
||||||
|
|
||||||
def loadData(self, fname=None):
|
def loadData(self, fname=None):
|
||||||
|
if not self.okToContinue():
|
||||||
|
return
|
||||||
if fname is None:
|
if fname is None:
|
||||||
action = self.sender()
|
action = self.sender()
|
||||||
if isinstance(action, QAction):
|
if isinstance(action, QAction):
|
||||||
@ -348,16 +350,13 @@ class MainWindow(QMainWindow):
|
|||||||
fname = QFileDialog().getOpenFileName(self,
|
fname = QFileDialog().getOpenFileName(self,
|
||||||
caption=caption,
|
caption=caption,
|
||||||
filter=filt)
|
filter=filt)
|
||||||
self.setFileName(fname[0])
|
fname = fname[0]
|
||||||
else:
|
|
||||||
self.setFileName(unicode(action.data().toString()))
|
|
||||||
if not self.okToContinue():
|
|
||||||
return
|
|
||||||
else:
|
else:
|
||||||
|
fname = unicode(action.data().toString())
|
||||||
self.setFileName(fname)
|
self.setFileName(fname)
|
||||||
self.data += Data(self, evtdata=self.getFileName())
|
self.data += Data(self, evtdata=self.getFileName())
|
||||||
self.updatePicks()
|
self.convertPicks4PyLoT()
|
||||||
self.updateStatus('Event data loaded ...')
|
self.drawPicks()
|
||||||
|
|
||||||
def getLastEvent(self):
|
def getLastEvent(self):
|
||||||
return self.recentEvents[0]
|
return self.recentEvents[0]
|
||||||
@ -468,9 +467,6 @@ class MainWindow(QMainWindow):
|
|||||||
def getPicks(self):
|
def getPicks(self):
|
||||||
return self.picks
|
return self.picks
|
||||||
|
|
||||||
def updatePicks(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def getPicksOnStation(self, station):
|
def getPicksOnStation(self, station):
|
||||||
try:
|
try:
|
||||||
return self.getPicks()[station]
|
return self.getPicks()[station]
|
||||||
@ -696,6 +692,25 @@ class MainWindow(QMainWindow):
|
|||||||
raise Exception('FATAL: Should never occur!')
|
raise Exception('FATAL: Should never occur!')
|
||||||
self.getPicks()[station] = stat_picks
|
self.getPicks()[station] = stat_picks
|
||||||
|
|
||||||
|
def convertPicks4PyLoT(self):
|
||||||
|
evt = self.getData().getEvtData()
|
||||||
|
picks = {}
|
||||||
|
onsets = {}
|
||||||
|
for pick in evt.picks:
|
||||||
|
phase = {}
|
||||||
|
station = pick.waveform_id.station_code
|
||||||
|
mpp = pick.time
|
||||||
|
lpp = mpp + pick.time.upper_uncertainty
|
||||||
|
epp = mpp - pick.time.lower_uncertainty
|
||||||
|
spe = pick.time.uncertainty
|
||||||
|
phase['mpp'] = mpp
|
||||||
|
phase['epp'] = epp
|
||||||
|
phase['lpp'] = lpp
|
||||||
|
phase['spe'] = spe
|
||||||
|
|
||||||
|
onsets[pick.phase_hint] = phase
|
||||||
|
picks[station] = onsets
|
||||||
|
|
||||||
def drawPicks(self, station=None):
|
def drawPicks(self, station=None):
|
||||||
# if picks to draw not specified, draw all picks available
|
# if picks to draw not specified, draw all picks available
|
||||||
if not station:
|
if not station:
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
#main settings#
|
#main settings#
|
||||||
/DATA/Insheim #rootpath# %project path
|
/DATA/Insheim #rootpath# %project path
|
||||||
EVENT_DATA/LOCAL #datapath# %data path
|
EVENT_DATA/LOCAL #datapath# %data path
|
||||||
2015.08_Insheim #database# %name of data base
|
2013.02_Insheim #database# %name of data base
|
||||||
e0013.241.15 #eventID# %event ID for single event processing
|
e0019.048.13 #eventID# %event ID for single event processing
|
||||||
/DATA/Insheim/STAT_INFO #invdir# %full path to inventory or dataless-seed file
|
/DATA/Insheim/STAT_INFO #invdir# %full path to inventory or dataless-seed file
|
||||||
PILOT #datastructure# %choose data structure
|
PILOT #datastructure# %choose data structure
|
||||||
0 #iplot# %flag for plotting: 0 none, 1, partly, >1 everything
|
0 #iplot# %flag for plotting: 0 none, 1, partly, >1 everything
|
||||||
|
@ -32,7 +32,7 @@ HYPOSAT #locrt# %location routine used ("HYPO
|
|||||||
#common settings picker#
|
#common settings picker#
|
||||||
20 #pstart# %start time [s] for calculating CF for P-picking
|
20 #pstart# %start time [s] for calculating CF for P-picking
|
||||||
100 #pstop# %end time [s] for calculating CF for P-picking
|
100 #pstop# %end time [s] for calculating CF for P-picking
|
||||||
3.0 #sstart# %start time [s] after or before(-) P-onset for calculating CF for S-picking
|
1.0 #sstart# %start time [s] after or before(-) P-onset for calculating CF for S-picking
|
||||||
100 #sstop# %end time [s] after P-onset for calculating CF for S-picking
|
100 #sstop# %end time [s] after P-onset for calculating CF for S-picking
|
||||||
3 10 #bpz1# %lower/upper corner freq. of first band pass filter Z-comp. [Hz]
|
3 10 #bpz1# %lower/upper corner freq. of first band pass filter Z-comp. [Hz]
|
||||||
3 12 #bpz2# %lower/upper corner freq. of second band pass filter Z-comp. [Hz]
|
3 12 #bpz2# %lower/upper corner freq. of second band pass filter Z-comp. [Hz]
|
||||||
@ -65,11 +65,11 @@ ARH #algoS# %choose algorithm for S-onset
|
|||||||
0.3 #tpred2h# %for HOS/AR, length of AR-prediction window [s], H-components, 2nd pick
|
0.3 #tpred2h# %for HOS/AR, length of AR-prediction window [s], H-components, 2nd pick
|
||||||
4 #Sarorder# %for AR-picker, order of AR process of H-components
|
4 #Sarorder# %for AR-picker, order of AR process of H-components
|
||||||
10 #Srecalcwin# %for AR-picker, window length [s] for recalculation of CF (2nd pick) (H)
|
10 #Srecalcwin# %for AR-picker, window length [s] for recalculation of CF (2nd pick) (H)
|
||||||
6 #pickwinS# %for initial AIC and refined pick, length of S-pick window [s]
|
25 #pickwinS# %for initial AIC and refined pick, length of S-pick window [s]
|
||||||
5 0.2 3.0 3.0 #tsnrh# %for ARH/AR3, window lengths for SNR-and slope estimation [tnoise,tsafetey,tsignal,tslope] [s]
|
5 0.2 3.0 3.0 #tsnrh# %for ARH/AR3, window lengths for SNR-and slope estimation [tnoise,tsafetey,tsignal,tslope] [s]
|
||||||
3.0 #aictsmoothS# %for AIC-picker, take average of samples for smoothing of AIC-function [s]
|
3.5 #aictsmoothS# %for AIC-picker, take average of samples for smoothing of AIC-function [s]
|
||||||
1.0 #tsmoothS# %for AR-picker, take average of samples for smoothing CF [s] (S)
|
1.0 #tsmoothS# %for AR-picker, take average of samples for smoothing CF [s] (S)
|
||||||
0.4 #ausS# %for HOS/AR, artificial uplift of samples (aus) of CF (S)
|
0.2 #ausS# %for HOS/AR, artificial uplift of samples (aus) of CF (S)
|
||||||
1.5 #nfacS# %for AR-picker, noise factor for noise level determination (S)
|
1.5 #nfacS# %for AR-picker, noise factor for noise level determination (S)
|
||||||
%first-motion picker%
|
%first-motion picker%
|
||||||
1 #minfmweight# %minimum required p weight for first-motion determination
|
1 #minfmweight# %minimum required p weight for first-motion determination
|
||||||
@ -81,16 +81,16 @@ ARH #algoS# %choose algorithm for S-onset
|
|||||||
0.04 0.08 0.16 0.32 #timeerrorsS# %discrete time errors [s] corresponding to picking weights [0 1 2 3] for S
|
0.04 0.08 0.16 0.32 #timeerrorsS# %discrete time errors [s] corresponding to picking weights [0 1 2 3] for S
|
||||||
3 #minAICPslope# %below this slope [counts/s] the initial P pick is rejected
|
3 #minAICPslope# %below this slope [counts/s] the initial P pick is rejected
|
||||||
1.2 #minAICPSNR# %below this SNR the initial P pick is rejected
|
1.2 #minAICPSNR# %below this SNR the initial P pick is rejected
|
||||||
3 #minAICSslope# %below this slope [counts/s] the initial S pick is rejected
|
5 #minAICSslope# %below this slope [counts/s] the initial S pick is rejected
|
||||||
1.5 #minAICSSNR# %below this SNR the initial S pick is rejected
|
2.5 #minAICSSNR# %below this SNR the initial S pick is rejected
|
||||||
#check duration of signal using envelope function#
|
#check duration of signal using envelope function#
|
||||||
30 #minsiglength# %minimum required length of signal [s]
|
30 #minsiglength# %minimum required length of signal [s]
|
||||||
2.5 #noisefactor# %noiselevel*noisefactor=threshold
|
2.5 #noisefactor# %noiselevel*noisefactor=threshold
|
||||||
60 #minpercent# %required percentage of samples higher than threshold
|
60 #minpercent# %required percentage of samples higher than threshold
|
||||||
#check for spuriously picked S-onsets#
|
#check for spuriously picked S-onsets#
|
||||||
1.5 #zfac# %P-amplitude must exceed at least zfac times RMS-S amplitude
|
1.0 #zfac# %P-amplitude must exceed at least zfac times RMS-S amplitude
|
||||||
#check statistics of P onsets#
|
#check statistics of P onsets#
|
||||||
35 #mdttolerance# %maximum allowed deviation of P picks from median [s]
|
45 #mdttolerance# %maximum allowed deviation of P picks from median [s]
|
||||||
#wadati check#
|
#wadati check#
|
||||||
2.0 #wdttolerance# %maximum allowed deviation from Wadati-diagram
|
3.0 #wdttolerance# %maximum allowed deviation from Wadati-diagram
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ class AICcf(CharacteristicFunction):
|
|||||||
|
|
||||||
def calcCF(self, data):
|
def calcCF(self, data):
|
||||||
|
|
||||||
print 'Calculating AIC ...'
|
#print 'Calculating AIC ...' ## MP MP output suppressed
|
||||||
x = self.getDataArray()
|
x = self.getDataArray()
|
||||||
xnp = x[0].data
|
xnp = x[0].data
|
||||||
nn = np.isnan(xnp)
|
nn = np.isnan(xnp)
|
||||||
@ -260,7 +260,7 @@ class HOScf(CharacteristicFunction):
|
|||||||
y = np.power(xnp, 3)
|
y = np.power(xnp, 3)
|
||||||
y1 = np.power(xnp, 2)
|
y1 = np.power(xnp, 2)
|
||||||
elif self.getOrder() == 4: # this is kurtosis
|
elif self.getOrder() == 4: # this is kurtosis
|
||||||
print 'Calculating kurtosis ...'
|
#print 'Calculating kurtosis ...' ## MP MP output suppressed
|
||||||
y = np.power(xnp, 4)
|
y = np.power(xnp, 4)
|
||||||
y1 = np.power(xnp, 2)
|
y1 = np.power(xnp, 2)
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ calculated after Diehl & Kissling (2009).
|
|||||||
|
|
||||||
:author: MAGS2 EP3 working group / Ludger Kueperkoch
|
:author: MAGS2 EP3 working group / Ludger Kueperkoch
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
from pylot.core.pick.utils import getnoisewin, getsignalwin
|
from pylot.core.pick.utils import getnoisewin, getsignalwin
|
||||||
@ -245,8 +246,7 @@ class AICPicker(AutoPicking):
|
|||||||
if datafit[0] >= datafit[len(datafit) - 1]:
|
if datafit[0] >= datafit[len(datafit) - 1]:
|
||||||
print 'AICPicker: Negative slope, bad onset skipped!'
|
print 'AICPicker: Negative slope, bad onset skipped!'
|
||||||
return
|
return
|
||||||
|
self.slope = 1 / tslope * (datafit[len(dataslope) - 1] - datafit[0])
|
||||||
self.slope = 1 / tslope * datafit[len(dataslope) - 1] - datafit[0]
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.SNR = None
|
self.SNR = None
|
||||||
|
@ -43,7 +43,13 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=None):
|
|||||||
LPick = None
|
LPick = None
|
||||||
EPick = None
|
EPick = None
|
||||||
PickError = None
|
PickError = None
|
||||||
|
<<<<<<< Updated upstream
|
||||||
print ("earllatepicker: Get earliest and latest possible pick relative to most likely pick ...")
|
print ("earllatepicker: Get earliest and latest possible pick relative to most likely pick ...")
|
||||||
|
=======
|
||||||
|
# MP MP ++ output suppressed
|
||||||
|
#print 'earllatepicker: Get earliest and latest possible pick relative to most likely pick ...'
|
||||||
|
# MP MP --
|
||||||
|
>>>>>>> Stashed changes
|
||||||
|
|
||||||
x = X[0].data
|
x = X[0].data
|
||||||
t = np.arange(0, X[0].stats.npts / X[0].stats.sampling_rate,
|
t = np.arange(0, X[0].stats.npts / X[0].stats.sampling_rate,
|
||||||
|
@ -386,6 +386,9 @@ class Data(object):
|
|||||||
"""
|
"""
|
||||||
return self.evtdata
|
return self.evtdata
|
||||||
|
|
||||||
|
def setEvtData(self, event):
|
||||||
|
self.evtdata = event
|
||||||
|
|
||||||
def applyEVTData(self, data, type='pick', authority_id='rub'):
|
def applyEVTData(self, data, type='pick', authority_id='rub'):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@ -447,7 +450,10 @@ class Data(object):
|
|||||||
|
|
||||||
:param event:
|
:param event:
|
||||||
"""
|
"""
|
||||||
pass
|
if not self.isNew():
|
||||||
|
self.setEvtData(event)
|
||||||
|
else:
|
||||||
|
raise OverwriteError('Acutal event would be overwritten!')
|
||||||
|
|
||||||
applydata = {'pick': applyPicks,
|
applydata = {'pick': applyPicks,
|
||||||
'arrival': applyArrivals,
|
'arrival': applyArrivals,
|
||||||
|
@ -105,10 +105,10 @@ class MPLWidget(FigureCanvas):
|
|||||||
for level in noiselevel:
|
for level in noiselevel:
|
||||||
self.getAxes().plot([time_ax[0], time_ax[-1]],
|
self.getAxes().plot([time_ax[0], time_ax[-1]],
|
||||||
[level, level], '--k')
|
[level, level], '--k')
|
||||||
|
self.setPlotDict(n, (station, channel))
|
||||||
xlabel = 'seconds since {0}'.format(wfstart)
|
xlabel = 'seconds since {0}'.format(wfstart)
|
||||||
ylabel = ''
|
ylabel = ''
|
||||||
self.updateWidget(xlabel, ylabel, title)
|
self.updateWidget(xlabel, ylabel, title)
|
||||||
self.setPlotDict(n, (station, channel))
|
|
||||||
self.setXLims([0, wfend - wfstart])
|
self.setXLims([0, wfend - wfstart])
|
||||||
self.setYLims([-0.5, n + 0.5])
|
self.setYLims([-0.5, n + 0.5])
|
||||||
if zoomx is not None:
|
if zoomx is not None:
|
||||||
|
Loading…
Reference in New Issue
Block a user