Merge branch 'develop' of ariadne.geophysik.rub.de:/data/git/pylot into develop
Try to solve conflict, only marginal changes. Conflicts: pylot/core/pick/utils.py
This commit is contained in:
commit
ab840fbcf1
@ -549,7 +549,7 @@ def main():
|
|||||||
pylot_form = MainWindow()
|
pylot_form = MainWindow()
|
||||||
|
|
||||||
# Show main window and run the app
|
# Show main window and run the app
|
||||||
pylot_form.show()
|
pylot_form.showMaximized()
|
||||||
pylot_app.exec_()
|
pylot_app.exec_()
|
||||||
|
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
694a-dirty
|
1abc-dirty
|
||||||
|
@ -398,6 +398,43 @@ def getsignalwin(t, t1, tsignal):
|
|||||||
return isignal
|
return isignal
|
||||||
|
|
||||||
|
|
||||||
|
def getResolutionWindow(snr):
|
||||||
|
"""
|
||||||
|
Number -> Float
|
||||||
|
produce the half of the time resolution window width from given SNR
|
||||||
|
value
|
||||||
|
SNR >= 3 -> 2 sec HRW
|
||||||
|
3 > SNR >= 2 -> 5 sec MRW
|
||||||
|
2 > SNR >= 1.5 -> 10 sec LRW
|
||||||
|
1.5 > SNR -> 15 sec VLRW
|
||||||
|
see also Diehl et al. 2009
|
||||||
|
|
||||||
|
>>> getResolutionWindow(0.5)
|
||||||
|
7.5
|
||||||
|
>>> getResolutionWindow(1.8)
|
||||||
|
5.0
|
||||||
|
>>> getResolutionWindow(2.3)
|
||||||
|
2.5
|
||||||
|
>>> getResolutionWindow(4)
|
||||||
|
1.0
|
||||||
|
>>> getResolutionWindow(2)
|
||||||
|
2.5
|
||||||
|
"""
|
||||||
|
|
||||||
|
res_wins = {'HRW': 2., 'MRW': 5., 'LRW': 10., 'VLRW': 15.}
|
||||||
|
|
||||||
|
if snr < 1.5:
|
||||||
|
time_resolution = res_wins['VLRW']
|
||||||
|
elif snr < 2.:
|
||||||
|
time_resolution = res_wins['LRW']
|
||||||
|
elif snr < 3.:
|
||||||
|
time_resolution = res_wins['MRW']
|
||||||
|
else:
|
||||||
|
time_resolution = res_wins['HRW']
|
||||||
|
|
||||||
|
return time_resolution/2
|
||||||
|
|
||||||
|
|
||||||
def wadaticheck(pickdic, dttolerance, iplot):
|
def wadaticheck(pickdic, dttolerance, iplot):
|
||||||
'''
|
'''
|
||||||
Function to calculate Wadati-diagram from given P and S onsets in order
|
Function to calculate Wadati-diagram from given P and S onsets in order
|
||||||
@ -578,8 +615,13 @@ def checksignallength(X, pick, TSNR, minsiglength, nfac, minpercent, iplot):
|
|||||||
if iplot == 2:
|
if iplot == 2:
|
||||||
plt.figure(iplot)
|
plt.figure(iplot)
|
||||||
p1, = plt.plot(t,x, 'k')
|
p1, = plt.plot(t,x, 'k')
|
||||||
|
<<<<<<< HEAD
|
||||||
p2, = plt.plot(t[inoise], e[inoise], 'c')
|
p2, = plt.plot(t[inoise], e[inoise], 'c')
|
||||||
p3, = plt.plot(t[isignal],e[isignal], 'r')
|
p3, = plt.plot(t[isignal],e[isignal], 'r')
|
||||||
|
=======
|
||||||
|
p2, = plt.plot(t[inoise], e[inoise])
|
||||||
|
p3, = plt.plot(t[isignal],e[isignal], 'r')
|
||||||
|
>>>>>>> e542aa70d9341893b874499586f7ee8cc5be18bc
|
||||||
p4, = plt.plot([t[isignal[0]], t[isignal[len(isignal)-1]]], \
|
p4, = plt.plot([t[isignal[0]], t[isignal[len(isignal)-1]]], \
|
||||||
[minsiglevel, minsiglevel], 'g')
|
[minsiglevel, minsiglevel], 'g')
|
||||||
p5, = plt.plot([pick, pick], [min(x), max(x)], linewidth=2)
|
p5, = plt.plot([pick, pick], [min(x), max(x)], linewidth=2)
|
||||||
@ -596,4 +638,6 @@ def checksignallength(X, pick, TSNR, minsiglength, nfac, minpercent, iplot):
|
|||||||
|
|
||||||
return returnflag
|
return returnflag
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
import doctest
|
||||||
|
doctest.testmod()
|
||||||
|
@ -10,7 +10,7 @@ FILTERDEFAULTS = {'P': {'filtertype': None,
|
|||||||
'order': None,
|
'order': None,
|
||||||
'freq': None},
|
'freq': None},
|
||||||
'S': {'filtertype': 'bandpass',
|
'S': {'filtertype': 'bandpass',
|
||||||
'order': '4',
|
'order': 4,
|
||||||
'freq': [.5, 5]}}
|
'freq': [.5, 5]}}
|
||||||
|
|
||||||
OUTPUTFORMATS = {'QuakeML':'QUAKEML', 'VelEst':'VELEST'}
|
OUTPUTFORMATS = {'QuakeML':'QUAKEML', 'VelEst':'VELEST'}
|
@ -24,7 +24,8 @@ from PySide.QtCore import QSettings, Qt, QUrl, Signal, Slot
|
|||||||
from PySide.QtWebKit import QWebView
|
from PySide.QtWebKit import QWebView
|
||||||
from obspy import Stream, UTCDateTime
|
from obspy import Stream, UTCDateTime
|
||||||
from pylot.core.read import FilterOptions
|
from pylot.core.read import FilterOptions
|
||||||
from pylot.core.pick.utils import getSNR, earllatepicker, getnoisewin
|
from pylot.core.pick.utils import getSNR, earllatepicker, getnoisewin,\
|
||||||
|
getResolutionWindow
|
||||||
from pylot.core.util.defaults import OUTPUTFORMATS, FILTERDEFAULTS
|
from pylot.core.util.defaults import OUTPUTFORMATS, FILTERDEFAULTS
|
||||||
from pylot.core.util import prepTimeAxis, getGlobalTimes
|
from pylot.core.util import prepTimeAxis, getGlobalTimes
|
||||||
|
|
||||||
@ -389,6 +390,12 @@ class PickDlg(QDialog):
|
|||||||
return self.picks
|
return self.picks
|
||||||
|
|
||||||
def setIniPick(self, gui_event):
|
def setIniPick(self, gui_event):
|
||||||
|
if self.selectPhase.currentText().upper().startswith('P'):
|
||||||
|
self.setIniPickP(gui_event)
|
||||||
|
elif self.selectPhase.currentText().upper().startswith('S'):
|
||||||
|
self.setIniPickS(gui_event)
|
||||||
|
|
||||||
|
def setIniPickP(self, gui_event):
|
||||||
|
|
||||||
trace_number = round(gui_event.ydata)
|
trace_number = round(gui_event.ydata)
|
||||||
|
|
||||||
@ -403,20 +410,6 @@ class PickDlg(QDialog):
|
|||||||
|
|
||||||
ini_pick = gui_event.xdata
|
ini_pick = gui_event.xdata
|
||||||
|
|
||||||
# calculate the resolution window width from SNR
|
|
||||||
# SNR >= 3 -> 2 sec HRW
|
|
||||||
# 3 > SNR >= 2 -> 5 sec MRW
|
|
||||||
# 2 > SNR >= 1.5 -> 10 sec LRW
|
|
||||||
# 1.5 > SNR -> 15 sec VLRW
|
|
||||||
# see also Diehl et al. 2009
|
|
||||||
|
|
||||||
res_wins = {
|
|
||||||
'HRW': 2.,
|
|
||||||
'MRW': 5.,
|
|
||||||
'LRW': 10.,
|
|
||||||
'VLRW': 15.
|
|
||||||
}
|
|
||||||
|
|
||||||
settings = QSettings()
|
settings = QSettings()
|
||||||
|
|
||||||
nfac = settings.value('picking/nfac', 1.5)
|
nfac = settings.value('picking/nfac', 1.5)
|
||||||
@ -429,15 +422,7 @@ class PickDlg(QDialog):
|
|||||||
snr = result[0]
|
snr = result[0]
|
||||||
noiselevel = result[2] * nfac
|
noiselevel = result[2] * nfac
|
||||||
|
|
||||||
if snr < 1.5:
|
x_res = getResolutionWindow(snr)
|
||||||
x_res = res_wins['VLRW']
|
|
||||||
elif snr < 2.:
|
|
||||||
x_res = res_wins['LRW']
|
|
||||||
elif snr < 3.:
|
|
||||||
x_res = res_wins['MRW']
|
|
||||||
else:
|
|
||||||
x_res = res_wins['HRW']
|
|
||||||
x_res /= 2
|
|
||||||
|
|
||||||
# demean data before plotting
|
# demean data before plotting
|
||||||
data = self.getWFData().copy()
|
data = self.getWFData().copy()
|
||||||
@ -465,6 +450,8 @@ class PickDlg(QDialog):
|
|||||||
self.setPlotLabels()
|
self.setPlotLabels()
|
||||||
self.draw()
|
self.draw()
|
||||||
|
|
||||||
|
def setIniPickS(self, gui_event):
|
||||||
|
pass
|
||||||
|
|
||||||
def setPick(self, gui_event):
|
def setPick(self, gui_event):
|
||||||
|
|
||||||
@ -518,16 +505,18 @@ class PickDlg(QDialog):
|
|||||||
self.disconnectPressEvent()
|
self.disconnectPressEvent()
|
||||||
self.zoomAction.setEnabled(True)
|
self.zoomAction.setEnabled(True)
|
||||||
self.selectPhase.setCurrentIndex(-1)
|
self.selectPhase.setCurrentIndex(-1)
|
||||||
self.getPlotWidget().setXLims(self.getXLims())
|
self.setPlotLabels()
|
||||||
self.getPlotWidget().setYLims(self.getYLims())
|
|
||||||
|
|
||||||
def drawPicks(self, phase=None):
|
def drawPicks(self, phase=None):
|
||||||
# plotting picks
|
# plotting picks
|
||||||
ax = self.getPlotWidget().axes
|
ax = self.getPlotWidget().axes
|
||||||
ylims = self.getGlobalLimits('y')
|
ylims = self.getGlobalLimits('y')
|
||||||
|
phase_col = {'P': ('c', 'c--', 'b-'),
|
||||||
|
'S': ('m', 'm--', 'r-')}
|
||||||
if self.getPicks():
|
if self.getPicks():
|
||||||
if phase is not None:
|
if phase is not None:
|
||||||
picks = self.getPicks()[phase]
|
picks = self.getPicks()[phase]
|
||||||
|
colors = phase_col[phase[0].upper()]
|
||||||
else:
|
else:
|
||||||
for phase in self.getPicks():
|
for phase in self.getPicks():
|
||||||
self.drawPicks(phase)
|
self.drawPicks(phase)
|
||||||
@ -540,10 +529,11 @@ class PickDlg(QDialog):
|
|||||||
lpp = picks['lpp']
|
lpp = picks['lpp']
|
||||||
spe = picks['spe']
|
spe = picks['spe']
|
||||||
|
|
||||||
ax.fill_between([epp, lpp], ylims[0], ylims[1], alpha=.5, color='c')
|
ax.fill_between([epp, lpp], ylims[0], ylims[1],
|
||||||
ax.plot([mpp - spe, mpp - spe], ylims, 'c--',
|
alpha=.5, color=colors[0])
|
||||||
[mpp, mpp], ylims, 'b-',
|
ax.plot([mpp - spe, mpp - spe], ylims, colors[1],
|
||||||
[mpp + spe, mpp + spe], ylims, 'c--')
|
[mpp, mpp], ylims, colors[2],
|
||||||
|
[mpp + spe, mpp + spe], ylims, colors[1])
|
||||||
|
|
||||||
def panPress(self, gui_event):
|
def panPress(self, gui_event):
|
||||||
ax = self.getPlotWidget().axes
|
ax = self.getPlotWidget().axes
|
||||||
@ -619,10 +609,11 @@ class PickDlg(QDialog):
|
|||||||
self.disconnectScrollEvent()
|
self.disconnectScrollEvent()
|
||||||
self.figToolBar.zoom()
|
self.figToolBar.zoom()
|
||||||
else:
|
else:
|
||||||
self.connectPressEvent(self.panPress)
|
self.figToolBar.zoom()
|
||||||
self.connectMotionEvent(self.panMotion)
|
self.cidpress = self.connectPressEvent(self.panPress)
|
||||||
self.connectReleaseEvent(self.panRelease)
|
self.cidmotion = self.connectMotionEvent(self.panMotion)
|
||||||
self.connectScrollEvent(self.scrollZoom)
|
self.cidrelease = self.connectReleaseEvent(self.panRelease)
|
||||||
|
self.cidscroll = self.connectScrollEvent(self.scrollZoom)
|
||||||
|
|
||||||
def scrollZoom(self, gui_event, factor=2.):
|
def scrollZoom(self, gui_event, factor=2.):
|
||||||
|
|
||||||
@ -1049,3 +1040,7 @@ class HelpForm(QDialog):
|
|||||||
|
|
||||||
def updatePageTitle(self):
|
def updatePageTitle(self):
|
||||||
self.pageLabel.setText(self.webBrowser.documentTitle())
|
self.pageLabel.setText(self.webBrowser.documentTitle())
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
import doctest
|
||||||
|
doctest.testmod()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user