diff --git a/QtPyLoT.py b/QtPyLoT.py index 5286d8a8..19302281 100755 --- a/QtPyLoT.py +++ b/QtPyLoT.py @@ -73,7 +73,8 @@ from pylot.core.util.errors import FormatError, DatastructureError, \ from pylot.core.util.connection import checkurl from pylot.core.util.dataprocessing import read_metadata, restitute_data from pylot.core.util.utils import fnConstructor, getLogin, \ - full_range, readFilterInformation, trim_station_components, check4gaps, make_pen, pick_color_plt, pick_linestyle_plt + full_range, readFilterInformation, trim_station_components, check4gaps, make_pen, pick_color_plt, \ + pick_linestyle_plt, identifyPhase, loopIdentifyPhase from pylot.core.util.event import Event from pylot.core.io.location import create_creation_info, create_event from pylot.core.util.widgets import FilterOptionsDialog, NewEventDlg, \ @@ -838,6 +839,9 @@ class MainWindow(QMainWindow): raise DatastructureError('not specified') return fnames + def getPhaseID(self, phase): + return identifyPhase(loopIdentifyPhase(phase)) + def get_current_event(self, eventbox=None): ''' Return event (type QtPylot.Event) currently selected in eventbox. @@ -1951,10 +1955,12 @@ class MainWindow(QMainWindow): return # get quality classes - if phase[0] == 'P': + if self.getPhaseID(phase) == 'P': quality = getQualityfromUncertainty(picks['spe'], self._inputs['timeerrorsP']) - elif phase[0] == 'S': + phaseID = 'P' + elif self.getPhaseID(phase) == 'S': quality = getQualityfromUncertainty(picks['spe'], self._inputs['timeerrorsS']) + phaseID = 'S' mpp = picks['mpp'] - stime if picks['epp'] and picks['lpp']: @@ -1971,14 +1977,14 @@ class MainWindow(QMainWindow): if self.pg: if picktype == 'manual': if picks['epp'] and picks['lpp']: - pen = make_pen(picktype, phase[0], 'epp', quality) + pen = make_pen(picktype, phaseID, 'epp', quality) pw.plot([epp, epp], ylims, alpha=.25, pen=pen, name='EPP') - pen = make_pen(picktype, phase[0], 'lpp', quality) + pen = make_pen(picktype, phaseID, 'lpp', quality) pw.plot([lpp, lpp], ylims, alpha=.25, pen=pen, name='LPP') if spe: - # pen = make_pen(picktype, phase[0], 'spe', quality) + # pen = make_pen(picktype, phaseID, 'spe', quality) # spe_l = pg.PlotDataItem([mpp - spe, mpp - spe], ylims, pen=pen, # name='{}-SPE'.format(phase)) # spe_r = pg.PlotDataItem([mpp + spe, mpp + spe], ylims, pen=pen) @@ -1993,13 +1999,13 @@ class MainWindow(QMainWindow): # fb = pw.addItem(fill) # except: # print('Warning: drawPicks: Could not create fill for symmetric pick error.') - pen = make_pen(picktype, phase[0], 'mpp', quality) + pen = make_pen(picktype, phaseID, 'mpp', quality) pw.plot([mpp, mpp], ylims, pen=pen, name='{}-Pick'.format(phase)) else: pw.plot([mpp, mpp], ylims, pen=pen, name='{}-Pick (NO PICKERROR)'.format(phase)) elif picktype == 'auto': if quality < 4: - pen = make_pen(picktype, phase[0], 'mpp', quality) + pen = make_pen(picktype, phaseID, 'mpp', quality) pw.plot([mpp, mpp], ylims, pen=pen) else: raise TypeError('Unknown picktype {0}'.format(picktype)) diff --git a/pylot/core/pick/utils.py b/pylot/core/pick/utils.py index a9fcc73b..c024985f 100644 --- a/pylot/core/pick/utils.py +++ b/pylot/core/pick/utils.py @@ -1097,6 +1097,7 @@ def checkZ4S(X, pick, zfac, checkwin, iplot, fig=None): plt.close(fig) return returnflag + def getQualityfromUncertainty(uncertainty, Errors): '''Script to transform uncertainty into quality classes 0-4 regarding adjusted time errors Errors. diff --git a/pylot/core/util/widgets.py b/pylot/core/util/widgets.py index 0750f156..2e7c4493 100644 --- a/pylot/core/util/widgets.py +++ b/pylot/core/util/widgets.py @@ -1712,10 +1712,12 @@ class PickDlg(QDialog): return # get quality classes - if phase[0] == 'P': + if self.getPhaseID(phase) == 'P': quality = getQualityfromUncertainty(picks['spe'], self.parameter['timeerrorsP']) - elif phase[0] == 'S': + phaseID = 'P' + elif self.getPhaseID(phase) == 'S': quality = getQualityfromUncertainty(picks['spe'], self.parameter['timeerrorsS']) + phaseID = 'S' mpp = picks['mpp'] - self.getStartTime() if picks['epp'] and picks['lpp'] and not textOnly: @@ -1726,7 +1728,7 @@ class PickDlg(QDialog): if picktype == 'manual': if not textOnly: linestyle_mpp, width_mpp = pick_linestyle_plt(picktype, 'mpp') - color = pick_color_plt(picktype, phase, quality) + color = pick_color_plt(picktype, phaseID, quality) if picks['epp'] and picks['lpp']: ax.fill_between([epp, lpp], ylims[0], ylims[1], alpha=.25, color=color, label='EPP, LPP') @@ -1744,7 +1746,7 @@ class PickDlg(QDialog): # append phase text (if textOnly: draw with current ylims) self.phaseText.append(ax.text(mpp, ylims[1], phase)) elif picktype == 'auto': - color = pick_color_plt(picktype, phase, quality) + color = pick_color_plt(picktype, phaseID, quality) linestyle_mpp, width_mpp = pick_linestyle_plt(picktype, 'mpp') if not textOnly: ax.plot(mpp, ylims[1], color=color, marker='v')