Merge branch 'develop' of ariadne.geophysik.rub.de:/data/git/pylot into develop

This commit is contained in:
Ludger Küperkoch 2017-08-15 10:17:58 +02:00
commit cb38651898
3 changed files with 21 additions and 25 deletions

View File

@ -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.
@ -1941,11 +1945,6 @@ class MainWindow(QMainWindow):
else: else:
ax = self.getPlotWidget().axes ax = self.getPlotWidget().axes
ylims = np.array([-.5, +.5]) + plotID 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] stat_picks = self.getPicks(type=picktype)[station]
stime = self.getStime() stime = self.getStime()
@ -1956,13 +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'
if not self.pg:
colors = phase_col[phase[0].upper()]
mpp = picks['mpp'] - stime mpp = picks['mpp'] - stime
if picks['epp'] and picks['lpp']: if picks['epp'] and picks['lpp']:
@ -1979,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)
@ -2001,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))

View File

@ -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.

View File

@ -1697,16 +1697,11 @@ class PickDlg(QDialog):
ylims = self.getGlobalLimits('y') ylims = self.getGlobalLimits('y')
else: else:
ylims = self.getPlotWidget().getYLims() 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 self.getPicks(picktype):
if phase is not None: if phase is not None:
if (type(self.getPicks(picktype)[phase]) is dict if (type(self.getPicks(picktype)[phase]) is dict
or type(self.getPicks(picktype)[phase]) is AttribDict): or type(self.getPicks(picktype)[phase]) is AttribDict):
picks = self.getPicks(picktype)[phase] picks = self.getPicks(picktype)[phase]
colors = phase_col[self.getPhaseID(phase)]
elif phase is None: elif phase is None:
for phase in self.getPicks(picktype): for phase in self.getPicks(picktype):
self.drawPicks(phase, picktype, textOnly) self.drawPicks(phase, picktype, textOnly)
@ -1717,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:
@ -1731,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')
@ -1749,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')