[add] new colors appl. to matplot, added quality
This commit is contained in:
parent
37373864ce
commit
0f61799024
29
QtPyLoT.py
29
QtPyLoT.py
@ -73,7 +73,7 @@ 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
|
full_range, readFilterInformation, trim_station_components, check4gaps, make_pen, pick_color_plt, pick_linestyle_plt
|
||||||
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, \
|
||||||
@ -2013,20 +2013,29 @@ class MainWindow(QMainWindow):
|
|||||||
raise TypeError('Unknown picktype {0}'.format(picktype))
|
raise TypeError('Unknown picktype {0}'.format(picktype))
|
||||||
else:
|
else:
|
||||||
if picktype == 'manual':
|
if picktype == 'manual':
|
||||||
|
linestyle_mpp, width_mpp = pick_linestyle_plt(picktype, 'mpp')
|
||||||
|
color = pick_color_plt(picktype, phase, 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=colors[0], label='EPP, LPP')
|
alpha=.25, color=color, label='EPP, LPP')
|
||||||
if spe:
|
if spe:
|
||||||
ax.plot([mpp - spe, mpp - spe], ylims, colors[1], label='{}-SPE'.format(phase))
|
linestyle_spe, width_spe = pick_linestyle_plt(picktype, 'spe')
|
||||||
ax.plot([mpp + spe, mpp + spe], ylims, colors[1])
|
ax.plot([mpp - spe, mpp - spe], ylims, color=color, linestyle=linestyle_spe,
|
||||||
ax.plot([mpp, mpp], ylims, colors[2], label='{}-Pick'.format(phase))
|
linewidth=width_spe, label='{}-SPE'.format(phase))
|
||||||
|
ax.plot([mpp + spe, mpp + spe], ylims, color=color, linestyle=linestyle_spe,
|
||||||
|
linewidth=width_spe)
|
||||||
|
ax.plot([mpp, mpp], ylims, color=color, linestyle=linestyle_mpp, linewidth=width_mpp,
|
||||||
|
label='{}-Pick (quality: {})'.format(phase, quality), picker=5)
|
||||||
else:
|
else:
|
||||||
ax.plot([mpp, mpp], ylims, colors[6], label='{}-Pick (NO PICKERROR)'.format(phase))
|
ax.plot([mpp, mpp], ylims, color=color, linestyle=linestyle_mpp, linewidth=width_mpp,
|
||||||
|
label='{}-Pick (NO PICKERROR)'.format(phase), picker=5)
|
||||||
elif picktype == 'auto':
|
elif picktype == 'auto':
|
||||||
if quality < 4:
|
color = pick_color_plt(picktype, phase, quality)
|
||||||
ax.plot(mpp, ylims[1], colors[3],
|
linestyle_mpp, width_mpp = pick_linestyle_plt(picktype, 'mpp')
|
||||||
mpp, ylims[0], colors[4])
|
ax.plot(mpp, ylims[1], color=color, marker='v')
|
||||||
ax.vlines(mpp, ylims[0], ylims[1], colors[5], linestyles='dotted')
|
ax.plot(mpp, ylims[0], color=color, marker='^')
|
||||||
|
ax.vlines(mpp, ylims[0], ylims[1], color=color, linestyle=linestyle_mpp, linewidth=width_mpp,
|
||||||
|
picker=5, label='{}-Autopick (quality: {})'.format(phase, quality))
|
||||||
else:
|
else:
|
||||||
raise TypeError('Unknown picktype {0}'.format(picktype))
|
raise TypeError('Unknown picktype {0}'.format(picktype))
|
||||||
|
|
||||||
|
@ -466,7 +466,7 @@ def find_horizontals(data):
|
|||||||
def make_pen(picktype, phase, key, quality):
|
def make_pen(picktype, phase, key, quality):
|
||||||
if pg:
|
if pg:
|
||||||
rgba = pick_color(picktype, phase, quality)
|
rgba = pick_color(picktype, phase, quality)
|
||||||
linestyle, width = pick_linestyle(picktype, key)
|
linestyle, width = pick_linestyle_pg(picktype, key)
|
||||||
pen = pg.mkPen(rgba, width=width, style=linestyle)
|
pen = pg.mkPen(rgba, width=width, style=linestyle)
|
||||||
return pen
|
return pen
|
||||||
|
|
||||||
@ -481,15 +481,36 @@ def pick_color(picktype, phase, quality=0):
|
|||||||
return rgba
|
return rgba
|
||||||
|
|
||||||
|
|
||||||
def pick_linestyle(picktype, key):
|
def pick_color_plt(picktype, phase, quality=0):
|
||||||
linestyles_manu = {'mpp': (QtCore.Qt.SolidLine, 3.),
|
rgba = list(pick_color(picktype, phase, quality))
|
||||||
|
for index, val in enumerate(rgba):
|
||||||
|
rgba[index] /= 255.
|
||||||
|
return rgba
|
||||||
|
|
||||||
|
|
||||||
|
def pick_linestyle_plt(picktype, key):
|
||||||
|
linestyles_manu = {'mpp': ('solid', 2.),
|
||||||
|
'epp': ('dashed', 1.),
|
||||||
|
'lpp': ('dashed', 1.),
|
||||||
|
'spe': ('dashed', 1.)}
|
||||||
|
linestyles_auto = {'mpp': ('dotted', 2.),
|
||||||
|
'epp': ('dashdot', 1.),
|
||||||
|
'lpp': ('dashdot', 1.),
|
||||||
|
'spe': ('dashdot', 1.)}
|
||||||
|
linestyles = {'manual': linestyles_manu,
|
||||||
|
'auto': linestyles_auto}
|
||||||
|
return linestyles[picktype][key]
|
||||||
|
|
||||||
|
|
||||||
|
def pick_linestyle_pg(picktype, key):
|
||||||
|
linestyles_manu = {'mpp': (QtCore.Qt.SolidLine, 2.),
|
||||||
'epp': (QtCore.Qt.DashLine, 1.),
|
'epp': (QtCore.Qt.DashLine, 1.),
|
||||||
'lpp': (QtCore.Qt.DashLine, 1.),
|
'lpp': (QtCore.Qt.DashLine, 1.),
|
||||||
'spe': (QtCore.Qt.DashLine, 1.)}
|
'spe': (QtCore.Qt.DashLine, 1.)}
|
||||||
linestyles_auto = {'mpp': (QtCore.Qt.DotLine, 3.),
|
linestyles_auto = {'mpp': (QtCore.Qt.DotLine, 2.),
|
||||||
'epp': (QtCore.Qt.DashDotDotLine, 1.),
|
'epp': (QtCore.Qt.DashDotLine, 1.),
|
||||||
'lpp': (QtCore.Qt.DashDotDotLine, 1.),
|
'lpp': (QtCore.Qt.DashDotLine, 1.),
|
||||||
'spe': (QtCore.Qt.DashDotDotLine, 1.)}
|
'spe': (QtCore.Qt.DashDotLine, 1.)}
|
||||||
linestyles = {'manual': linestyles_manu,
|
linestyles = {'manual': linestyles_manu,
|
||||||
'auto': linestyles_auto}
|
'auto': linestyles_auto}
|
||||||
return linestyles[picktype][key]
|
return linestyles[picktype][key]
|
||||||
|
@ -44,12 +44,12 @@ from obspy.taup.utils import get_phase_names
|
|||||||
from pylot.core.io.data import Data
|
from pylot.core.io.data import Data
|
||||||
from pylot.core.io.inputs import FilterOptions, PylotParameter
|
from pylot.core.io.inputs import FilterOptions, PylotParameter
|
||||||
from pylot.core.pick.utils import getSNR, earllatepicker, getnoisewin, \
|
from pylot.core.pick.utils import getSNR, earllatepicker, getnoisewin, \
|
||||||
getResolutionWindow
|
getResolutionWindow, getQualityfromUncertainty
|
||||||
from pylot.core.pick.compare import Comparison
|
from pylot.core.pick.compare import Comparison
|
||||||
from pylot.core.util.defaults import OUTPUTFORMATS, FILTERDEFAULTS, \
|
from pylot.core.util.defaults import OUTPUTFORMATS, FILTERDEFAULTS, \
|
||||||
SetChannelComponents
|
SetChannelComponents
|
||||||
from pylot.core.util.utils import prepTimeAxis, full_range, scaleWFData, \
|
from pylot.core.util.utils import prepTimeAxis, full_range, scaleWFData, \
|
||||||
demeanTrace, isSorted, findComboBoxIndex, clims
|
demeanTrace, isSorted, findComboBoxIndex, clims, pick_linestyle_plt, pick_color_plt
|
||||||
from autoPyLoT import autoPyLoT
|
from autoPyLoT import autoPyLoT
|
||||||
from pylot.core.util.thread import Thread
|
from pylot.core.util.thread import Thread
|
||||||
|
|
||||||
@ -1716,6 +1716,12 @@ class PickDlg(QDialog):
|
|||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# get quality classes
|
||||||
|
if phase[0] == 'P':
|
||||||
|
quality = getQualityfromUncertainty(picks['spe'], self.parameter['timeerrorsP'])
|
||||||
|
elif phase[0] == 'S':
|
||||||
|
quality = getQualityfromUncertainty(picks['spe'], self.parameter['timeerrorsS'])
|
||||||
|
|
||||||
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:
|
||||||
epp = picks['epp'] - self.getStartTime()
|
epp = picks['epp'] - self.getStartTime()
|
||||||
@ -1724,23 +1730,32 @@ class PickDlg(QDialog):
|
|||||||
|
|
||||||
if picktype == 'manual':
|
if picktype == 'manual':
|
||||||
if not textOnly:
|
if not textOnly:
|
||||||
|
linestyle_mpp, width_mpp = pick_linestyle_plt(picktype, 'mpp')
|
||||||
|
color = pick_color_plt(picktype, phase, 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=colors[0], label='EPP, LPP')
|
alpha=.25, color=color, label='EPP, LPP')
|
||||||
if spe:
|
if spe:
|
||||||
ax.plot([mpp - spe, mpp - spe], ylims, colors[1], label='{}-SPE'.format(phase))
|
linestyle_spe, width_spe = pick_linestyle_plt(picktype, 'spe')
|
||||||
ax.plot([mpp + spe, mpp + spe], ylims, colors[1])
|
ax.plot([mpp - spe, mpp - spe], ylims, color=color, linestyle=linestyle_spe,
|
||||||
ax.plot([mpp, mpp], ylims, colors[2], label='{}-Pick'.format(phase), picker=5)
|
linewidth=width_spe, label='{}-SPE'.format(phase))
|
||||||
|
ax.plot([mpp + spe, mpp + spe], ylims, color=color, linestyle=linestyle_spe,
|
||||||
|
linewidth=width_spe)
|
||||||
|
ax.plot([mpp, mpp], ylims, color=color, linestyle=linestyle_mpp, linewidth=width_mpp,
|
||||||
|
label='{}-Pick (quality: {})'.format(phase, quality), picker=5)
|
||||||
else:
|
else:
|
||||||
ax.plot([mpp, mpp], ylims, colors[6], label='{}-Pick (NO PICKERROR)'.format(phase), picker=5)
|
ax.plot([mpp, mpp], ylims, color=color, linestyle=linestyle_mpp, linewidth=width_mpp,
|
||||||
|
label='{}-Pick (NO PICKERROR)'.format(phase), picker=5)
|
||||||
# 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)
|
||||||
|
linestyle_mpp, width_mpp = pick_linestyle_plt(picktype, 'mpp')
|
||||||
if not textOnly:
|
if not textOnly:
|
||||||
ax.plot(mpp, ylims[1], colors[3],
|
ax.plot(mpp, ylims[1], color=color, marker='v')
|
||||||
mpp, ylims[0], colors[4])
|
ax.plot(mpp, ylims[0], color=color, marker='^')
|
||||||
ax.vlines(mpp, ylims[0], ylims[1], colors[5], linestyles='dotted',
|
ax.vlines(mpp, ylims[0], ylims[1], color=color, linestyle=linestyle_mpp, linewidth=width_mpp,
|
||||||
picker=5, label='{}-Pick (auto)'.format(phase))
|
picker=5, label='{}-Autopick (quality: {})'.format(phase, quality))
|
||||||
# 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))
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user