[update/bugfix] big update on filter options:
- added toggle and QSetting for automatic filtering when picking - filtering in 3comp window independent from main plot, current filter options are copied after 3comp. init though - several bugfixes when activating/deactivating filter
This commit is contained in:
parent
549700bf7a
commit
4150e7f7d4
7
PyLoT.py
7
PyLoT.py
@ -187,6 +187,8 @@ class MainWindow(QMainWindow):
|
|||||||
"Enter output format (*.xml, *.cnv, *.obs):",
|
"Enter output format (*.xml, *.cnv, *.obs):",
|
||||||
"Format")
|
"Format")
|
||||||
settings.setValue("output/Format", outformat)
|
settings.setValue("output/Format", outformat)
|
||||||
|
if settings.value('autoFilter', None) is None:
|
||||||
|
settings.setValue('autoFilter', True)
|
||||||
settings.sync()
|
settings.sync()
|
||||||
|
|
||||||
# setup UI
|
# setup UI
|
||||||
@ -1971,7 +1973,7 @@ class MainWindow(QMainWindow):
|
|||||||
if not station:
|
if not station:
|
||||||
return
|
return
|
||||||
self.update_status('picking on station {0}'.format(station))
|
self.update_status('picking on station {0}'.format(station))
|
||||||
data = self.get_data().getWFData()
|
data = self.get_data().getOriginalWFData().copy()
|
||||||
event = self.get_current_event()
|
event = self.get_current_event()
|
||||||
pickDlg = PickDlg(self, parameter=self._inputs,
|
pickDlg = PickDlg(self, parameter=self._inputs,
|
||||||
data=data.select(station=station),
|
data=data.select(station=station),
|
||||||
@ -1980,6 +1982,9 @@ class MainWindow(QMainWindow):
|
|||||||
autopicks=self.getPicksOnStation(station, 'auto'),
|
autopicks=self.getPicksOnStation(station, 'auto'),
|
||||||
metadata=self.metadata, event=event,
|
metadata=self.metadata, event=event,
|
||||||
filteroptions=self.filteroptions)
|
filteroptions=self.filteroptions)
|
||||||
|
if self.filterAction.isChecked():
|
||||||
|
pickDlg.currentPhase = self.getSeismicPhase()
|
||||||
|
pickDlg.filterWFData()
|
||||||
pickDlg.nextStation.setChecked(nextStation)
|
pickDlg.nextStation.setChecked(nextStation)
|
||||||
if pickDlg.exec_():
|
if pickDlg.exec_():
|
||||||
if pickDlg._dirty:
|
if pickDlg._dirty:
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
<file>icons/Matlab_PILOT_icon.png</file>
|
<file>icons/Matlab_PILOT_icon.png</file>
|
||||||
<file>icons/printer.png</file>
|
<file>icons/printer.png</file>
|
||||||
<file>icons/delete.png</file>
|
<file>icons/delete.png</file>
|
||||||
|
<file>icons/key_A.png</file>
|
||||||
<file>icons/key_E.png</file>
|
<file>icons/key_E.png</file>
|
||||||
<file>icons/key_N.png</file>
|
<file>icons/key_N.png</file>
|
||||||
<file>icons/key_P.png</file>
|
<file>icons/key_P.png</file>
|
||||||
|
BIN
icons/key_A.png
Normal file
BIN
icons/key_A.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 48 KiB |
3112
icons_rc_2.py
3112
icons_rc_2.py
File diff suppressed because it is too large
Load Diff
3112
icons_rc_3.py
3112
icons_rc_3.py
File diff suppressed because it is too large
Load Diff
@ -1 +1 @@
|
|||||||
c393-dirty
|
54970-dirty
|
||||||
|
@ -327,9 +327,9 @@ def real_Bool(value):
|
|||||||
:return: true boolean value
|
:return: true boolean value
|
||||||
:rtype: bool
|
:rtype: bool
|
||||||
"""
|
"""
|
||||||
if value == 'True':
|
if value in ['True', 'true']:
|
||||||
return True
|
return True
|
||||||
elif value == 'False':
|
elif value in ['False', 'false']:
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
return value
|
return value
|
||||||
|
@ -18,7 +18,7 @@ import numpy as np
|
|||||||
|
|
||||||
from matplotlib.figure import Figure
|
from matplotlib.figure import Figure
|
||||||
from pylot.core.util.utils import find_horizontals, identifyPhase, loopIdentifyPhase, trim_station_components, \
|
from pylot.core.util.utils import find_horizontals, identifyPhase, loopIdentifyPhase, trim_station_components, \
|
||||||
identifyPhaseID, check4rotated
|
identifyPhaseID, check4rotated, real_Bool
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from matplotlib.backends.backend_qt4agg import FigureCanvas
|
from matplotlib.backends.backend_qt4agg import FigureCanvas
|
||||||
@ -1247,6 +1247,8 @@ class PickDlg(QDialog):
|
|||||||
filter_icon_p.addPixmap(QPixmap(':/icons/filter_p.png'))
|
filter_icon_p.addPixmap(QPixmap(':/icons/filter_p.png'))
|
||||||
filter_icon_s = QIcon()
|
filter_icon_s = QIcon()
|
||||||
filter_icon_s.addPixmap(QPixmap(':/icons/filter_s.png'))
|
filter_icon_s.addPixmap(QPixmap(':/icons/filter_s.png'))
|
||||||
|
key_a_icon = QIcon()
|
||||||
|
key_a_icon.addPixmap(QPixmap(':/icons/key_A.png'))
|
||||||
zoom_icon = QIcon()
|
zoom_icon = QIcon()
|
||||||
zoom_icon.addPixmap(QPixmap(':/icons/zoom_in.png'))
|
zoom_icon.addPixmap(QPixmap(':/icons/zoom_in.png'))
|
||||||
home_icon = QIcon()
|
home_icon = QIcon()
|
||||||
@ -1269,6 +1271,12 @@ class PickDlg(QDialog):
|
|||||||
' waveforms',
|
' waveforms',
|
||||||
checkable=True,
|
checkable=True,
|
||||||
shortcut='Shift+S')
|
shortcut='Shift+S')
|
||||||
|
self.autoFilterAction = createAction(parent=self, text='Automatic Filtering',
|
||||||
|
slot=self.toggleAutoFilter,
|
||||||
|
icon=key_a_icon,
|
||||||
|
tip='Filter automatically before initial pick',
|
||||||
|
checkable=True,
|
||||||
|
shortcut='Ctrl+A')
|
||||||
self.zoomAction = createAction(parent=self, text='Zoom',
|
self.zoomAction = createAction(parent=self, text='Zoom',
|
||||||
slot=self.zoom, icon=zoom_icon,
|
slot=self.zoom, icon=zoom_icon,
|
||||||
tip='Zoom into waveform',
|
tip='Zoom into waveform',
|
||||||
@ -1282,6 +1290,9 @@ class PickDlg(QDialog):
|
|||||||
|
|
||||||
self.addPickPhases(menuBar)
|
self.addPickPhases(menuBar)
|
||||||
|
|
||||||
|
settings = QSettings()
|
||||||
|
self.autoFilterAction.setChecked(real_Bool(settings.value('autoFilter')))
|
||||||
|
|
||||||
# create other widget elements
|
# create other widget elements
|
||||||
phaseitems = [None] + list(FILTERDEFAULTS.keys())
|
phaseitems = [None] + list(FILTERDEFAULTS.keys())
|
||||||
|
|
||||||
@ -1316,6 +1327,7 @@ class PickDlg(QDialog):
|
|||||||
# fill toolbar with content
|
# fill toolbar with content
|
||||||
_dialtoolbar.addAction(self.filterActionP)
|
_dialtoolbar.addAction(self.filterActionP)
|
||||||
_dialtoolbar.addAction(self.filterActionS)
|
_dialtoolbar.addAction(self.filterActionS)
|
||||||
|
_dialtoolbar.addAction(self.autoFilterAction)
|
||||||
_dialtoolbar.addWidget(self.p_button)
|
_dialtoolbar.addWidget(self.p_button)
|
||||||
_dialtoolbar.addWidget(self.s_button)
|
_dialtoolbar.addWidget(self.s_button)
|
||||||
_dialtoolbar.addAction(self.zoomAction)
|
_dialtoolbar.addAction(self.zoomAction)
|
||||||
@ -1529,6 +1541,7 @@ class PickDlg(QDialog):
|
|||||||
filterMenu = menuBar.addMenu('Filter')
|
filterMenu = menuBar.addMenu('Filter')
|
||||||
filterMenu.addAction(self.filterActionP)
|
filterMenu.addAction(self.filterActionP)
|
||||||
filterMenu.addAction(self.filterActionS)
|
filterMenu.addAction(self.filterActionS)
|
||||||
|
filterMenu.addAction(self.autoFilterAction)
|
||||||
filterMenu.addAction(filterOptionsAction)
|
filterMenu.addAction(filterOptionsAction)
|
||||||
|
|
||||||
def filterOptions(self):
|
def filterOptions(self):
|
||||||
@ -1581,13 +1594,13 @@ class PickDlg(QDialog):
|
|||||||
|
|
||||||
def init_p_pick(self):
|
def init_p_pick(self):
|
||||||
self.set_button_border_color(self.p_button, 'yellow')
|
self.set_button_border_color(self.p_button, 'yellow')
|
||||||
self.activatePicking()
|
|
||||||
self.currentPhase = str(self.p_button.text())
|
self.currentPhase = str(self.p_button.text())
|
||||||
|
self.activatePicking()
|
||||||
|
|
||||||
def init_s_pick(self):
|
def init_s_pick(self):
|
||||||
self.set_button_border_color(self.s_button, 'yellow')
|
self.set_button_border_color(self.s_button, 'yellow')
|
||||||
self.activatePicking()
|
|
||||||
self.currentPhase = str(self.s_button.text())
|
self.currentPhase = str(self.s_button.text())
|
||||||
|
self.activatePicking()
|
||||||
|
|
||||||
def getPhaseID(self, phase):
|
def getPhaseID(self, phase):
|
||||||
return identifyPhaseID(phase)
|
return identifyPhaseID(phase)
|
||||||
@ -1628,12 +1641,7 @@ class PickDlg(QDialog):
|
|||||||
self.currentPhase = None
|
self.currentPhase = None
|
||||||
self.reset_p_button()
|
self.reset_p_button()
|
||||||
self.reset_s_button()
|
self.reset_s_button()
|
||||||
self.multicompfig.plotWFData(wfdata=self.getWFData(),
|
self.resetPlot()
|
||||||
title=self.getStation())
|
|
||||||
self.drawAllPicks()
|
|
||||||
self.drawArrivals()
|
|
||||||
self.setPlotLabels()
|
|
||||||
self.resetZoomAction.trigger()
|
|
||||||
self.deactivatePicking()
|
self.deactivatePicking()
|
||||||
|
|
||||||
def activatePicking(self):
|
def activatePicking(self):
|
||||||
@ -1643,7 +1651,13 @@ class PickDlg(QDialog):
|
|||||||
self.zoomAction.trigger()
|
self.zoomAction.trigger()
|
||||||
self.multicompfig.disconnectEvents()
|
self.multicompfig.disconnectEvents()
|
||||||
self.cidpress = self.multicompfig.connectPressEvent(self.setIniPick)
|
self.cidpress = self.multicompfig.connectPressEvent(self.setIniPick)
|
||||||
self.filterWFData()
|
if not self.filterActionP.isChecked() and not self.filterActionS.isChecked():
|
||||||
|
if self.autoFilterAction.isChecked():
|
||||||
|
self.filterWFData()
|
||||||
|
else:
|
||||||
|
self.draw()
|
||||||
|
else:
|
||||||
|
self.draw()
|
||||||
#self.pick_block = self.togglePickBlocker()
|
#self.pick_block = self.togglePickBlocker()
|
||||||
self.disconnect_pick_delete()
|
self.disconnect_pick_delete()
|
||||||
|
|
||||||
@ -1804,13 +1818,13 @@ class PickDlg(QDialog):
|
|||||||
if filteroptions:
|
if filteroptions:
|
||||||
try:
|
try:
|
||||||
data.filter(**filteroptions)
|
data.filter(**filteroptions)
|
||||||
wfdata.filter(**filteroptions)
|
#wfdata.filter(**filteroptions)# MP MP removed filtering of original data
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
self.qmb = QtGui.QMessageBox(QtGui.QMessageBox.Icon.Information,
|
self.qmb = QtGui.QMessageBox(QtGui.QMessageBox.Icon.Information,
|
||||||
'Denied', 'setIniPickP: Could not filter waveform: {}'.format(e))
|
'Denied', 'setIniPickP: Could not filter waveform: {}'.format(e))
|
||||||
self.qmb.show()
|
self.qmb.show()
|
||||||
|
|
||||||
result = getSNR(wfdata, (noise_win, gap_win, signal_win), ini_pick - stime_diff, itrace)
|
result = getSNR(data, (noise_win, gap_win, signal_win), ini_pick - stime_diff, itrace)
|
||||||
|
|
||||||
snr = result[0]
|
snr = result[0]
|
||||||
noiselevel = result[2]
|
noiselevel = result[2]
|
||||||
@ -2138,13 +2152,20 @@ class PickDlg(QDialog):
|
|||||||
return not self.pick_block
|
return not self.pick_block
|
||||||
|
|
||||||
def filterWFData(self, phase=None):
|
def filterWFData(self, phase=None):
|
||||||
|
if not phase:
|
||||||
|
phase = self.currentPhase
|
||||||
|
if phase == 'P':
|
||||||
|
self.filterActionP.setChecked(True)
|
||||||
|
self.filterP()
|
||||||
|
elif phase == 'S':
|
||||||
|
self.filterActionS.setChecked(True)
|
||||||
|
self.filterS()
|
||||||
|
return
|
||||||
self.plotWFData(phase=phase, filter=True)
|
self.plotWFData(phase=phase, filter=True)
|
||||||
|
|
||||||
def plotWFData(self, phase=None, filter=False):
|
def plotWFData(self, phase=None, filter=False):
|
||||||
if self.pick_block:
|
if self.pick_block:
|
||||||
return
|
return
|
||||||
if not phase:
|
|
||||||
phase = self.currentPhase
|
|
||||||
self.cur_xlim = self.multicompfig.axes[0].get_xlim()
|
self.cur_xlim = self.multicompfig.axes[0].get_xlim()
|
||||||
self.cur_ylim = self.multicompfig.axes[0].get_ylim()
|
self.cur_ylim = self.multicompfig.axes[0].get_ylim()
|
||||||
#self.multicompfig.updateCurrentLimits()
|
#self.multicompfig.updateCurrentLimits()
|
||||||
@ -2162,7 +2183,7 @@ class PickDlg(QDialog):
|
|||||||
|
|
||||||
if filtoptions is not None:
|
if filtoptions is not None:
|
||||||
data.filter(**filtoptions)
|
data.filter(**filtoptions)
|
||||||
title += '({} filtered'.format(filtoptions['type'])
|
title += '({} filtered - '.format(filtoptions['type'])
|
||||||
for key, value in filtoptions.items():
|
for key, value in filtoptions.items():
|
||||||
if key == 'type':
|
if key == 'type':
|
||||||
continue
|
continue
|
||||||
@ -2189,7 +2210,13 @@ class PickDlg(QDialog):
|
|||||||
else:
|
else:
|
||||||
self.resetPlot()
|
self.resetPlot()
|
||||||
|
|
||||||
|
def toggleAutoFilter(self):
|
||||||
|
settings = QSettings()
|
||||||
|
settings.setValue('autoFilter', self.autoFilterAction.isChecked())
|
||||||
|
|
||||||
def resetPlot(self):
|
def resetPlot(self):
|
||||||
|
self.filterActionP.setChecked(False)
|
||||||
|
self.filterActionS.setChecked(False)
|
||||||
self.resetZoom()
|
self.resetZoom()
|
||||||
data = self.getWFData().copy()
|
data = self.getWFData().copy()
|
||||||
#title = self.multicompfig.axes[0].get_title()
|
#title = self.multicompfig.axes[0].get_title()
|
||||||
|
Loading…
Reference in New Issue
Block a user