[bugfix] use identifyPhase instead of phase[0]
This commit is contained in:
parent
ff1ab722df
commit
4bb616492c
22
QtPyLoT.py
22
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.connection import checkurl
|
||||||
from pylot.core.util.dataprocessing import read_metadata, restitute_data
|
from pylot.core.util.dataprocessing import read_metadata, restitute_data
|
||||||
from pylot.core.util.utils import fnConstructor, getLogin, \
|
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.util.event import Event
|
||||||
from pylot.core.io.location import create_creation_info, create_event
|
from pylot.core.io.location import create_creation_info, create_event
|
||||||
from pylot.core.util.widgets import FilterOptionsDialog, NewEventDlg, \
|
from pylot.core.util.widgets import FilterOptionsDialog, NewEventDlg, \
|
||||||
@ -838,6 +839,9 @@ class MainWindow(QMainWindow):
|
|||||||
raise DatastructureError('not specified')
|
raise DatastructureError('not specified')
|
||||||
return fnames
|
return fnames
|
||||||
|
|
||||||
|
def getPhaseID(self, phase):
|
||||||
|
return identifyPhase(loopIdentifyPhase(phase))
|
||||||
|
|
||||||
def get_current_event(self, eventbox=None):
|
def get_current_event(self, eventbox=None):
|
||||||
'''
|
'''
|
||||||
Return event (type QtPylot.Event) currently selected in eventbox.
|
Return event (type QtPylot.Event) currently selected in eventbox.
|
||||||
@ -1951,10 +1955,12 @@ class MainWindow(QMainWindow):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# get quality classes
|
# get quality classes
|
||||||
if phase[0] == 'P':
|
if self.getPhaseID(phase) == 'P':
|
||||||
quality = getQualityfromUncertainty(picks['spe'], self._inputs['timeerrorsP'])
|
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'])
|
quality = getQualityfromUncertainty(picks['spe'], self._inputs['timeerrorsS'])
|
||||||
|
phaseID = 'S'
|
||||||
|
|
||||||
mpp = picks['mpp'] - stime
|
mpp = picks['mpp'] - stime
|
||||||
if picks['epp'] and picks['lpp']:
|
if picks['epp'] and picks['lpp']:
|
||||||
@ -1971,14 +1977,14 @@ class MainWindow(QMainWindow):
|
|||||||
if self.pg:
|
if self.pg:
|
||||||
if picktype == 'manual':
|
if picktype == 'manual':
|
||||||
if picks['epp'] and picks['lpp']:
|
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,
|
pw.plot([epp, epp], ylims,
|
||||||
alpha=.25, pen=pen, name='EPP')
|
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,
|
pw.plot([lpp, lpp], ylims,
|
||||||
alpha=.25, pen=pen, name='LPP')
|
alpha=.25, pen=pen, name='LPP')
|
||||||
if spe:
|
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,
|
# spe_l = pg.PlotDataItem([mpp - spe, mpp - spe], ylims, pen=pen,
|
||||||
# name='{}-SPE'.format(phase))
|
# name='{}-SPE'.format(phase))
|
||||||
# spe_r = pg.PlotDataItem([mpp + spe, mpp + spe], ylims, pen=pen)
|
# spe_r = pg.PlotDataItem([mpp + spe, mpp + spe], ylims, pen=pen)
|
||||||
@ -1993,13 +1999,13 @@ class MainWindow(QMainWindow):
|
|||||||
# fb = pw.addItem(fill)
|
# fb = pw.addItem(fill)
|
||||||
# except:
|
# except:
|
||||||
# print('Warning: drawPicks: Could not create fill for symmetric pick error.')
|
# 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))
|
pw.plot([mpp, mpp], ylims, pen=pen, name='{}-Pick'.format(phase))
|
||||||
else:
|
else:
|
||||||
pw.plot([mpp, mpp], ylims, pen=pen, name='{}-Pick (NO PICKERROR)'.format(phase))
|
pw.plot([mpp, mpp], ylims, pen=pen, name='{}-Pick (NO PICKERROR)'.format(phase))
|
||||||
elif picktype == 'auto':
|
elif picktype == 'auto':
|
||||||
if quality < 4:
|
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)
|
pw.plot([mpp, mpp], ylims, pen=pen)
|
||||||
else:
|
else:
|
||||||
raise TypeError('Unknown picktype {0}'.format(picktype))
|
raise TypeError('Unknown picktype {0}'.format(picktype))
|
||||||
|
@ -1097,6 +1097,7 @@ def checkZ4S(X, pick, zfac, checkwin, iplot, fig=None):
|
|||||||
plt.close(fig)
|
plt.close(fig)
|
||||||
return returnflag
|
return returnflag
|
||||||
|
|
||||||
|
|
||||||
def getQualityfromUncertainty(uncertainty, Errors):
|
def getQualityfromUncertainty(uncertainty, Errors):
|
||||||
'''Script to transform uncertainty into quality classes 0-4
|
'''Script to transform uncertainty into quality classes 0-4
|
||||||
regarding adjusted time errors Errors.
|
regarding adjusted time errors Errors.
|
||||||
|
@ -1712,10 +1712,12 @@ class PickDlg(QDialog):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# get quality classes
|
# get quality classes
|
||||||
if phase[0] == 'P':
|
if self.getPhaseID(phase) == 'P':
|
||||||
quality = getQualityfromUncertainty(picks['spe'], self.parameter['timeerrorsP'])
|
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'])
|
quality = getQualityfromUncertainty(picks['spe'], self.parameter['timeerrorsS'])
|
||||||
|
phaseID = 'S'
|
||||||
|
|
||||||
mpp = picks['mpp'] - self.getStartTime()
|
mpp = picks['mpp'] - self.getStartTime()
|
||||||
if picks['epp'] and picks['lpp'] and not textOnly:
|
if picks['epp'] and picks['lpp'] and not textOnly:
|
||||||
@ -1726,7 +1728,7 @@ class PickDlg(QDialog):
|
|||||||
if picktype == 'manual':
|
if picktype == 'manual':
|
||||||
if not textOnly:
|
if not textOnly:
|
||||||
linestyle_mpp, width_mpp = pick_linestyle_plt(picktype, 'mpp')
|
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']:
|
if picks['epp'] and picks['lpp']:
|
||||||
ax.fill_between([epp, lpp], ylims[0], ylims[1],
|
ax.fill_between([epp, lpp], ylims[0], ylims[1],
|
||||||
alpha=.25, color=color, label='EPP, LPP')
|
alpha=.25, color=color, label='EPP, LPP')
|
||||||
@ -1744,7 +1746,7 @@ class PickDlg(QDialog):
|
|||||||
# append phase text (if textOnly: draw with current ylims)
|
# append phase text (if textOnly: draw with current ylims)
|
||||||
self.phaseText.append(ax.text(mpp, ylims[1], phase))
|
self.phaseText.append(ax.text(mpp, ylims[1], phase))
|
||||||
elif picktype == 'auto':
|
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')
|
linestyle_mpp, width_mpp = pick_linestyle_plt(picktype, 'mpp')
|
||||||
if not textOnly:
|
if not textOnly:
|
||||||
ax.plot(mpp, ylims[1], color=color, marker='v')
|
ax.plot(mpp, ylims[1], color=color, marker='v')
|
||||||
|
Loading…
Reference in New Issue
Block a user