Merge branch 'develop' of ariadne.geophysik.rub.de:/data/git/pylot into develop
This commit is contained in:
commit
cb38651898
30
QtPyLoT.py
30
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.
|
||||
@ -1941,11 +1945,6 @@ class MainWindow(QMainWindow):
|
||||
else:
|
||||
ax = self.getPlotWidget().axes
|
||||
ylims = np.array([-.5, +.5]) + plotID
|
||||
if not self.pg:
|
||||
phase_col = {
|
||||
'P': ('c', 'c--', 'b-', 'bv', 'b^', 'b'),
|
||||
'S': ('m', 'm--', 'r-', 'rv', 'r^', 'r')
|
||||
}
|
||||
|
||||
stat_picks = self.getPicks(type=picktype)[station]
|
||||
stime = self.getStime()
|
||||
@ -1956,13 +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'])
|
||||
|
||||
if not self.pg:
|
||||
colors = phase_col[phase[0].upper()]
|
||||
phaseID = 'S'
|
||||
|
||||
mpp = picks['mpp'] - stime
|
||||
if picks['epp'] and picks['lpp']:
|
||||
@ -1979,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)
|
||||
@ -2001,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))
|
||||
|
@ -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.
|
||||
|
@ -1697,16 +1697,11 @@ class PickDlg(QDialog):
|
||||
ylims = self.getGlobalLimits('y')
|
||||
else:
|
||||
ylims = self.getPlotWidget().getYLims()
|
||||
phase_col = {
|
||||
'P': ('c', 'c--', 'b-', 'bv', 'b^', 'b', 'c:'),
|
||||
'S': ('m', 'm--', 'r-', 'rv', 'r^', 'r', 'm:')
|
||||
}
|
||||
if self.getPicks(picktype):
|
||||
if phase is not None:
|
||||
if (type(self.getPicks(picktype)[phase]) is dict
|
||||
or type(self.getPicks(picktype)[phase]) is AttribDict):
|
||||
picks = self.getPicks(picktype)[phase]
|
||||
colors = phase_col[self.getPhaseID(phase)]
|
||||
elif phase is None:
|
||||
for phase in self.getPicks(picktype):
|
||||
self.drawPicks(phase, picktype, textOnly)
|
||||
@ -1717,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:
|
||||
@ -1731,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')
|
||||
@ -1749,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')
|
||||
|
Loading…
Reference in New Issue
Block a user