Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
Darius Arnold 2017-09-15 11:38:06 +02:00
commit 219d2d0e5a
14 changed files with 9932 additions and 9809 deletions

View File

@ -74,7 +74,8 @@ 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, remove_underscores, check4doubled, identifyPhaseID, excludeQualityClasses, has_spe, check4rotated
pick_linestyle_plt, remove_underscores, check4doubled, identifyPhaseID, excludeQualityClasses, has_spe, \
check4rotated, transform_colors_mpl, transform_colors_mpl_str
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, \
@ -86,6 +87,8 @@ from pylot.core.util.structure import DATASTRUCTURE
from pylot.core.util.thread import Thread, Worker
from pylot.core.util.version import get_git_version as _getVersionString
from pylot.styles import style_settings
if sys.version_info.major == 3:
import icons_rc_3 as icons_rc
elif sys.version_info.major == 2:
@ -109,6 +112,7 @@ class MainWindow(QMainWindow):
print('Using default input file {}'.format(infile))
if os.path.isfile(infile) == False:
infile = QFileDialog().getOpenFileName(caption='Choose PyLoT-input file')
if not os.path.exists(infile[0]):
QMessageBox.warning(self, "PyLoT Warning",
"No PyLoT-input file declared!")
@ -139,12 +143,6 @@ class MainWindow(QMainWindow):
# default factor for dataplot e.g. enabling/disabling scrollarea
self.height_factor = 12
# default colors for ref/test event
self._colors = {
'ref': QtGui.QColor(200, 210, 230, 255),
'test': QtGui.QColor(200, 230, 200, 255)
}
# UI has to be set up before(!) children widgets are about to show up
self.createAction = createAction
# read settings
@ -173,6 +171,8 @@ class MainWindow(QMainWindow):
self.fnames = None
self._stime = None
structure_setting = settings.value("data/Structure", "PILOT")
if not structure_setting:
structure_setting = 'PILOT'
self.dataStructure = DATASTRUCTURE[structure_setting]()
self.seismicPhase = str(settings.value("phase", "P"))
if settings.value("data/dataRoot", None) is None:
@ -209,6 +209,8 @@ class MainWindow(QMainWindow):
except:
self.startTime = UTCDateTime()
self.init_styles()
pylot_icon = QIcon()
pylot_icon.addPixmap(QPixmap(':/icons/pylot.png'))
@ -550,6 +552,13 @@ class MainWindow(QMainWindow):
self.addActions(toolbars["autoPyLoT"], pickActions)
self.addActions(toolbars["LocationTools"], locationToolActions)
# init pyqtgraph
self.pg = pg
# init style
settings = QSettings()
style = settings.value('style')
self.set_style(style)
# add event combo box and ref/test buttons
self.eventBox = self.createEventBox()
@ -566,21 +575,20 @@ class MainWindow(QMainWindow):
self.eventBox.activated.connect(self.refreshEvents)
# add main tab widget
self.tabs = QTabWidget()
self.tabs = QTabWidget(self)
self._main_layout.addWidget(self.tabs)
self.tabs.currentChanged.connect(self.refreshTabs)
# add scroll area used in case number of traces gets too high
self.wf_scroll_area = QtGui.QScrollArea()
self.wf_scroll_area = QtGui.QScrollArea(self)
# create central matplotlib figure canvas widget
self.pg = pg
self.init_wfWidget()
# init main widgets for main tabs
wf_tab = QtGui.QWidget()
array_tab = QtGui.QWidget()
events_tab = QtGui.QWidget()
wf_tab = QtGui.QWidget(self)
array_tab = QtGui.QWidget(self)
events_tab = QtGui.QWidget(self)
# init main widgets layouts
self.wf_layout = QtGui.QVBoxLayout()
@ -623,8 +631,8 @@ class MainWindow(QMainWindow):
self.dataPlot = PylotCanvas(parent=self, connect_events=False, multicursor=True)
self.dataPlot.updateWidget(xlab, None, plottitle)
else:
self.pg = True
self.dataPlot = WaveformWidgetPG(parent=self, xlabel=xlab, ylabel=None,
self.pg = pg
self.dataPlot = WaveformWidgetPG(parent=self,
title=plottitle)
self.dataPlot.setCursor(Qt.CrossCursor)
self.wf_scroll_area.setWidget(self.dataPlot)
@ -635,7 +643,7 @@ class MainWindow(QMainWindow):
'''
Initiate/create buttons for assigning events containing manual picks to reference or test set.
'''
self.ref_event_button = QtGui.QPushButton('Ref')
self.ref_event_button = QtGui.QPushButton('Tune')
self.test_event_button = QtGui.QPushButton('Test')
self.ref_event_button.setToolTip('Set manual picks of current ' +
'event as reference picks for autopicker tuning.')
@ -643,8 +651,8 @@ class MainWindow(QMainWindow):
'event as test picks for autopicker testing.')
self.ref_event_button.setCheckable(True)
self.test_event_button.setCheckable(True)
self.set_button_color(self.ref_event_button, self._colors['ref'])
self.set_button_color(self.test_event_button, self._colors['test'])
self.set_button_border_color(self.ref_event_button, self._style['ref']['rgba'])
self.set_button_border_color(self.test_event_button, self._style['test']['rgba'])
self.ref_event_button.clicked.connect(self.toggleRef)
self.test_event_button.clicked.connect(self.toggleTest)
self.ref_event_button.setEnabled(False)
@ -662,6 +670,85 @@ class MainWindow(QMainWindow):
if event.key() == QtCore.Qt.Key.Key_Shift:
self._shift = False
def init_styles(self):
self._styles = {}
styles = ['default', 'dark', 'bright']
stylecolors = style_settings.stylecolors
for style in styles:
if style in stylecolors.keys():
self._styles[style] = stylecolors[style]
self._phasecolors = style_settings.phasecolors
for style, stylecolors in self._styles.items():
stylesheet = stylecolors['stylesheet']['filename']
if stylesheet:
stylesheet_file = open(stylesheet, 'r')
stylesheet = stylesheet_file.read()
stylesheet_file.close()
else:
stylesheet = self.styleSheet()
bg_color = stylecolors['background']['rgba']
line_color = stylecolors['linecolor']['rgba']
multcursor_color = stylecolors['multicursor']['rgba']
# transform to 0-1 values for mpl and update dict
stylecolors['background']['rgba_mpl'] = transform_colors_mpl(bg_color)
stylecolors['linecolor']['rgba_mpl'] = transform_colors_mpl(line_color)
multcursor_color = stylecolors['multicursor']['rgba_mpl'] = transform_colors_mpl(multcursor_color)
stylecolors['stylesheet'] = stylesheet
def set_style(self, stylename=None):
if not stylename:
stylename = 'default'
if not stylename in self._styles:
qmb = QMessageBox.warning(self, 'Could not find style',
'Could not find style with name {}. Using default.'.format(stylename))
self.set_style('default')
return
style = self._styles[stylename]
self._style = style
self._stylename = stylename
self.setStyleSheet(style['stylesheet'])
# colors for ref/test event
self._ref_test_colors = {
'ref': QtGui.QColor(*style['ref']['rgba']),
'test': QtGui.QColor(*style['test']['rgba']),
}
# plot colors
bg_color = style['background']['rgba']
bg_color_mpl_na = transform_colors_mpl_str(bg_color, no_alpha=True)
line_color = style['linecolor']['rgba']
line_color_mpl_na = transform_colors_mpl_str(line_color, no_alpha=True)
for param in matplotlib.rcParams:
if 'color' in param and matplotlib.rcParams[param] in ['k', 'black']:
matplotlib.rcParams[param] = line_color_mpl_na
matplotlib.rc('axes',
edgecolor=line_color_mpl_na,
facecolor=bg_color_mpl_na,
labelcolor=line_color_mpl_na)
matplotlib.rc('xtick',
color=line_color_mpl_na)
matplotlib.rc('ytick',
color=line_color_mpl_na)
matplotlib.rc('figure',
facecolor=bg_color_mpl_na)
if self.pg:
pg.setConfigOption('background', bg_color)
pg.setConfigOption('foreground', line_color)
settings = QSettings()
settings.setValue('style', stylename)
settings.sync()
@property
def metadata(self):
return self._metadata
@ -801,20 +888,27 @@ class MainWindow(QMainWindow):
def add_recentfile(self, event):
self.recentfiles.insert(0, event)
def set_button_color(self, button, color=None):
def set_button_border_color(self, button, color=None):
'''
Set background color of a button.
button: type = QtGui.QAbstractButton
color: type = QtGui.QColor or type = str (RGBA)
'''
if type(color) == QtGui.QColor:
button.setStyleSheet({'QPushButton{background-color:transparent}'})
palette = button.palette()
role = button.backgroundRole()
palette.setColor(role, color)
button.setPalette(palette)
button.setAutoFillBackground(True)
elif type(color) == str or not color:
button.setStyleSheet("background-color: {}".format(color))
elif type(color) == str:
button.setStyleSheet('QPushButton{border-color: %s}'
'QPushButton:checked{background-color: rgba%s}'% (color, color))
elif type(color) == tuple:
button.setStyleSheet('QPushButton{border-color: rgba%s}'
'QPushButton:checked{background-color: rgba%s}' % (str(color), str(color)))
elif not color:
button.setStyleSheet(self.orig_parent._style['stylesheet'])
def getWFFnames(self):
try:
@ -1090,9 +1184,9 @@ class MainWindow(QMainWindow):
item_ref = QtGui.QStandardItem() # str(event_ref))
item_test = QtGui.QStandardItem() # str(event_test))
if event_ref:
item_ref.setBackground(self._colors['ref'])
item_ref.setBackground(self._ref_test_colors['ref'])
if event_test:
item_test.setBackground(self._colors['test'])
item_test.setBackground(self._ref_test_colors['test'])
item_notes = QtGui.QStandardItem(event.notes)
openIcon = self.style().standardIcon(QStyle.SP_DirOpenIcon)
@ -1248,10 +1342,11 @@ class MainWindow(QMainWindow):
if len(eventdict) < 1:
return
# init event selection options for autopick
self.compareoptions =[('tune events', self.get_ref_events),
('test events', self.get_test_events),
('all (picked) events', self.get_manu_picked_events)]
self.compareoptions =[('tune events', self.get_ref_events, self._style['ref']['rgba']),
('test events', self.get_test_events, self._style['test']['rgba']),
('all (picked) events', self.get_manu_picked_events, None)]
self.cmpw = CompareEventsWidget(self, self.compareoptions, eventdict, comparisons)
self.cmpw.start.connect(self.compareMulti)
@ -1259,7 +1354,7 @@ class MainWindow(QMainWindow):
self.cmpw.show()
def compareMulti(self):
for key, func in self.compareoptions:
for key, func, color in self.compareoptions:
if self.cmpw.rb_dict[key].isChecked():
# if radio button is checked break for loop and use func
break
@ -1273,7 +1368,10 @@ class MainWindow(QMainWindow):
def buildMultiCompareWidget(self, eventlist):
global_comparison = Comparison(eventlist=eventlist)
compare_widget = ComparisonWidget(global_comparison, self)
compare_widget.setWindowTitle('Histograms for all selected events')
for events_name, rb in self.cmpw.rb_dict.items():
if rb.isChecked():
break
compare_widget.setWindowTitle('Histograms for {}'.format(events_name))
compare_widget.hideToolbar()
compare_widget.setHistboxChecked(True)
return compare_widget
@ -1461,7 +1559,7 @@ class MainWindow(QMainWindow):
check4gaps(wfdat)
check4doubled(wfdat)
# check for stations with rotated components
wfdat = check4rotated(wfdat, self.metadata)
wfdat = check4rotated(wfdat, self.metadata, verbosity=0)
# trim station components to same start value
trim_station_components(wfdat, trim_start=True, trim_end=False)
self._stime = full_range(self.get_data().getWFData())[0]
@ -1521,7 +1619,8 @@ class MainWindow(QMainWindow):
self.getPlotWidget().updateWidget()
plots = self.wfp_thread.data
for times, data in plots:
self.dataPlot.plotWidget.getPlotItem().plot(times, data, pen='k')
self.dataPlot.plotWidget.getPlotItem().plot(times, data,
pen=self.dataPlot.pen_linecolor)
self.dataPlot.reinitMoveProxy()
self.dataPlot.plotWidget.showAxis('left')
self.dataPlot.plotWidget.showAxis('bottom')
@ -1905,27 +2004,36 @@ class MainWindow(QMainWindow):
'el_S1pick',
'el_S2pick',
'refSpick',
'aicARHfig'
'aicARHfig',
'plot_style'
]
for key in self.fig_keys:
fig = Figure()
if key == 'plot_style':
fig = self._style
else:
fig = Figure()
self.fig_dict[key] = fig
def init_canvas_dict(self):
self.canvas_dict = {}
for key in self.fig_keys:
self.canvas_dict[key] = PylotCanvas(self.fig_dict[key])
if not key == 'plot_style':
self.canvas_dict[key] = PylotCanvas(self.fig_dict[key], parent=self)
def init_fig_dict_wadatijack(self, eventIDs):
self.fig_dict_wadatijack = {}
self.fig_keys_wadatijack = [
'jackknife',
'wadati'
'wadati',
'plot_style'
]
for eventID in eventIDs:
self.fig_dict_wadatijack[eventID] = {}
for key in self.fig_keys_wadatijack:
fig = Figure()
if key == 'plot_style':
fig = self._style
else:
fig = Figure()
self.fig_dict_wadatijack[eventID][key] = fig
def init_canvas_dict_wadatijack(self):
@ -1933,7 +2041,9 @@ class MainWindow(QMainWindow):
for eventID in self.fig_dict_wadatijack.keys():
self.canvas_dict_wadatijack[eventID] = {}
for key in self.fig_keys_wadatijack:
self.canvas_dict_wadatijack[eventID][key] = PylotCanvas(self.fig_dict_wadatijack[eventID][key])
if not key == 'plot_style':
self.canvas_dict_wadatijack[eventID][key] = PylotCanvas(self.fig_dict_wadatijack[eventID][key],
parent=self)
def tune_autopicker(self):
'''
@ -1975,11 +2085,11 @@ class MainWindow(QMainWindow):
return
# init event selection options for autopick
self.pickoptions =[('current event', self.get_current_event),
('tune events', self.get_ref_events),
('test events', self.get_test_events),
('all (picked) events', self.get_manu_picked_events),
('all events', self.get_all_events)]
self.pickoptions =[('current event', self.get_current_event, None),
('tune events', self.get_ref_events, self._style['ref']['rgba']),
('test events', self.get_test_events, self._style['test']['rgba']),
('all (picked) events', self.get_manu_picked_events, None),
('all events', self.get_all_events, None)]
self.listWidget = QListWidget()
self.setDirty(True)
@ -1991,7 +2101,7 @@ class MainWindow(QMainWindow):
self.apw.show()
def start_autopick(self):
for key, func in self.pickoptions:
for key, func, _ in self.pickoptions:
if self.apw.rb_dict[key].isChecked():
# if radio button is checked break for loop and use func
break
@ -2498,7 +2608,7 @@ class MainWindow(QMainWindow):
self.events_layout.removeWidget(self.event_table)
# init new qtable
self.event_table = QtGui.QTableWidget()
self.event_table = QtGui.QTableWidget(self)
self.event_table.setColumnCount(12)
self.event_table.setRowCount(len(eventlist))
self.event_table.setHorizontalHeaderLabels(['',
@ -2552,8 +2662,8 @@ class MainWindow(QMainWindow):
item_notes = QtGui.QTableWidgetItem()
# manipulate items
item_ref.setBackground(self._colors['ref'])
item_test.setBackground(self._colors['test'])
item_ref.setBackground(self._ref_test_colors['ref'])
item_test.setBackground(self._ref_test_colors['test'])
item_path.setText(event.path)
if hasattr(event, 'origins'):
if event.origins:
@ -2775,7 +2885,7 @@ class MainWindow(QMainWindow):
if not self.okToContinue():
return
if not fnm:
dlg = QFileDialog()
dlg = QFileDialog(parent=self)
fnm = dlg.getOpenFileName(self, 'Open project file...', filter='Pylot project (*.plp)')
if not fnm:
return
@ -2802,7 +2912,7 @@ class MainWindow(QMainWindow):
'''
Save back project to new pickle file.
'''
dlg = QFileDialog()
dlg = QFileDialog(self)
fnm = dlg.getSaveFileName(self, 'Create a new project file...', filter='Pylot project (*.plp)')
filename = fnm[0]
if not len(fnm[0]):
@ -2864,7 +2974,7 @@ class MainWindow(QMainWindow):
def setParameter(self, show=True):
if not self.paraBox:
self.paraBox = PylotParaBox(self._inputs)
self.paraBox = PylotParaBox(self._inputs, parent=self, windowflag=1)
self.paraBox.accepted.connect(self._setDirty)
self.paraBox.accepted.connect(self.filterOptionsFromParameter)
if show:
@ -3076,9 +3186,10 @@ def create_window():
if app is None:
app = QApplication(sys.argv)
app_created = True
app.setOrganizationName("QtPyLoT");
# set aplication/organization name, domain (important to do this BEFORE setupUI is called for correct QSettings)
app.setOrganizationName("Ruhr-University Bochum / BESTEC")
app.setOrganizationDomain("rub.de");
app.setApplicationName("RUB");
app.setApplicationName("PyLoT");
app.references = set()
# app.references.add(window)
# window.show()
@ -3087,6 +3198,7 @@ def create_window():
def main(args=None):
project_filename = None
#args.project_filename = 'C:/Shared/AlpArray/alparray_data/project_alparray_test.plp'
pylot_infile = None
if args:
if args.project_filename:
@ -3106,22 +3218,17 @@ def main(args=None):
# create the main window
pylot_form = MainWindow(infile=pylot_infile)
icon = QIcon()
pylot_form.setWindowIcon(icon)
pylot_form.setWindowIcon(app_icon)
pylot_form.setIconSize(QSize(60, 60))
splash.showMessage('Loading. Please wait ...')
pylot_app.processEvents()
# set Application Information
pylot_app.setOrganizationName("Ruhr-University Bochum / BESTEC")
pylot_app.setOrganizationDomain("rub.de")
pylot_app.processEvents()
pylot_app.setApplicationName("PyLoT")
# set other App information
pylot_app.setApplicationVersion(pylot_form.__version__)
pylot_app.setWindowIcon(app_icon)
pylot_app.processEvents()
splash.showMessage('Loading. Please wait ...')
pylot_app.processEvents()
# Show main window and run the app
pylot_form.showMaximized()
pylot_app.processEvents()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 39 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -64,8 +64,11 @@ def autopickevent(data, param, iplot=0, fig_dict=None, fig_dict_wadatijack=None,
print('iPlot Flag active: NO MULTIPROCESSING possible.')
return all_onsets
# rename str for ncores in case ncores == 0 (use all cores)
ncores_str = ncores if ncores != 0 else 'all available'
print('Autopickstation: Distribute autopicking for {} '
'stations on {} cores.'.format(len(input_tuples), ncores))
'stations on {} cores.'.format(len(input_tuples), ncores_str))
pool = gen_Pool(ncores)
result = pool.map(call_autopickstation, input_tuples)
@ -322,9 +325,11 @@ def autopickstation(wfstream, pickparam, verbose=False,
key = 'aicFig'
if fig_dict:
fig = fig_dict[key]
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
else:
fig = None
aicpick = AICPicker(aiccf, tsnrz, pickwinP, iplot, None, aictsmoothP, fig=fig)
linecolor = 'k'
aicpick = AICPicker(aiccf, tsnrz, pickwinP, iplot, None, aictsmoothP, fig=fig, linecolor=linecolor)
# add pstart and pstop to aic plot
if fig:
for ax in fig.axes:
@ -347,12 +352,14 @@ def autopickstation(wfstream, pickparam, verbose=False,
key = 'slength'
if fig_dict:
fig = fig_dict[key]
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
else:
fig = None
linecolor = 'k'
Pflag = checksignallength(zne, aicpick.getpick(), tsnrz,
minsiglength / 2,
nfacsl, minpercent, iplot,
fig)
fig, linecolor)
else:
# filter and taper horizontal traces
trH1_filt = edat.copy()
@ -369,12 +376,14 @@ def autopickstation(wfstream, pickparam, verbose=False,
zne += trH2_filt
if fig_dict:
fig = fig_dict['slength']
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
else:
fig = None
linecolor = 'k'
Pflag = checksignallength(zne, aicpick.getpick(), tsnrz,
minsiglength,
nfacsl, minpercent, iplot,
fig)
fig, linecolor)
if Pflag == 1:
# check for spuriously picked S onset
@ -387,10 +396,12 @@ def autopickstation(wfstream, pickparam, verbose=False,
if iplot > 1:
if fig_dict:
fig = fig_dict['checkZ4s']
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
else:
fig = None
linecolor = 'k'
Pflag = checkZ4S(zne, aicpick.getpick(), zfac,
tsnrz[2], iplot, fig)
tsnrz[2], iplot, fig, linecolor)
if Pflag == 0:
Pmarker = 'SinsteadP'
Pweight = 9
@ -442,10 +453,12 @@ def autopickstation(wfstream, pickparam, verbose=False,
algoP=algoP)
if fig_dict:
fig = fig_dict['refPpick']
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
else:
fig = None
linecolor = 'k'
refPpick = PragPicker(cf2, tsnrz, pickwinP, iplot, ausP, tsmoothP,
aicpick.getpick(), fig)
aicpick.getpick(), fig, linecolor)
mpickP = refPpick.getpick()
#############################################################
if mpickP is not None:
@ -454,10 +467,13 @@ def autopickstation(wfstream, pickparam, verbose=False,
if iplot:
if fig_dict:
fig = fig_dict['el_Ppick']
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
else:
fig = None
linecolor = 'k'
epickP, lpickP, Perror = earllatepicker(z_copy, nfacP, tsnrz,
mpickP, iplot, fig=fig)
mpickP, iplot, fig=fig,
linecolor=linecolor)
else:
epickP, lpickP, Perror = earllatepicker(z_copy, nfacP, tsnrz,
mpickP, iplot)
@ -487,9 +503,10 @@ def autopickstation(wfstream, pickparam, verbose=False,
if iplot:
if fig_dict:
fig = fig_dict['fm_picker']
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
else:
fig = None
FM = fmpicker(zdat, z_copy, fmpickwin, mpickP, iplot, fig)
FM = fmpicker(zdat, z_copy, fmpickwin, mpickP, iplot, fig, linecolor)
else:
FM = fmpicker(zdat, z_copy, fmpickwin, mpickP, iplot)
else:
@ -624,10 +641,12 @@ def autopickstation(wfstream, pickparam, verbose=False,
# of class AutoPicking
if fig_dict:
fig = fig_dict['aicARHfig']
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
else:
fig = None
linecolor = 'k'
aicarhpick = AICPicker(haiccf, tsnrh, pickwinS, iplot, None,
aictsmoothS, fig=fig)
aictsmoothS, fig=fig, linecolor=linecolor)
###############################################################
# go on with processing if AIC onset passes quality control
slope = aicarhpick.getSlope()
@ -686,10 +705,12 @@ def autopickstation(wfstream, pickparam, verbose=False,
# get refined onset time from CF2 using class Picker
if fig_dict:
fig = fig_dict['refSpick']
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
else:
fig = None
linecolor = 'k'
refSpick = PragPicker(arhcf2, tsnrh, pickwinS, iplot, ausS,
tsmoothS, aicarhpick.getpick(), fig)
tsmoothS, aicarhpick.getpick(), fig, linecolor)
mpickS = refSpick.getpick()
#############################################################
if mpickS is not None:
@ -699,12 +720,15 @@ def autopickstation(wfstream, pickparam, verbose=False,
if iplot:
if fig_dict:
fig = fig_dict['el_S1pick']
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
else:
fig = None
linecolor = 'k'
epickS1, lpickS1, Serror1 = earllatepicker(h_copy, nfacS,
tsnrh,
mpickS, iplot,
fig=fig)
fig=fig,
linecolor=linecolor)
else:
epickS1, lpickS1, Serror1 = earllatepicker(h_copy, nfacS,
tsnrh,
@ -714,12 +738,15 @@ def autopickstation(wfstream, pickparam, verbose=False,
if iplot:
if fig_dict:
fig = fig_dict['el_S2pick']
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
else:
fig = None
linecolor = ''
epickS2, lpickS2, Serror2 = earllatepicker(h_copy, nfacS,
tsnrh,
mpickS, iplot,
fig=fig)
fig=fig,
linecolor=linecolor)
else:
epickS2, lpickS2, Serror2 = earllatepicker(h_copy, nfacS,
tsnrh,
@ -828,8 +855,10 @@ def autopickstation(wfstream, pickparam, verbose=False,
if fig_dict == None or fig_dict == 'None':
fig = plt.figure()
plt_flag = 1
linecolor = 'k'
else:
fig = fig_dict['mainFig']
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
ax1 = fig.add_subplot(311)
tdata = np.arange(0, zdat[0].stats.npts / tr_filt.stats.sampling_rate,
tr_filt.stats.delta)
@ -837,7 +866,7 @@ def autopickstation(wfstream, pickparam, verbose=False,
wfldiff = len(tr_filt.data) - len(tdata)
if wfldiff < 0:
tdata = tdata[0:len(tdata) - abs(wfldiff)]
ax1.plot(tdata, tr_filt.data / max(tr_filt.data), 'k', label='Data')
ax1.plot(tdata, tr_filt.data / max(tr_filt.data), color=linecolor, linewidth=0.7, label='Data')
if Pweight < 4:
ax1.plot(cf1.getTimeArray(), cf1.getCF() / max(cf1.getCF()),
'b', label='CF1')
@ -896,7 +925,7 @@ def autopickstation(wfstream, pickparam, verbose=False,
wfldiff = len(trH1_filt.data) - len(th1data)
if wfldiff < 0:
th1data = th1data[0:len(th1data) - abs(wfldiff)]
ax2.plot(th1data, trH1_filt.data / max(trH1_filt.data), 'k', label='Data')
ax2.plot(th1data, trH1_filt.data / max(trH1_filt.data), color=linecolor, linewidth=0.7, label='Data')
if Pweight < 4:
ax2.plot(arhcf1.getTimeArray(),
arhcf1.getCF() / max(arhcf1.getCF()), 'b', label='CF1')
@ -945,7 +974,7 @@ def autopickstation(wfstream, pickparam, verbose=False,
wfldiff = len(trH2_filt.data) - len(th2data)
if wfldiff < 0:
th2data = th2data[0:len(th2data) - abs(wfldiff)]
ax3.plot(th2data, trH2_filt.data / max(trH2_filt.data), 'k', label='Data')
ax3.plot(th2data, trH2_filt.data / max(trH2_filt.data), color=linecolor, linewidth=0.7, label='Data')
if Pweight < 4:
p22, = ax3.plot(arhcf1.getTimeArray(),
arhcf1.getCF() / max(arhcf1.getCF()), 'b', label='CF1')

View File

@ -36,7 +36,7 @@ class AutoPicker(object):
warnings.simplefilter('ignore')
def __init__(self, cf, TSNR, PickWindow, iplot=0, aus=None, Tsmooth=None, Pick1=None, fig=None):
def __init__(self, cf, TSNR, PickWindow, iplot=0, aus=None, Tsmooth=None, Pick1=None, fig=None, linecolor='k'):
'''
:param: cf, characteristic function, on which the picking algorithm is applied
:type: `~pylot.core.pick.CharFuns.CharacteristicFunction` object
@ -63,7 +63,8 @@ class AutoPicker(object):
'''
assert isinstance(cf, CharacteristicFunction), "%s is not a CharacteristicFunction object" % str(cf)
self._linecolor = linecolor
self._pickcolor_p = 'b'
self.cf = cf.getCF()
self.Tcf = cf.getTimeArray()
self.Data = cf.getXCF()
@ -269,13 +270,13 @@ class AICPicker(AutoPicker):
print("Choose longer slope determination window!")
if self.iplot > 1:
if self.fig == None or self.fig == 'None':
fig = plt.figure() # self.iplot) ### WHY? MP MP
fig = plt.figure()
plt_flag = 1
else:
fig = self.fig
ax = fig.add_subplot(111)
x = self.Data[0].data
ax.plot(self.Tcf, x / max(x), 'k', label='(HOS-/AR-) Data')
ax.plot(self.Tcf, x / max(x), color=self._linecolor, linewidth=0.7, label='(HOS-/AR-) Data')
ax.plot(self.Tcf, aicsmooth / max(aicsmooth), 'r', label='Smoothed AIC-CF')
ax.legend(loc=1)
ax.set_xlabel('Time [s] since %s' % self.Data[0].stats.starttime)
@ -312,7 +313,7 @@ class AICPicker(AutoPicker):
x = self.Data[0].data
if len(self.Tcf) > len(self.Data[0].data): # why? LK
self.Tcf = self.Tcf[0:len(self.Tcf)-1]
ax1.plot(self.Tcf, x / max(x), 'k', label='(HOS-/AR-) Data')
ax1.plot(self.Tcf, x / max(x), color=self._linecolor, linewidth=0.7, label='(HOS-/AR-) Data')
ax1.plot(self.Tcf, aicsmooth / max(aicsmooth), 'r', label='Smoothed AIC-CF')
if self.Pick is not None:
ax1.plot([self.Pick, self.Pick], [-0.1, 0.5], 'b', linewidth=2, label='AIC-Pick')
@ -322,7 +323,7 @@ class AICPicker(AutoPicker):
if self.Pick is not None:
ax2 = fig.add_subplot(2, 1, 2, sharex=ax1)
ax2.plot(self.Tcf, x, 'k', label='Data')
ax2.plot(self.Tcf, x, color=self._linecolor, linewidth=0.7, label='Data')
ax1.axvspan(self.Tcf[inoise[0]], self.Tcf[inoise[-1]], color='y', alpha=0.2, lw=0, label='Noise Window')
ax1.axvspan(self.Tcf[isignal[0]], self.Tcf[isignal[-1]], color='b', alpha=0.2, lw=0,
label='Signal Window')
@ -478,10 +479,10 @@ class PragPicker(AutoPicker):
else:
fig = self.fig
ax = fig.add_subplot(111)
ax.plot(Tcfpick, cfipick, 'k', label='CF')
ax.plot(Tcfpick, cfipick, color=self._linecolor, linewidth=0.7, label='CF')
ax.plot(Tcfpick, cfsmoothipick, 'r', label='Smoothed CF')
if pickflag > 0:
ax.plot([self.Pick, self.Pick], [min(cfipick), max(cfipick)], 'b', linewidth=2, label='Pick')
ax.plot([self.Pick, self.Pick], [min(cfipick), max(cfipick)], self._pickcolor_p, linewidth=2, label='Pick')
ax.set_xlabel('Time [s] since %s' % self.Data[0].stats.starttime)
ax.set_yticks([])
ax.set_title(self.Data[0].stats.station)

View File

@ -15,7 +15,7 @@ import numpy as np
from obspy.core import Stream, UTCDateTime
def earllatepicker(X, nfac, TSNR, Pick1, iplot=0, verbosity=1, fig=None):
def earllatepicker(X, nfac, TSNR, Pick1, iplot=0, verbosity=1, fig=None, linecolor='k'):
'''
Function to derive earliest and latest possible pick after Diehl & Kissling (2009)
as reasonable uncertainties. Latest possible pick is based on noise level,
@ -131,16 +131,16 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=0, verbosity=1, fig=None):
fig = plt.figure() # iplot)
plt_flag = 1
ax = fig.add_subplot(111)
ax.plot(t, x, 'k', label='Data')
ax.plot(t, x, color=linecolor, linewidth=0.7, label='Data')
ax.axvspan(t[inoise[0]], t[inoise[-1]], color='y', alpha=0.2, lw=0, label='Noise Window')
ax.axvspan(t[isignal[0]], t[isignal[-1]], color='b', alpha=0.2, lw=0, label='Signal Window')
ax.plot([t[0], t[int(len(t)) - 1]], [nlevel, nlevel], '--k', label='Noise Level')
ax.plot([t[0], t[int(len(t)) - 1]], [nlevel, nlevel], color=linecolor, linewidth=0.7, linestyle='dashed', label='Noise Level')
ax.plot(t[pis[zc]], np.zeros(len(zc)), '*g',
markersize=14, label='Zero Crossings')
ax.plot([t[0], t[int(len(t)) - 1]], [-nlevel, -nlevel], '--k')
ax.plot([t[0], t[int(len(t)) - 1]], [-nlevel, -nlevel], color=linecolor, linewidth=0.7, linestyle='dashed')
ax.plot([Pick1, Pick1], [max(x), -max(x)], 'b', linewidth=2, label='mpp')
ax.plot([LPick, LPick], [max(x) / 2, -max(x) / 2], '--k', label='lpp')
ax.plot([EPick, EPick], [max(x) / 2, -max(x) / 2], '--k', label='epp')
ax.plot([LPick, LPick], [max(x) / 2, -max(x) / 2], color=linecolor, linewidth=0.7, linestyle='dashed', label='lpp')
ax.plot([EPick, EPick], [max(x) / 2, -max(x) / 2], color=linecolor, linewidth=0.7, linestyle='dashed', label='epp')
ax.plot([Pick1 + PickError, Pick1 + PickError],
[max(x) / 2, -max(x) / 2], 'r--', label='spe')
ax.plot([Pick1 - PickError, Pick1 - PickError],
@ -160,7 +160,7 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=0, verbosity=1, fig=None):
return EPick, LPick, PickError
def fmpicker(Xraw, Xfilt, pickwin, Pick, iplot=0, fig=None):
def fmpicker(Xraw, Xfilt, pickwin, Pick, iplot=0, fig=None, linecolor='k'):
'''
Function to derive first motion (polarity) of given phase onset Pick.
Calculation is based on zero crossings determined within time window pickwin
@ -324,7 +324,7 @@ def fmpicker(Xraw, Xfilt, pickwin, Pick, iplot=0, fig=None):
fig = plt.figure() # iplot)
plt_flag = 1
ax1 = fig.add_subplot(211)
ax1.plot(t, xraw, 'k')
ax1.plot(t, xraw, color=linecolor, linewidth=0.7)
ax1.plot([Pick, Pick], [max(xraw), -max(xraw)], 'b', linewidth=2, label='Pick')
if P1 is not None:
ax1.plot(t[islope1], xraw[islope1], label='Slope Window')
@ -338,7 +338,7 @@ def fmpicker(Xraw, Xfilt, pickwin, Pick, iplot=0, fig=None):
ax2 = fig.add_subplot(2, 1, 2, sharex=ax1)
ax2.set_title('First-Motion Determination, Filtered Data')
ax2.plot(t, xfilt, 'k')
ax2.plot(t, xfilt, color=linecolor, linewidth=0.7)
ax2.plot([Pick, Pick], [max(xfilt), -max(xfilt)], 'b',
linewidth=2)
if P2 is not None:
@ -589,7 +589,7 @@ def wadaticheck(pickdic, dttolerance, iplot=0, fig_dict=None):
Ppicks = []
Spicks = []
SPtimes = []
for key in pickdic:
for key in list(pickdic.keys()):
if pickdic[key]['P']['weight'] < 4 and pickdic[key]['S']['weight'] < 4:
# calculate S-P time
spt = pickdic[key]['S']['mpp'] - pickdic[key]['P']['mpp']
@ -619,16 +619,18 @@ def wadaticheck(pickdic, dttolerance, iplot=0, fig_dict=None):
# calculate deviations from Wadati regression
ii = 0
ibad = 0
for key in pickdic:
for key in list(pickdic.keys()):
if 'SPt' in pickdic[key]:
wddiff = abs(pickdic[key]['SPt'] - wdfit[ii])
ii += 1
# check, if deviation is larger than adjusted
if wddiff > dttolerance:
# mark onset and downgrade S-weight to 9
# (not used anymore)
marker = 'badWadatiCheck'
pickdic[key]['S']['weight'] = 9
# remove pick from dictionary
pickdic.pop(key)
# # mark onset and downgrade S-weight to 9
# # (not used anymore)
# marker = 'badWadatiCheck'
# pickdic[key]['S']['weight'] = 9
ibad += 1
else:
marker = 'goodWadatiCheck'
@ -639,7 +641,8 @@ def wadaticheck(pickdic, dttolerance, iplot=0, fig_dict=None):
checkedSPtime = pickdic[key]['S']['mpp'] - pickdic[key]['P']['mpp']
checkedSPtimes.append(checkedSPtime)
pickdic[key]['S']['marked'] = marker
pickdic[key]['S']['marked'] = marker
#pickdic[key]['S']['marked'] = marker
if len(checkedPpicks) >= 3:
# calculate new slope
@ -668,15 +671,18 @@ def wadaticheck(pickdic, dttolerance, iplot=0, fig_dict=None):
if iplot > 0:
if fig_dict:
fig = fig_dict['wadati']
linecolor = fig_dict['plot_style']['linecolor']['rgba_mpl']
plt_flag = 0
else:
fig = plt.figure()
linecolor = 'k'
plt_flag = 1
ax = fig.add_subplot(111)
ax.plot(Ppicks, SPtimes, 'ro', label='Skipped S-Picks')
if wfitflag == 0:
ax.plot(Ppicks, wdfit, 'k', label='Wadati 1')
ax.plot(checkedPpicks, checkedSPtimes, 'ko', label='Reliable S-Picks')
ax.plot(Ppicks, wdfit, color=linecolor, linewidth=0.7, label='Wadati 1')
ax.plot(checkedPpicks, checkedSPtimes, color=linecolor,
linewidth=0, marker='o', label='Reliable S-Picks')
ax.plot(checkedPpicks, wdfit2, 'g', label='Wadati 2')
ax.set_title('Wadati-Diagram, %d S-P Times, Vp/Vs(raw)=%5.2f,' \
'Vp/Vs(checked)=%5.2f' % (len(SPtimes), vpvsr, cvpvsr))
@ -699,7 +705,7 @@ def RMS(X):
return np.sqrt(np.sum(np.power(X, 2)) / len(X))
def checksignallength(X, pick, TSNR, minsiglength, nfac, minpercent, iplot=0, fig=None):
def checksignallength(X, pick, TSNR, minsiglength, nfac, minpercent, iplot=0, fig=None, linecolor='k'):
'''
Function to detect spuriously picked noise peaks.
Uses RMS trace of all 3 components (if available) to determine,
@ -785,7 +791,7 @@ def checksignallength(X, pick, TSNR, minsiglength, nfac, minpercent, iplot=0, fi
fig = plt.figure() # iplot)
plt_flag = 1
ax = fig.add_subplot(111)
ax.plot(t, rms, 'k', label='RMS Data')
ax.plot(t, rms, color=linecolor, linewidth=0.7, label='RMS Data')
ax.axvspan(t[inoise[0]], t[inoise[-1]], color='y', alpha=0.2, lw=0, label='Noise Window')
ax.axvspan(t[isignal[0]], t[isignal[-1]], color='b', alpha=0.2, lw=0, label='Signal Window')
ax.plot([t[isignal[0]], t[isignal[len(isignal) - 1]]],
@ -870,15 +876,21 @@ def checkPonsets(pickdic, dttolerance, jackfactor=5, iplot=0, fig_dict=None):
# mark P onset as checked and keep P weight
pickdic[goodstations[i]]['P']['marked'] = goodmarker
for i in range(0, len(badstations)):
# mark P onset and downgrade P weight to 9
# (not used anymore)
pickdic[badstations[i]]['P']['marked'] = badmarker
pickdic[badstations[i]]['P']['weight'] = 9
# remove pick from dictionary
pickdic.pop(badstations[i])
for i in range(0, len(badjkstations)):
# mark P onset and downgrade P weight to 9
# (not used anymore)
pickdic[badjkstations[i]]['P']['marked'] = badjkmarker
pickdic[badjkstations[i]]['P']['weight'] = 9
# remove pick from dictionary
pickdic.pop(badjkstations[i])
# for i in range(0, len(badstations)):
# # mark P onset and downgrade P weight to 9
# # (not used anymore)
# pickdic[badstations[i]]['P']['marked'] = badmarker
# pickdic[badstations[i]]['P']['weight'] = 9
# for i in range(0, len(badjkstations)):
# # mark P onset and downgrade P weight to 9
# # (not used anymore)
# pickdic[badjkstations[i]]['P']['marked'] = badjkmarker
# pickdic[badjkstations[i]]['P']['weight'] = 9
checkedonsets = pickdic
@ -975,7 +987,7 @@ def jackknife(X, phi, h):
return PHI_jack, PHI_pseudo, PHI_sub
def checkZ4S(X, pick, zfac, checkwin, iplot, fig=None):
def checkZ4S(X, pick, zfac, checkwin, iplot, fig=None, linecolor='k'):
'''
Function to compare energy content of vertical trace with
energy content of horizontal traces to detect spuriously
@ -1103,7 +1115,7 @@ def checkZ4S(X, pick, zfac, checkwin, iplot, fig=None):
plt_flag = 1
ax = fig.add_subplot(3, 1, i + 1, sharex=ax1)
ax.plot(t, abs(trace.data), color='b', label='abs')
ax.plot(t, trace.data, color='k')
ax.plot(t, trace.data, color=linecolor, linewidth=0.7)
name = str(trace.stats.channel) + ': {}'.format(rms)
ax.plot([pick, pick + checkwin], [rms, rms], 'r', label='RMS {}'.format(name))
ax.plot([pick, pick], ax.get_ylim(), 'm', label='Pick')

View File

@ -14,6 +14,7 @@ from obspy.signal.rotate import rotate2zne
from obspy.io.xseed.utils import SEEDParserException
from pylot.core.io.inputs import PylotParameter
from pylot.styles import style_settings
from scipy.interpolate import splrep, splev
from PySide import QtCore, QtGui
@ -71,6 +72,8 @@ def gen_Pool(ncores=0):
if ncores == 0:
ncores = multiprocessing.cpu_count()
print('gen_Pool: Generated multiprocessing Pool with {} cores\n'.format(ncores))
pool = multiprocessing.Pool(ncores)
return pool
@ -577,36 +580,22 @@ def modify_rgba(rgba, modifier, intensity):
def base_phase_colors(picktype, phase):
phases = {
'manual':
{
'P':
{
'rgba': (0, 0, 255, 255),
'modifier': 'g'
},
'S':
{
'rgba': (255, 0, 0, 255),
'modifier': 'b'
}
},
'auto':
{
'P':
{
'rgba': (140, 0, 255, 255),
'modifier': 'g'
},
'S':
{
'rgba': (255, 140, 0, 255),
'modifier': 'b'
}
}
}
return phases[picktype][phase]
phasecolors = style_settings.phasecolors
return phasecolors[picktype][phase]
def transform_colors_mpl_str(colors, no_alpha=False):
colors = list(colors)
colors_mpl = tuple([color / 255. for color in colors])
if no_alpha:
colors_mpl = '({}, {}, {})'.format(*colors_mpl)
else:
colors_mpl = '({}, {}, {}, {})'.format(*colors_mpl)
return colors_mpl
def transform_colors_mpl(colors):
colors = list(colors)
colors_mpl = tuple([color / 255. for color in colors])
return colors_mpl
def remove_underscores(data):
"""
@ -702,7 +691,7 @@ def get_stations(data):
return stations
def check4rotated(data, metadata=None):
def check4rotated(data, metadata=None, verbosity=1):
def rotate_components(wfstream, metadata=None):
"""rotates components if orientation code is numeric.
@ -711,13 +700,15 @@ def check4rotated(data, metadata=None):
# indexing fails if metadata is None
metadata[0]
except:
msg = 'Warning: could not rotate traces since no metadata was given\nset Inventory file!'
print(msg)
if verbosity:
msg = 'Warning: could not rotate traces since no metadata was given\nset Inventory file!'
print(msg)
return wfstream
if metadata[0] is None:
# sometimes metadata is (None, (None,))
msg = 'Warning: could not rotate traces since no metadata was given\nCheck inventory directory!'
print(msg)
if verbosity:
msg = 'Warning: could not rotate traces since no metadata was given\nCheck inventory directory!'
print(msg)
return wfstream
else:
parser = metadata[1]

View File

@ -16,11 +16,6 @@ import time
import numpy as np
try:
import pyqtgraph as pg
except:
pg = None
from matplotlib.figure import Figure
from pylot.core.util.utils import find_horizontals, identifyPhase, loopIdentifyPhase, trim_station_components, \
identifyPhaseID, check4rotated
@ -64,12 +59,6 @@ elif sys.version_info.major == 2:
else:
raise ImportError('Could not determine python version.')
if pg:
pg.setConfigOption('background', 'w')
pg.setConfigOption('foreground', 'k')
pg.setConfigOptions(antialias=True)
# pg.setConfigOption('leftButtonPan', False)
def getDataType(parent):
type = QInputDialog().getItem(parent, "Select phases type", "Type:",
@ -435,29 +424,32 @@ class PlotWidget(FigureCanvas):
class WaveformWidgetPG(QtGui.QWidget):
def __init__(self, parent=None, xlabel='x', ylabel='y', title='Title'):
QtGui.QWidget.__init__(self, parent) # , 1)
self.setParent(parent)
self._parent = parent
def __init__(self, parent, title='Title'):
QtGui.QWidget.__init__(self, parent=parent)
self.pg = self.parent().pg
# added because adding widget to scrollArea will set scrollArea to parent
self.orig_parent = parent
# attribute plotdict is a dictionary connecting position and a name
self.plotdict = dict()
# create plot
self.main_layout = QtGui.QVBoxLayout()
self.label = QtGui.QLabel()
self.setLayout(self.main_layout)
self.plotWidget = pg.PlotWidget(title=title, autoDownsample=True)
self.plotWidget = self.pg.PlotWidget(self.parent(), title=title, autoDownsample=True)
self.main_layout.addWidget(self.plotWidget)
self.main_layout.addWidget(self.label)
self.plotWidget.showGrid(x=False, y=True, alpha=0.2)
self.plotWidget.showGrid(x=False, y=True, alpha=0.3)
self.plotWidget.hideAxis('bottom')
self.plotWidget.hideAxis('left')
self.wfstart, self.wfend = 0, 0
self.pen_multicursor = self.pg.mkPen(self.parent()._style['multicursor']['rgba'])
self.pen_linecolor = self.pg.mkPen(self.parent()._style['linecolor']['rgba'])
self.reinitMoveProxy()
self._proxy = pg.SignalProxy(self.plotWidget.scene().sigMouseMoved, rateLimit=60, slot=self.mouseMoved)
self._proxy = self.pg.SignalProxy(self.plotWidget.scene().sigMouseMoved, rateLimit=60, slot=self.mouseMoved)
def reinitMoveProxy(self):
self.vLine = pg.InfiniteLine(angle=90, movable=False)
self.hLine = pg.InfiniteLine(angle=0, movable=False)
self.vLine = self.pg.InfiniteLine(angle=90, movable=False, pen=self.pen_multicursor)
self.hLine = self.pg.InfiniteLine(angle=0, movable=False, pen=self.pen_multicursor)
self.plotWidget.addItem(self.vLine, ignoreBounds=True)
self.plotWidget.addItem(self.hLine, ignoreBounds=True)
@ -467,10 +459,10 @@ class WaveformWidgetPG(QtGui.QWidget):
mousePoint = self.plotWidget.getPlotItem().vb.mapSceneToView(pos)
x, y, = (mousePoint.x(), mousePoint.y())
# if x > 0:# and index < len(data1):
wfID = self._parent.getWFID(y)
station = self._parent.getStationName(wfID)
wfID = self.orig_parent.getWFID(y)
station = self.orig_parent.getStationName(wfID)
abstime = self.wfstart + x
if self._parent.get_current_event():
if self.orig_parent.get_current_event():
self.label.setText("station = {}, T = {}, t = {} [s]".format(station, abstime, x))
self.vLine.setPos(mousePoint.x())
self.hLine.setPos(mousePoint.y())
@ -484,12 +476,6 @@ class WaveformWidgetPG(QtGui.QWidget):
def clearPlotDict(self):
self.plotdict = dict()
def getParent(self):
return self._parent
def setParent(self, parent):
self._parent = parent
def plotWFData(self, wfdata, title=None, zoomx=None, zoomy=None,
noiselevel=None, scaleddata=False, mapping=True,
component='*', nth_sample=1, iniPick=None, verbosity=0):
@ -610,7 +596,6 @@ class WaveformWidgetPG(QtGui.QWidget):
class PylotCanvas(FigureCanvas):
def __init__(self, figure=None, parent=None, connect_events=True, multicursor=False,
panZoomX=True, panZoomY=True):
self._parent = parent
if not figure:
figure = Figure()
# create axes
@ -618,17 +603,18 @@ class PylotCanvas(FigureCanvas):
self.axes = figure.axes
self.figure = figure
self.figure.set_facecolor((1., 1., 1.))
self.figure.set_facecolor(parent._style['background']['rgba_mpl'])
# attribute plotdict is a dictionary connecting position and a name
self.plotdict = dict()
# initialize super class
super(PylotCanvas, self).__init__(self.figure)
self.setParent(parent)
if multicursor:
# add a cursor for station selection
self.multiCursor = MultiCursor(self.figure.canvas, self.axes,
horizOn=True, useblit=True,
color='m', lw=1)
color=parent._style['multicursor']['rgba_mpl'], lw=1)
# initialize panning attributes
self.press = None
@ -743,7 +729,7 @@ class PylotCanvas(FigureCanvas):
def saveFigure(self):
if self.figure:
fd = QtGui.QFileDialog()
fname, filter = fd.getSaveFileName(self._parent, filter='Images (*.png)')
fname, filter = fd.getSaveFileName(self.parent(), filter='Images (*.png)')
if not fname:
return
if not fname.endswith('.png'):
@ -884,12 +870,6 @@ class PylotCanvas(FigureCanvas):
def clearPlotDict(self):
self.plotdict = dict()
def getParent(self):
return self._parent
def setParent(self, parent):
self._parent = parent
def plotWFData(self, wfdata, title=None, zoomx=None, zoomy=None,
noiselevel=None, scaleddata=False, mapping=True,
component='*', nth_sample=1, iniPick=None, verbosity=0):
@ -922,6 +902,9 @@ class PylotCanvas(FigureCanvas):
nsc.sort()
nsc.reverse()
style = self.parent()._style
linecolor = style['linecolor']['rgba_mpl']
for n, (network, station, channel) in enumerate(nsc):
st = st_select.select(network=network, station=station, channel=channel)
trace = st[0]
@ -942,11 +925,13 @@ class PylotCanvas(FigureCanvas):
trace.normalize(np.max(np.abs(trace.data)) * 2)
times = [time for index, time in enumerate(time_ax) if not index % nth_sample]
data = [datum + n for index, datum in enumerate(trace.data) if not index % nth_sample]
ax.plot(times, data, 'k', linewidth=0.7)
ax.plot(times, data, color=linecolor, linewidth=0.7)
if noiselevel is not None:
for level in noiselevel:
ax.plot([time_ax[0], time_ax[-1]],
[level, level], '--k')
[level, level],
color = linecolor,
linestyle = 'dashed')
self.setPlotDict(n, (station, channel, network))
if iniPick:
ax.vlines(iniPick, ax.get_ylim()[0], ax.get_ylim()[1],
@ -1109,7 +1094,8 @@ class PickDlg(QDialog):
def __init__(self, parent=None, data=None, station=None, network=None, picks=None,
autopicks=None, rotate=False, parameter=None, embedded=False, metadata=None,
event=None, filteroptions=None, model='iasp91'):
super(PickDlg, self).__init__(parent)
super(PickDlg, self).__init__(parent, 1)
self.orig_parent = parent
# initialize attributes
self.parameter = parameter
@ -1129,6 +1115,7 @@ class PickDlg(QDialog):
pylot_user = getpass.getuser()
self._user = settings.value('user/Login', pylot_user)
self._dirty = False
self._style = parent._style
if picks:
self.picks = copy.deepcopy(picks)
self._init_picks = picks
@ -1208,6 +1195,7 @@ class PickDlg(QDialog):
# init pick delete (with right click)
self.connect_pick_delete()
self.setWindowTitle('Pickwindow on station: {}'.format(self.getStation()))
def setupUi(self):
menuBar = QtGui.QMenuBar(self)
@ -1396,7 +1384,7 @@ class PickDlg(QDialog):
return
ax = self.multicompfig.axes[0]
if not textOnly:
ylims = self.getGlobalLimits('y')
ylims = self.getGlobalLimits(ax, 'y')
else:
ylims = self.multicompfig.getYLims(ax)
stime = self.getStartTime()
@ -1524,36 +1512,46 @@ class PickDlg(QDialog):
self.leave_picking_mode()
def init_p_pick(self):
self.set_button_color(self.p_button, 'yellow')
self.set_button_border_color(self.p_button, 'yellow')
self.activatePicking()
self.currentPhase = str(self.p_button.text())
def init_s_pick(self):
self.set_button_color(self.s_button, 'yellow')
self.set_button_border_color(self.s_button, 'yellow')
self.activatePicking()
self.currentPhase = str(self.s_button.text())
def getPhaseID(self, phase):
return identifyPhaseID(phase)
def set_button_color(self, button, color=None):
def set_button_border_color(self, button, color=None):
'''
Set background color of a button.
button: type = QtGui.QAbstractButton
color: type = QtGui.QColor or type = str (RGBA)
'''
if type(color) == QtGui.QColor:
button.setStyleSheet({'QPushButton{background-color:transparent}'})
palette = button.palette()
role = button.backgroundRole()
palette.setColor(role, color)
button.setPalette(palette)
button.setAutoFillBackground(True)
elif type(color) == str or not color:
button.setStyleSheet("background-color: {}".format(color))
elif type(color) == str:
button.setStyleSheet('QPushButton{border-color: %s}' % color)
elif type(color) == tuple:
button.setStyleSheet('QPushButton{border-color: rgba%s}' % str(color))
elif not color:
button.setStyleSheet(self.orig_parent._style['stylesheet'])
def reset_p_button(self):
self.set_button_color(self.p_button)
self.set_button_border_color(self.p_button)
self.p_button.setEnabled(True)
self.p_button.setChecked(False)
self.p_button.setText('P')
def reset_s_button(self):
self.set_button_color(self.s_button)
self.set_button_border_color(self.s_button)
self.s_button.setEnabled(True)
self.s_button.setChecked(False)
self.s_button.setText('S')
@ -1637,8 +1635,8 @@ class PickDlg(QDialog):
def setYLims(self, limits):
self.cur_ylim = limits
def getGlobalLimits(self, axis):
return self.multicompfig.getGlobalLimits(axis)
def getGlobalLimits(self, ax, axis):
return self.multicompfig.getGlobalLimits(ax, axis)
def getWFData(self):
return self.data
@ -1692,10 +1690,10 @@ class PickDlg(QDialog):
self.cidpress = self.multicompfig.connectPressEvent(self.setPick)
if self.getPhaseID(self.currentPhase) == 'P':
self.set_button_color(self.p_button, 'green')
self.set_button_border_color(self.p_button, 'green')
self.setIniPickP(gui_event, wfdata, trace_number)
elif self.getPhaseID(self.currentPhase) == 'S':
self.set_button_color(self.s_button, 'green')
self.set_button_border_color(self.s_button, 'green')
self.setIniPickS(gui_event, wfdata)
self.zoomAction.setEnabled(False)
@ -2234,9 +2232,20 @@ class MultiEventWidget(QWidget):
self.start_button = QtGui.QPushButton('Start')
for index, (key, func) in enumerate(self.options):
for index, (key, func, color) in enumerate(self.options):
rb = QtGui.QRadioButton(key)
rb.toggled.connect(self.check_rb_selection)
if color:
color = 'rgba{}'.format(color)
else:
color = 'transparent'
rb.setStyleSheet('QRadioButton{'
'background-color: %s;'
'border-style:outset;'
'border-width:1px;'
'border-radius:5px;'
'padding:5px;'
'}' % str(color))
if index == 0:
rb.setChecked(True)
self.rb_dict[key] = rb
@ -2251,7 +2260,7 @@ class MultiEventWidget(QWidget):
self.main_layout.insertLayout(0, self.rb_layout)
def refresh_tooltips(self):
for key, func in self.options:
for key, func, color in self.options:
eventlist = func()
if not type(eventlist) == list:
eventlist = [eventlist]
@ -2437,11 +2446,10 @@ class TuneAutopicker(QWidget):
def __init__(self, parent):
QtGui.QWidget.__init__(self, parent, 1)
self.parent = parent
self.setParent(parent)
self._style = parent._style
self.setWindowTitle('PyLoT - Tune Autopicker')
self.parameter = parent._inputs
self.fig_dict = parent.fig_dict
self.parameter = self.parent()._inputs
self.fig_dict = self.parent().fig_dict
self.data = Data()
self.init_main_layouts()
self.init_eventlist()
@ -2454,8 +2462,8 @@ class TuneAutopicker(QWidget):
self.add_log()
self.set_stretch()
self.resize(1280, 720)
if hasattr(parent, 'metadata'):
self.metadata = self.parent.metadata
if hasattr(self.parent(), 'metadata'):
self.metadata = self.parent().metadata
else:
self.metadata = None
# self.setWindowModality(QtCore.Qt.WindowModality.ApplicationModal)
@ -2472,7 +2480,7 @@ class TuneAutopicker(QWidget):
self.setLayout(self.main_layout)
def init_eventlist(self):
self.eventBox = self.parent.createEventBox()
self.eventBox = self.parent().createEventBox()
self.eventBox.setMaxVisibleItems(20)
self.fill_eventbox()
self.trace_layout.addWidget(self.eventBox)
@ -2490,13 +2498,13 @@ class TuneAutopicker(QWidget):
self.stationBox.activated.connect(self.fill_tabs)
def fill_stationbox(self):
fnames = self.parent.getWFFnames_from_eventbox(eventbox=self.eventBox)
fnames = self.parent().getWFFnames_from_eventbox(eventbox=self.eventBox)
self.data.setWFData(fnames)
wfdat = self.data.getWFData() # all available streams
# trim station components to same start value
trim_station_components(wfdat, trim_start=True, trim_end=False)
# rotate misaligned stations to ZNE
wfdat = check4rotated(wfdat, self.parent.metadata)
wfdat = check4rotated(wfdat, self.parent().metadata, verbosity=0)
self.stationBox.clear()
stations = []
for trace in self.data.getWFData():
@ -2510,7 +2518,7 @@ class TuneAutopicker(QWidget):
for network, station in stations:
item = QtGui.QStandardItem(network + '.' + station)
if station in self.get_current_event().pylot_picks:
item.setBackground(self.parent._colors['ref'])
item.setBackground(self.parent()._ref_test_colors['ref'])
model.appendRow(item)
def init_figure_tabs(self):
@ -2525,7 +2533,7 @@ class TuneAutopicker(QWidget):
self.stb_names = ['aicARHfig', 'refSpick', 'el_S1pick', 'el_S2pick']
def add_parameters(self):
self.paraBox = PylotParaBox(self.parameter)
self.paraBox = PylotParaBox(self.parameter, parent=self, windowflag=0)
self.paraBox.set_tune_mode(True)
self.update_eventID()
self.parameter_layout.addWidget(self.paraBox)
@ -2534,6 +2542,7 @@ class TuneAutopicker(QWidget):
def add_buttons(self):
self.pick_button = QtGui.QPushButton('Pick Trace')
self.pick_button.setStyleSheet('QPushButton{border-color: rgba(110, 200, 0, 255)}')
self.pick_button.clicked.connect(self.call_picker)
self.close_button = QtGui.QPushButton('Close')
self.close_button.clicked.connect(self.hide)
@ -2551,7 +2560,7 @@ class TuneAutopicker(QWidget):
def get_current_event(self):
path = self.eventBox.currentText()
return self.parent.project.getEventFromPath(path)
return self.parent().project.getEventFromPath(path)
def get_current_event_name(self):
return self.eventBox.currentText().split('/')[-1]
@ -2582,40 +2591,42 @@ class TuneAutopicker(QWidget):
def gen_pick_dlg(self):
if not self.get_current_event():
self.pickDlg = None
if self.pdlg_widget:
self.pdlg_widget.setParent(None)
self.pdlg_widget = None
return
station = self.get_current_station()
data = self.data.getWFData()
metadata = self.parent.metadata
metadata = self.parent().metadata
event = self.get_current_event()
filteroptions = self.parent.filteroptions
pickDlg = PickDlg(self, data=data.select(station=station),
station=station, parameter=self.parameter,
picks=self.get_current_event_picks(station),
autopicks=self.get_current_event_autopicks(station),
metadata=metadata, event=event, filteroptions=filteroptions,
embedded=True)
pickDlg.update_picks.connect(self.picks_from_pickdlg)
pickDlg.update_picks.connect(self.fill_eventbox)
pickDlg.update_picks.connect(self.fill_stationbox)
pickDlg.update_picks.connect(lambda: self.parent.setDirty(True))
pickDlg.update_picks.connect(self.parent.enableSaveEventAction)
self.pickDlg = QtGui.QWidget()
filteroptions = self.parent().filteroptions
self.pickDlg = PickDlg(self, data=data.select(station=station),
station=station, parameter=self.parameter,
picks=self.get_current_event_picks(station),
autopicks=self.get_current_event_autopicks(station),
metadata=metadata, event=event, filteroptions=filteroptions,
embedded=True)
self.pickDlg.update_picks.connect(self.picks_from_pickdlg)
self.pickDlg.update_picks.connect(self.fill_eventbox)
self.pickDlg.update_picks.connect(self.fill_stationbox)
self.pickDlg.update_picks.connect(lambda: self.parent().setDirty(True))
self.pickDlg.update_picks.connect(self.parent().enableSaveEventAction)
self.pdlg_widget = QtGui.QWidget(self)
hl = QtGui.QHBoxLayout()
self.pickDlg.setLayout(hl)
hl.addWidget(pickDlg)
self.pdlg_widget.setLayout(hl)
hl.addWidget(self.pickDlg)
def picks_from_pickdlg(self, picks=None):
station = self.get_current_station()
replot = self.parent.addPicks(station, picks)
replot = self.parent().addPicks(station, picks)
self.get_current_event().setPick(station, picks)
if self.get_current_event() == self.parent.get_current_event():
if self.get_current_event() == self.parent().get_current_event():
if replot:
self.parent.plotWaveformDataThread()
self.parent.drawPicks()
self.parent().plotWaveformDataThread()
self.parent().drawPicks()
else:
self.parent.drawPicks(station)
self.parent.draw()
self.parent().drawPicks(station)
self.parent().draw()
def plot_manual_picks_to_figs(self):
picks = self.get_current_event_picks(self.get_current_station())
@ -2640,13 +2651,13 @@ class TuneAutopicker(QWidget):
('el_S1pick', 0),
('el_S2pick', 0)]
for p_ax in p_axes:
axes = self.parent.fig_dict[p_ax[0]].axes
axes = self.parent().fig_dict[p_ax[0]].axes
if not axes:
continue
ax = axes[p_ax[1]]
self.plot_manual_Ppick_to_ax(ax, (picks['P']['mpp'] - starttime))
for s_ax in s_axes:
axes = self.parent.fig_dict[s_ax[0]].axes
axes = self.parent().fig_dict[s_ax[0]].axes
if not axes:
continue
ax = axes[s_ax[1]]
@ -2676,10 +2687,10 @@ class TuneAutopicker(QWidget):
def fill_tabs(self, event=None, picked=False):
self.clear_all()
canvas_dict = self.parent.canvas_dict
self.gen_pick_dlg()
canvas_dict = self.parent().canvas_dict
self.overview = self.gen_tab_widget('Overview', canvas_dict['mainFig'])
id0 = self.figure_tabs.insertTab(0, self.pickDlg, 'Traces Plot')
id0 = self.figure_tabs.insertTab(0, self.pdlg_widget, 'Traces Plot')
id1 = self.figure_tabs.insertTab(1, self.overview, 'Overview')
id2 = self.figure_tabs.insertTab(2, self.p_tabs, 'P')
id3 = self.figure_tabs.insertTab(3, self.s_tabs, 'S')
@ -2722,12 +2733,12 @@ class TuneAutopicker(QWidget):
self.init_tab_names()
def fill_eventbox(self):
project = self.parent.project
project = self.parent().project
if not project:
return
# update own list
self.parent.fill_eventbox(eventBox=self.eventBox, select_events='ref')
index_start = self.parent.eventBox.currentIndex()
self.parent().fill_eventbox(eventBox=self.eventBox, select_events='ref')
index_start = self.parent().eventBox.currentIndex()
index = index_start
if index == -1:
index += 1
@ -2746,7 +2757,7 @@ class TuneAutopicker(QWidget):
if not index == index_start:
self.eventBox.activated.emit(index)
# update parent
self.parent.fill_eventbox()
self.parent().fill_eventbox()
def update_eventID(self):
self.paraBox.boxes['eventID'].setText(
@ -2768,7 +2779,8 @@ class TuneAutopicker(QWidget):
'locflag': 0,
'savexml': False}
for key in self.fig_dict.keys():
self.fig_dict[key].clear()
if not key == 'plot_style':
self.fig_dict[key].clear()
self.ap_thread = Thread(self, autoPyLoT, arg=args,
progressText='Picking trace...',
pb_widget=self.pb_widget,
@ -2809,8 +2821,8 @@ class TuneAutopicker(QWidget):
def params_from_gui(self):
parameters = self.paraBox.params_from_gui()
if self.parent:
self.parent._inputs = parameters
if self.parent():
self.parent()._inputs = parameters
return parameters
def set_stretch(self):
@ -2818,10 +2830,11 @@ class TuneAutopicker(QWidget):
self.tune_layout.setStretch(1, 1)
def clear_all(self):
if hasattr(self, 'pickDlg'):
if self.pickDlg:
self.pickDlg.setParent(None)
del (self.pickDlg)
if hasattr(self, 'pdlg_widget'):
if self.pdlg_widget:
self.pdlg_widget.setParent(None)
# TODO: removing widget by parent deletion raises exception when activating stationbox:
# RuntimeError: Internal C++ object (PylotCanvas) already deleted.
if hasattr(self, 'overview'):
self.overview.setParent(None)
if hasattr(self, 'p_tabs'):
@ -2850,7 +2863,7 @@ class PylotParaBox(QtGui.QWidget):
accepted = QtCore.Signal(str)
rejected = QtCore.Signal(str)
def __init__(self, parameter, parent=None):
def __init__(self, parameter, parent=None, windowflag=1):
'''
Generate Widget containing parameters for PyLoT.
@ -2858,7 +2871,7 @@ class PylotParaBox(QtGui.QWidget):
:type: PylotParameter (object)
'''
QtGui.QWidget.__init__(self, parent)
QtGui.QWidget.__init__(self, parent, windowflag)
self.parameter = parameter
self.tabs = QtGui.QTabWidget()
self.layout = QtGui.QVBoxLayout()
@ -3423,6 +3436,7 @@ class SubmitLocal(QWidget):
class PropertiesDlg(QDialog):
def __init__(self, parent=None, infile=None, inputs=None):
super(PropertiesDlg, self).__init__(parent)
self._pylot_mainwindow = self.parent()
self.infile = infile
self.inputs = inputs
@ -3723,14 +3737,29 @@ class PhasesTab(PropTab):
class GraphicsTab(PropTab):
def __init__(self, parent=None):
super(GraphicsTab, self).__init__(parent)
self.pylot_mainwindow = parent._pylot_mainwindow
self.init_layout()
self.add_pg_cb()
self.add_nth_sample()
self.add_style_settings()
self.setLayout(self.main_layout)
def init_layout(self):
self.main_layout = QGridLayout()
def add_style_settings(self):
styles = self.pylot_mainwindow._styles
active_stylename = self.pylot_mainwindow._stylename
label = QtGui.QLabel('Application style (might require Application restart):')
self.style_cb = QComboBox()
for stylename, style in styles.items():
self.style_cb.addItem(stylename, style)
index_current_style = self.style_cb.findText(active_stylename)
self.style_cb.setCurrentIndex(index_current_style)
self.main_layout.addWidget(label, 2, 0)
self.main_layout.addWidget(self.style_cb, 2, 1)
self.style_cb.activated.connect(self.set_current_style)
def add_nth_sample(self):
settings = QSettings()
nth_sample = settings.value("nth_sample")
@ -3747,6 +3776,12 @@ class GraphicsTab(PropTab):
self.main_layout.addWidget(self.spinbox_nth_sample, 1, 1)
def add_pg_cb(self):
try:
import pyqtgraph as pg
pg = True
except:
pg = False
text = {True: 'Use pyqtgraphic library for plotting',
False: 'Cannot use library: pyqtgraphic not found on system'}
label = QLabel('PyQt graphic')
@ -3758,6 +3793,10 @@ class GraphicsTab(PropTab):
self.main_layout.addWidget(label, 0, 0)
self.main_layout.addWidget(self.checkbox_pg, 0, 1)
def set_current_style(self):
selected_style = self.style_cb.currentText()
self.pylot_mainwindow.set_style(selected_style)
def getValues(self):
values = {'nth_sample': self.spinbox_nth_sample.value(),
'pyqtgraphic': self.checkbox_pg.isChecked()}

1
pylot/styles/__init__.py Normal file
View File

@ -0,0 +1 @@
# -*- coding: utf-8 -*-

254
pylot/styles/bright.qss Normal file
View File

@ -0,0 +1,254 @@
QMainWindow{
background-color: qlineargradient(spread:reflect, x1:0, y1:0, x2:0, y2:0.5, stop:0 rgba(230, 230, 230, 255), stop:1 rgba(255, 255, 255, 255));
color: rgba(0, 0, 0, 255);
}
QWidget{
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(235, 235, 235, 255), stop:1 rgba(230, 230, 230, 255));
color: rgba(0, 0, 0, 255);
}
QToolBar QWidget:checked{
background-color: transparent;
border-color: rgba(230, 230, 230, 255);
border-width: 2px;
border-style:inset;
}
QComboBox{
background-color: rgba(255, 255, 255, 255);
color: rgba(0, 0, 0, 255);
min-height: 1.5em;
selection-background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 55, 140, 150), stop:1 rgba(0, 70, 180, 150));
}
QComboBox *{
background-color: rgba(255, 255, 255, 255);
color: rgba(0, 0, 0, 255);
selection-background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 55, 140, 150), stop:1 rgba(0, 70, 180, 150));
selection-color: rgba(255, 255, 255, 255);
}
QMenuBar{
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:2, stop:0 rgba(240, 240, 240, 255), stop:1 rgba(230, 230, 230, 255));
padding:1px;
}
QMenuBar::item{
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:2, stop:0 rgba(240, 240, 240, 255), stop:1 rgba(230, 230, 230, 255));
color: rgba(0, 0, 0, 255);
padding:3px;
padding-left:5px;
padding-right:5px;
}
QMenu{
background-color: qlineargradient(spread:reflect, x1:0, y1:0, x2:0, y2:0.5, stop:0 rgba(230, 230, 230, 255), stop:1 rgba(230, 230, 230 255));
color: rgba(0, 0, 0, 255);
padding:0;
}
*::item:selected{
color: rgba(0, 0, 0, 255);
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 55, 140, 150), stop:1 rgba(0, 70, 180, 150));
}
QToolBar{
background-color: qlineargradient(spread:reflect, x1:0, y1:0, x2:0, y2:0.5, stop:0 rgba(230, 230, 230, 255), stop:1 rgba(255, 255, 255, 255));
border-style:solid;
border-color:rgba(200, 200, 200, 150);
border-width:1px;
}
QToolBar *{
background-color: qlineargradient(spread:reflect, x1:0, y1:0, x2:0, y2:0.5, stop:0 rgba(230, 230, 230, 255), stop:1 rgba(255, 255, 255, 255));
}
QMessageBox{
background-color: rgba(255, 255, 255, 255);
color: rgba(0, 0, 0, 255);
}
QTableWidget{
background-color: rgba(255, 255, 255, 255);
color:rgba(0, 0, 0, 255);
border-color:rgba(0, 0, 0, 255);
selection-background-color: rgba(200, 210, 230, 255);
}
QTableCornerButton::section{
border: none;
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(255, 255, 255, 255), stop:1 rgba(230, 230, 230, 255));
}
QHeaderView::section{
background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(255, 255, 255, 255), stop:1 rgba(230, 230, 230, 255));
border:none;
border-top-style:solid;
border-width:1px;
border-top-color:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(255, 255, 255, 255), stop:1 rgba(230, 230, 230, 255));
color:rgba(0, 0, 0, 255);
padding:5px;
}
QHeaderView::section:checked{
background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 55, 140, 150), stop:1 rgba(0, 70, 180, 150));
border-top-color:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 55, 140, 150), stop:1 rgba(0, 70, 180, 150));
}
QHeaderView{
background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(255, 255, 255, 255), stop:1 rgba(230, 230, 230, 255));
border:none;
border-top-style:solid;
border-width:1px;
border-top-color:rgba(230, 230, 230, 255);
color:rgba(0, 0, 0, 255);
}
QListWidget{
background-color:rgba(230, 230, 230, 255);
color:rgba(0, 0, 0, 255);
}
QStatusBar{
background-color:rgba(255, 255, 255, 255);
color:rgba(0, 0, 0, 255);
}
QPushButton{
background-color:qlineargradient(spread:reflect, x1:0, y1:0, x2:0, y2:0.5, stop:0 rgba(230, 230, 230, 255), stop:1 rgba(245, 245, 245, 255));
color:rgba(0, 0, 0, 255);
border-style: outset;
border-width: 1px;
border-color: rgba(100, 100, 120, 255);
min-width: 6em;
padding: 4px;
padding-left:5px;
padding-right:5px;
border-radius: 2px;
}
QPushButton:pressed{
background-color: rgba(230, 230, 230, 255);
border-style: inset;
}
QPushButton:checked{
background-color: rgba(230, 230, 230, 255);
border-style: inset;
}
*:disabled{
color:rgba(100, 100, 120, 255);
}
QTabBar{
background-color:transparent;
}
QTabBar::tab{
background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(230, 230, 230, 255), stop:1 rgba(210, 210, 210, 255));
color: rgba(0, 0, 0, 255);
border-style:solid;
border-color:rgba(210, 210, 210 255);
border-bottom-color: transparent;
border-width:1px;
padding:5px;
}
QTabBar::tab:selected{
background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(255, 255, 255, 255), stop:1 rgba(245, 245, 245, 255));
color: rgba(0, 0, 0, 255);
border-style:solid;
border-color:rgba(245, 245, 245, 255);
border-bottom-color: transparent;
border-width:1px;
padding:5px;
}
QTabBar::tab:disabled{
background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(230, 230, 230, 255), stop:1 rgba(210, 210, 210, 255));
color: rgba(100, 100, 120, 255);
}
QTabWidget{
background-color:transparent;
}
QTabWidget::pane{
background-color:rgba(0, 0, 0, 255);
border-style:solid;
border-color:rgba(245, 245, 245, 255);
border-width:1px;
}
QTabWidget::tab{
background-color:rgba(255, 255, 255, 255);
}
QTabWidget > QWidget{
background-color: rgba(245, 245, 245, 255);
color: rgba(0, 0, 0, 255);
}
QScrollArea{
background: transparent;
}
QScrollArea>QWidget>QWidget{
background: transparent;
}
QLabel{
color: rgba(0, 0, 0, 255);
background-color: transparent;
}
QTextEdit{
color: rgba(0, 0, 0, 255);
background-color: rgba(255, 255, 255, 255);
}
QSpinBox{
color: rgba(0, 0, 0, 255);
background-color: rgba(255, 255, 255, 255);
}
QDoubleSpinBox{
color: rgba(0, 0, 0, 255);
background-color: rgba(255, 255, 255, 255);
}
QCheckBox{
background-color:transparent;
border:none;
}
QLineEdit{
background-color: rgba(255, 255, 255, 255);
border: 1px inset;
border-radius:0;
border-color: rgba(100, 100, 120, 255);
}
QLineEdit:disabled{
background-color: rgba(255, 255, 255, 255);
border: 1px inset;
border-radius:0;
border-color: rgba(200, 200, 200, 255);
}
QListWidget{
background-color:rgba(255, 255, 255, 255)
}
QProgressBar{
background-color:rgba(230, 230, 230, 255);
}
QProgressBar::chunk{
background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 70, 180, 150), stop:1 transparent);
}

253
pylot/styles/dark.qss Normal file
View File

@ -0,0 +1,253 @@
QMainWindow{
background-color: qlineargradient(spread:reflect, x1:0, y1:0, x2:0, y2:0.5, stop:0 rgba(70, 70, 80, 255), stop:1 rgba(60, 60, 70, 255));
color: rgba(255, 255, 255, 255);
}
QWidget{
background-color: qlineargradient(spread:reflect, x1:0, y1:0, x2:0, y2:0.5, stop:0 rgba(70, 70, 80, 255), stop:1 rgba(60, 60, 70, 255));
color: rgba(255, 255, 255, 255);
}
QToolBar QWidget:checked{
background-color: transparent;
border-color: rgba(100, 100, 120, 255);
border-width: 2px;
border-style:inset;
}
QComboBox{
background-color: rgba(90, 90, 100, 255);
color: rgba(255, 255, 255, 255);
min-height: 1.5em;
selection-background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 144, 180, 255), stop:1 rgba(0, 150, 190, 255));
}
QComboBox *{
background-color: rgba(90, 90, 100, 255);
color: rgba(255, 255, 255, 255);
selection-background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 144, 180, 255), stop:1 rgba(0, 150, 190, 255));
selection-color: rgba(255, 255, 255, 255);
}
QMenuBar{
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(70, 70, 80, 255), stop:1 rgba(60, 60, 70, 255));
padding:1px;
}
QMenuBar::item{
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(70, 70, 80, 255), stop:1 rgba(60, 60, 70, 255));
color: rgba(255, 255, 255, 255);
padding:3px;
padding-left:5px;
padding-right:5px;
}
QMenu{
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(70, 70, 80, 255), stop:1 rgba(60, 60, 70, 255));
color: rgba(255, 255, 255, 255);
padding:0;
}
*::item:selected{
color: rgba(255, 255, 255, 255);
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 144, 180, 255), stop:1 rgba(0, 150, 190, 255));
}
QToolBar{
background-color: qlineargradient(spread:reflect, x1:0, y1:0, x2:0, y2:0.5, stop:0 rgba(70, 70, 80, 255), stop:1 rgba(60, 60, 70, 255));
border-style:solid;
border-color:rgba(80, 80, 90, 255);
border-width:1px;
}
QToolBar *{
background-color: qlineargradient(spread:reflect, x1:0, y1:0, x2:0, y2:0.5, stop:0 rgba(70, 70, 80, 255), stop:1 rgba(60, 60, 70, 255));
}
QMessageBox{
background-color: rgba(60, 60, 70, 255);
color: rgba(255, 255, 255, 255);
}
QTableWidget{
background-color: rgba(80, 80, 90, 255);
color:rgba(255, 255, 255, 255);
border-color:rgba(255, 255, 255, 255);
selection-background-color: rgba(200, 210, 230, 255);
}
QTableCornerButton::section{
border: none;
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(60, 60, 70, 255), stop:1 rgba(70, 70, 80, 255));
}
QHeaderView::section{
background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(60, 60, 70, 255), stop:1 rgba(70, 70, 80, 255));
border:none;
border-top-style:solid;
border-width:1px;
border-top-color:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(60, 60, 70, 255), stop:1 rgba(70, 70, 80, 255));
color:rgba(255, 255, 255, 255);
padding:5px;
}
QHeaderView::section:checked{
background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 120, 150, 255), stop:1 rgba(0, 150, 190, 255));
border-top-color:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 120, 150, 255), stop:1 rgba(0, 150, 190, 255));
}
QHeaderView{
background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(60, 60, 70, 255), stop:1 rgba(70, 70, 80, 255));
border:none;
border-top-style:solid;
border-width:1px;
border-top-color:rgba(70, 70, 80, 255);
color:rgba(255, 255, 255, 255);
}
QListWidget{
background-color:rgba(200, 200, 200, 255);
color:rgba(255, 255, 255, 255);
}
QStatusBar{
background-color:rgba(60, 60, 70, 255);
color:rgba(255, 255, 255, 255);
}
QPushButton{
background-color:qlineargradient(spread:reflect, x1:0, y1:0, x2:0, y2:0.5, stop:0 rgba(70, 70, 80, 255), stop:1 rgba(60, 60, 70, 255));
color:rgba(255, 255, 255, 255);
border-style: outset;
border-width: 2px;
border-color: rgba(50, 50, 60, 255);
min-width: 6em;
padding: 4px;
padding-left:5px;
padding-right:5px;
border-radius: 2px;
}
QPushButton:pressed{
background-color: qlineargradient(spread:reflect, x1:0, y1:0, x2:0, y2:0.5, stop:0 rgba(80, 80, 90, 255), stop:1 rgba(70, 70, 80, 255));
border-style: inset;
}
QPushButton:checked{
background-color: qlineargradient(spread:reflect, x1:0, y1:0, x2:0, y2:0.5, stop:0 rgba(80, 80, 90, 255), stop:1 rgba(70, 70, 80, 255));
border-style: inset;
}
*:disabled{
color: rgba(130, 130, 130, 255);
}
QTabBar{
background-color:transparent;
}
QTabBar::tab{
background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(70, 70, 80, 255), stop:1 rgba(60, 60, 70, 255));
color: rgba(255, 255, 255, 255);
border-style:solid;
border-color:rgba(70, 70, 80, 255);
border-bottom-color: transparent;
border-width:1px;
padding:5px;
}
QTabBar::tab:selected{
background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(80, 80, 90, 255), stop:1 rgba(70, 70, 80, 255));
color: rgba(255, 255, 255, 255);
border-style:solid;
border-color:rgba(70, 70, 80, 255);
border-bottom-color: transparent;
border-width:1px;
padding:5px;
}
QTabBar::tab:disabled{
background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(70, 70, 80, 255), stop:1 rgba(60, 60, 70, 255));
color: rgba(100, 100, 120, 255);
}
QTabWidget{
background-color:transparent;
}
QTabWidget::pane{
background-color:rgba(70, 70, 80, 255);
border-style:solid;
border-color:rgba(70, 70, 80, 255);
border-width:1px;
}
QTabWidget::tab{
background-color:rgba(70, 70, 80, 255);
}
QTabWidget > QWidget{
background-color: rgba(70, 70, 80, 255);
color: rgba(255, 255, 255, 255);
}
QScrollArea{
background: transparent;
}
QScrollArea>QWidget>QWidget{
background: transparent;
}
QLabel{
color: rgba(255, 255, 255, 255);
background-color: transparent;
}
QTextEdit{
color: rgba(255, 255, 255, 255);
background-color: rgba(90, 90, 100, 255);
}
QSpinBox{
color: rgba(255, 255, 255, 255);
background-color: rgba(90, 90, 100, 255);
}
QDoubleSpinBox{
color: rgba(255, 255, 255, 255);
background-color: rgba(90, 90, 100, 255);
}
QCheckBox{
background-color:transparent;
border:none;
}
QLineEdit{
background-color: rgba(90, 90, 100, 255);
border: 1px inset;
border-radius:0;
border-color: rgba(100, 100, 120, 255);
}
QLineEdit:disabled{
background-color: rgba(90, 90, 100, 255);
border: 1px inset;
border-radius:0;
border-color: rgba(200, 200, 200, 255);
}
QListWidget{
background-color:rgba(60, 60, 70, 255)
}
QProgressBar{
background-color:rgba(60, 60, 70, 255);
}
QProgressBar::chunk{
background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 150, 190, 255), stop:1 transparent);
}

View File

@ -0,0 +1,70 @@
# -*- coding: utf-8 -*-
# Set base phase colors for manual and automatic picks
# together with a modifier (r, g, or b) used to alternate
# the base color
phasecolors = {
'manual': {
'P':{
'rgba': (0, 0, 255, 255),
'modifier': 'g'},
'S':{
'rgba': (255, 0, 0, 255),
'modifier': 'b'}
},
'auto':{
'P':{
'rgba': (140, 0, 255, 255),
'modifier': 'g'},
'S':{
'rgba': (255, 140, 0, 255),
'modifier': 'b'}
}
}
# Set plot colors and stylesheet for each style
stylecolors = {
'default':{
'linecolor':{
'rgba': (0, 0, 0, 255)},
'background': {
'rgba': (255, 255, 255, 255)},
'multicursor': {
'rgba': (255, 190, 0, 255)},
'ref': {
'rgba': (200, 210, 230, 255)},
'test': {
'rgba': (200, 230, 200, 255)},
'stylesheet': {
'filename': None}
},
'dark': {
'linecolor': {
'rgba': (230, 230, 230, 255)},
'background': {
'rgba': (50, 50, 60, 255)},
'multicursor': {
'rgba': (0, 150, 190, 255)},
'ref': {
'rgba': (80, 110, 170, 255)},
'test': {
'rgba': (130, 190, 100, 255)},
'stylesheet': {
'filename': 'pylot/styles/dark.qss'}
},
'bright': {
'linecolor': {
'rgba': (0, 0, 0, 255)},
'background': {
'rgba': (255, 255, 255, 255)},
'multicursor': {
'rgba': (100, 100, 190, 255)},
'ref': {
'rgba': (200, 210, 230, 255)},
'test': {
'rgba': (200, 230, 200, 255)},
'stylesheet': {
'filename': 'pylot/styles/bright.qss'}
}
}