[add] delete all autopicks button in GUI
[bugfix] small bugfix in case of problems with Stream String representation
This commit is contained in:
parent
a9135ec483
commit
3a1c907043
26
PyLoT.py
26
PyLoT.py
@ -67,7 +67,7 @@ from pylot.core.io.inputs import FilterOptions, PylotParameter
|
|||||||
from autoPyLoT import autoPyLoT
|
from autoPyLoT import autoPyLoT
|
||||||
from pylot.core.pick.compare import Comparison
|
from pylot.core.pick.compare import Comparison
|
||||||
from pylot.core.pick.utils import symmetrize_error, getQualityFromUncertainty, getPickQuality, get_quality_class
|
from pylot.core.pick.utils import symmetrize_error, getQualityFromUncertainty, getPickQuality, get_quality_class
|
||||||
from pylot.core.io.phases import picksdict_from_picks
|
from pylot.core.io.phases import picksdict_from_picks, picks_from_picksdict
|
||||||
import pylot.core.loc.nll as nll
|
import pylot.core.loc.nll as nll
|
||||||
from pylot.core.util.errors import DatastructureError, \
|
from pylot.core.util.errors import DatastructureError, \
|
||||||
OverwriteError
|
OverwriteError
|
||||||
@ -290,6 +290,8 @@ class MainWindow(QMainWindow):
|
|||||||
prefIcon.addPixmap(QPixmap(':/icons/preferences.png'))
|
prefIcon.addPixmap(QPixmap(':/icons/preferences.png'))
|
||||||
paraIcon = QIcon()
|
paraIcon = QIcon()
|
||||||
paraIcon.addPixmap(QPixmap(':/icons/parameter.png'))
|
paraIcon.addPixmap(QPixmap(':/icons/parameter.png'))
|
||||||
|
deleteIcon = QIcon()
|
||||||
|
deleteIcon.addPixmap(QPixmap(':/icons/delete.png'))
|
||||||
self.inventoryIcon = QIcon()
|
self.inventoryIcon = QIcon()
|
||||||
self.inventoryIcon.addPixmap(QPixmap(':/icons/inventory.png'))
|
self.inventoryIcon.addPixmap(QPixmap(':/icons/inventory.png'))
|
||||||
self.mapIcon = QIcon()
|
self.mapIcon = QIcon()
|
||||||
@ -412,6 +414,10 @@ class MainWindow(QMainWindow):
|
|||||||
self.setParameter,
|
self.setParameter,
|
||||||
None, paraIcon,
|
None, paraIcon,
|
||||||
"Modify Parameter")
|
"Modify Parameter")
|
||||||
|
self.deleteAutopicksAction = self.createAction(self, "Delete Autopicks",
|
||||||
|
self.deleteAllAutopicks,
|
||||||
|
None, deleteIcon,
|
||||||
|
"Delete all automatic picks from Project.")
|
||||||
self.filterActionP = createAction(parent=self, text='Apply P Filter',
|
self.filterActionP = createAction(parent=self, text='Apply P Filter',
|
||||||
slot=self.filterP,
|
slot=self.filterP,
|
||||||
icon=self.filter_icon_p,
|
icon=self.filter_icon_p,
|
||||||
@ -567,7 +573,7 @@ class MainWindow(QMainWindow):
|
|||||||
prefsEventAction)
|
prefsEventAction)
|
||||||
# printAction) #TODO: print event?
|
# printAction) #TODO: print event?
|
||||||
|
|
||||||
pickMenuActions = (self.parameterAction,)
|
pickMenuActions = (self.parameterAction, self.deleteAutopicksAction)
|
||||||
self.pickMenu = self.menuBar().addMenu('&Picking')
|
self.pickMenu = self.menuBar().addMenu('&Picking')
|
||||||
self.autoPickMenu = self.pickMenu.addMenu(self.autopicksicon_small, 'Automatic picking')
|
self.autoPickMenu = self.pickMenu.addMenu(self.autopicksicon_small, 'Automatic picking')
|
||||||
self.autoPickMenu.setEnabled(False)
|
self.autoPickMenu.setEnabled(False)
|
||||||
@ -3629,6 +3635,22 @@ class MainWindow(QMainWindow):
|
|||||||
self.paraBox.params_to_gui()
|
self.paraBox.params_to_gui()
|
||||||
self.paraBox.show()
|
self.paraBox.show()
|
||||||
|
|
||||||
|
def deleteAllAutopicks(self):
|
||||||
|
qmb = QMessageBox(self, icon=QMessageBox.Question,
|
||||||
|
text='Are you sure you want to delete all automatic picks?')
|
||||||
|
qmb.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
|
||||||
|
qmb.setDefaultButton(QMessageBox.Yes)
|
||||||
|
ret = qmb.exec_()
|
||||||
|
if not ret == qmb.Yes:
|
||||||
|
return
|
||||||
|
for event in self.project.eventlist:
|
||||||
|
event.pylot_autopicks = {}
|
||||||
|
for index, pick in reversed(list(enumerate(event.picks))):
|
||||||
|
if pick.method_id.id.endswith('auto'):
|
||||||
|
event.picks.pop(index)
|
||||||
|
self.refreshEvents()
|
||||||
|
|
||||||
|
|
||||||
def PyLoTprefs(self):
|
def PyLoTprefs(self):
|
||||||
if not self._props:
|
if not self._props:
|
||||||
self._props = PropertiesDlg(self, infile=self.infile,
|
self._props = PropertiesDlg(self, infile=self.infile,
|
||||||
|
@ -770,9 +770,14 @@ class AutopickStation(object):
|
|||||||
:raises:
|
:raises:
|
||||||
MissingTraceException: If vertical trace is missing.
|
MissingTraceException: If vertical trace is missing.
|
||||||
"""
|
"""
|
||||||
|
try:
|
||||||
|
stream_string_repr = str(self.zstream)
|
||||||
|
except Exception as e:
|
||||||
|
stream_string_repr = None
|
||||||
|
print('Could not get string representation of Stream: {}'.format(e))
|
||||||
msg = '##################################################\nautopickstation:' \
|
msg = '##################################################\nautopickstation:' \
|
||||||
' Working on P onset of station {station}\nFiltering vertical ' \
|
' Working on P onset of station {station}\nFiltering vertical ' \
|
||||||
'trace ...\n{data}'.format(station=self.station_name, data=str(self.zstream))
|
'trace ...\n{data}'.format(station=self.station_name, data=stream_string_repr)
|
||||||
self.vprint(msg)
|
self.vprint(msg)
|
||||||
|
|
||||||
tr_filt, z_copy = self.prepare_wfstream(self.zstream, self.pickparams["bpz1"][0], self.pickparams["bpz1"][1])
|
tr_filt, z_copy = self.prepare_wfstream(self.zstream, self.pickparams["bpz1"][0], self.pickparams["bpz1"][1])
|
||||||
|
Loading…
Reference in New Issue
Block a user