[update] added missing function for refactor commit

This commit is contained in:
Marcel Paffrath 2020-01-14 14:03:13 +01:00
parent 78eca1b222
commit 6ad187b7fa
3 changed files with 28 additions and 26 deletions

View File

@ -76,10 +76,11 @@ from pylot.core.util.errors import DatastructureError, \
from pylot.core.util.connection import checkurl
from pylot.core.util.dataprocessing import Metadata, restitute_data
from pylot.core.util.utils import fnConstructor, getLogin, \
full_range, readFilterInformation, make_pen, pick_color_plt, \
full_range, readFilterInformation, pick_color_plt, \
pick_linestyle_plt, identifyPhaseID, excludeQualityClasses, \
transform_colors_mpl, transform_colors_mpl_str, getAutoFilteroptions, check_all_obspy, \
check_all_pylot, get_Bool, get_None, SetChannelComponents
from pylot.core.util.gui import make_pen
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, \

View File

@ -1,8 +1,11 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import pyqtgraph as pg
from PySide import QtCore
from pylot.core.util.utils import pick_color
def pick_linestyle_pg(picktype, key):
"""
@ -68,3 +71,25 @@ def which(program, parameter):
return candidate
return None
def make_pen(picktype, phase, key, quality):
"""
Make PyQtGraph.QPen
:param picktype: 'manual' or 'automatic'
:type picktype: str
:param phase: 'P' or 'S'
:type phase: str
:param key: 'mpp', 'epp', 'lpp' or 'spe', (earliest/latest possible pick, symmetric picking error or
most probable pick)
:type key: str
:param quality: quality class of pick, decides color modifier
:type quality: int
:return: PyQtGraph QPen
:rtype: `~QPen`
"""
if pg:
rgba = pick_color(picktype, phase, quality)
linestyle, width = pick_linestyle_pg(picktype, key)
pen = pg.mkPen(rgba, width=width, style=linestyle)
return pen

View File

@ -5,7 +5,6 @@ import hashlib
import numpy as np
import os
import platform
import pyqtgraph as pg
import re
import subprocess
import warnings
@ -15,7 +14,6 @@ from obspy.signal.rotate import rotate2zne
from scipy.interpolate import splrep, splev
from pylot.core.io.inputs import PylotParameter, FilterOptions
from pylot.core.util.gui import pick_linestyle_pg
from pylot.core.util.obspyDMT_interface import check_obspydmt_eventfolder
from pylot.styles import style_settings
@ -636,28 +634,6 @@ def find_horizontals(data):
return rval
def make_pen(picktype, phase, key, quality):
"""
Make PyQtGraph.QPen
:param picktype: 'manual' or 'automatic'
:type picktype: str
:param phase: 'P' or 'S'
:type phase: str
:param key: 'mpp', 'epp', 'lpp' or 'spe', (earliest/latest possible pick, symmetric picking error or
most probable pick)
:type key: str
:param quality: quality class of pick, decides color modifier
:type quality: int
:return: PyQtGraph QPen
:rtype: `~QPen`
"""
if pg:
rgba = pick_color(picktype, phase, quality)
linestyle, width = pick_linestyle_pg(picktype, key)
pen = pg.mkPen(rgba, width=width, style=linestyle)
return pen
def pick_color(picktype, phase, quality=0):
"""
Create pick color by modifying the base color by the quality.