[bugfixes] changed iplot flag default to 0, intercept Exception on false

filter settings
This commit is contained in:
Marcel Paffrath 2017-07-14 11:09:18 +02:00
parent a560f4140b
commit 68f864e93a
6 changed files with 35 additions and 17 deletions

View File

@ -1348,13 +1348,13 @@ class MainWindow(QMainWindow):
call modal plot thread method when finished.
'''
if load:
wfd_thread = Thread(self, self.loadWaveformData,
self.wfd_thread = Thread(self, self.loadWaveformData,
progressText='Reading data input...')
if load and plot:
wfd_thread.finished.connect(self.plotWaveformDataThread)
self.wfd_thread.finished.connect(self.plotWaveformDataThread)
if load:
wfd_thread.start()
self.wfd_thread.start()
if plot and not load:
self.plotWaveformDataThread()

View File

@ -360,7 +360,7 @@ def reassess_pilot_event(root_dir, db_dir, event_id, out_dir=None, fn_param=None
default.get('nfac{0}'.format(phase)),
default.get('tsnrz' if phase == 'P' else 'tsnrh'),
Pick1=rel_pick,
iplot=None,
iplot=0,
verbosity=0)
if epp is None or lpp is None:
continue

View File

@ -34,7 +34,7 @@ class AutoPicker(object):
warnings.simplefilter('ignore')
def __init__(self, cf, TSNR, PickWindow, iplot=None, aus=None, Tsmooth=None, Pick1=None, fig=None):
def __init__(self, cf, TSNR, PickWindow, iplot=0, aus=None, Tsmooth=None, Pick1=None, fig=None):
'''
:param: cf, characteristic function, on which the picking algorithm is applied
:type: `~pylot.core.pick.CharFuns.CharacteristicFunction` object

View File

@ -14,7 +14,7 @@ import numpy as np
from obspy.core import Stream, UTCDateTime
def earllatepicker(X, nfac, TSNR, Pick1, iplot=None, verbosity=1, fig=None):
def earllatepicker(X, nfac, TSNR, Pick1, iplot=0, verbosity=1, fig=None):
'''
Function to derive earliest and latest possible pick after Diehl & Kissling (2009)
as reasonable uncertainties. Latest possible pick is based on noise level,
@ -144,7 +144,7 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=None, verbosity=1, fig=None):
return EPick, LPick, PickError
def fmpicker(Xraw, Xfilt, pickwin, Pick, iplot=None, fig=None):
def fmpicker(Xraw, Xfilt, pickwin, Pick, iplot=0, fig=None):
'''
Function to derive first motion (polarity) of given phase onset Pick.
Calculation is based on zero crossings determined within time window pickwin

View File

@ -15,7 +15,7 @@ from obspy.core import Stream, UTCDateTime
import warnings
def earllatepicker(X, nfac, TSNR, Pick1, iplot=None, stealthMode = False):
def earllatepicker(X, nfac, TSNR, Pick1, iplot=0, stealthMode = False):
'''
Function to derive earliest and latest possible pick after Diehl & Kissling (2009)
as reasonable uncertainties. Latest possible pick is based on noise level,
@ -136,7 +136,7 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=None, stealthMode = False):
return EPick, LPick, PickError
def fmpicker(Xraw, Xfilt, pickwin, Pick, iplot=None):
def fmpicker(Xraw, Xfilt, pickwin, Pick, iplot=0):
'''
Function to derive first motion (polarity) of given phase onset Pick.
Calculation is based on zero crossings determined within time window pickwin

View File

@ -468,7 +468,7 @@ class WaveformWidgetPG(QtGui.QWidget):
def plotWFData(self, wfdata, title=None, zoomx=None, zoomy=None,
noiselevel=None, scaleddata=False, mapping=True,
component='*', nth_sample=1, iniPick=None):
component='*', nth_sample=1, iniPick=None, verbosity=0):
self.title = title
self.clearPlotDict()
wfstart, wfend = full_range(wfdata)
@ -515,7 +515,8 @@ class WaveformWidgetPG(QtGui.QWidget):
if n > nmax:
nmax = n
msg = 'plotting %s channel of station %s' % (channel, station)
print(msg)
if verbosity:
print(msg)
stime = trace.stats.starttime - wfstart
time_ax = prepTimeAxis(stime, trace)
if time_ax is not None:
@ -702,7 +703,7 @@ class WaveformWidget(FigureCanvas):
self.getAxes().set_ylim(lims)
def setYTickLabels(self, pos, labels):
self.getAxes().set_yticks(pos)
self.getAxes().set_yticks(list(pos))
self.getAxes().set_yticklabels(labels)
self.draw()
@ -1354,8 +1355,13 @@ class PickDlg(QDialog):
phase = self.currentPhase
filteroptions = self.getFilterOptions(phase[0]).parseFilterOptions()
if filteroptions:
data.filter(**filteroptions)
wfdata.filter(**filteroptions)
try:
data.filter(**filteroptions)
wfdata.filter(**filteroptions)
except ValueError as e:
self.qmb = QtGui.QMessageBox(QtGui.QMessageBox.Icon.Information,
'Denied', 'setIniPickP: Could not filter waveform: {}'.format(e))
self.qmb.show()
result = getSNR(wfdata, (noise_win, gap_win, signal_win), ini_pick-stime_diff, itrace)
@ -1407,8 +1413,13 @@ class PickDlg(QDialog):
phase = self.currentPhase
filteroptions = self.getFilterOptions(phase).parseFilterOptions()
if filteroptions:
data.filter(**filteroptions)
wfdata.filter(**filteroptions)
try:
data.filter(**filteroptions)
wfdata.filter(**filteroptions)
except ValueError as e:
self.qmb = QtGui.QMessageBox(QtGui.QMessageBox.Icon.Information,
'Denied', 'setIniPickS: Could not filter waveform: {}'.format(e))
self.qmb.show()
# determine SNR and noiselevel
result = getSNR(wfdata, (noise_win, gap_win, signal_win), ini_pick-stime_diff)
@ -1469,7 +1480,14 @@ class PickDlg(QDialog):
# copy and filter data for earliest and latest possible picks
wfdata = self.getWFData().copy().select(channel=channel)
if filteroptions:
wfdata.filter(**filteroptions)
try:
wfdata.filter(**filteroptions)
except ValueError as e:
self.qmb = QtGui.QMessageBox(QtGui.QMessageBox.Icon.Information,
'Denied', 'setPick: Could not filter waveform: {}'.format(e))
self.qmb.show()
# get earliest and latest possible pick and symmetric pick error
if wfdata[0].stats.channel[2] == 'Z' or wfdata[0].stats.channel[2] == '3':