Some Minor Fixes

This commit is contained in:
Kaan Cökerim 2021-07-09 10:06:28 +02:00
parent 5efe75f4ea
commit bd9c1d0f73
7 changed files with 18 additions and 16 deletions

View File

@ -35,9 +35,11 @@ import traceback
import json import json
from datetime import datetime from datetime import datetime
# set environment variables to use Qt5 and don't convert to Qt4 syntax
# os.environ['PYQTGRAPH_QT_LIB'] = 'PyQt5'
# os.environ["QT_API"] = "pyqt5"
matplotlib.use('Qt5Agg') matplotlib.use('Qt5Agg')
# matplotlib.rcParams['backend.qt4'] = 'PySide'
# matplotlib.rcParams['savefig.dpi'] = 300
from PySide2 import QtGui, QtCore, QtWidgets from PySide2 import QtGui, QtCore, QtWidgets
from PySide2.QtCore import QCoreApplication, QSettings, Signal, QFile, \ from PySide2.QtCore import QCoreApplication, QSettings, Signal, QFile, \
@ -57,7 +59,6 @@ from pylot.core.util.obspyDMT_interface import check_obspydmt_structure
import pyqtgraph as pg import pyqtgraph as pg
try: try:
from matplotlib.backends.backend_qt5agg import FigureCanvas from matplotlib.backends.backend_qt5agg import FigureCanvas
except ImportError: except ImportError:

View File

@ -157,7 +157,7 @@ class Array_map(QtWidgets.QWidget):
self.canvas.axes.add_feature(cf.COASTLINE, linewidth=1, edgecolor='gray') self.canvas.axes.add_feature(cf.COASTLINE, linewidth=1, edgecolor='gray')
self.canvas.axes.add_feature(cf.BORDERS, alpha=0.7) self.canvas.axes.add_feature(cf.BORDERS, alpha=0.7)
self.canvas.axes.add_feature(cf.LAKES, alpha=0.7) self.canvas.axes.add_feature(cf.LAKES, alpha=0.7)
self.canvas.axes.add_feature(cf.RIVERS, linewidth=0.8) self.canvas.axes.add_feature(cf.RIVERS, linewidth=1)
# parallels and meridians # parallels and meridians
self.add_merid_paral() self.add_merid_paral()

View File

@ -73,7 +73,7 @@ class Event(ObsPyEvent):
text = lines[0] text = lines[0]
self.addNotes(text) self.addNotes(text)
try: try:
datetime = UTCDateTime(path.split('/')[-1]) datetime = UTCDateTime(self.path.split('/')[-1])
origin = Origin(resource_id=self.resource_id, time=datetime, latitude=0, longitude=0, depth=0) origin = Origin(resource_id=self.resource_id, time=datetime, latitude=0, longitude=0, depth=0)
self.origins.append(origin) self.origins.append(origin)
except: except:

View File

@ -11,6 +11,7 @@ from pylot.core.util.array_map import Array_map
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
def main(project_file_path, manual=False, auto=True, file_format='png', f_ext='', ncores=None): def main(project_file_path, manual=False, auto=True, file_format='png', f_ext='', ncores=None):
project = Project.load(project_file_path) project = Project.load(project_file_path)
nEvents = len(project.eventlist) nEvents = len(project.eventlist)
@ -34,6 +35,7 @@ def main(project_file_path, manual=False, auto=True, file_format='png', f_ext=''
pool.close() pool.close()
pool.join() pool.join()
def array_map_worker(input_dict): def array_map_worker(input_dict):
event = input_dict['event'] event = input_dict['event']
eventdir = event.path eventdir = event.path
@ -65,6 +67,7 @@ def array_map_worker(input_dict):
fig.savefig(fpath_out, dpi=300.) fig.savefig(fpath_out, dpi=300.)
print('Wrote file: {}'.format(fpath_out)) print('Wrote file: {}'.format(fpath_out))
if __name__ == '__main__': if __name__ == '__main__':
dataroot = '/home/marcel' dataroot = '/home/marcel'
infiles = ['alparray_all_events_0.03-0.1_mantle_correlated_v3.plp'] infiles = ['alparray_all_events_0.03-0.1_mantle_correlated_v3.plp']

View File

@ -49,7 +49,7 @@ def which(program, parameter):
:rtype: str :rtype: str
""" """
try: try:
from PySide.QtCore import QSettings from PySide2.QtCore import QSettings
settings = QSettings() settings = QSettings()
for key in settings.allKeys(): for key in settings.allKeys():
if 'binPath' in key: if 'binPath' in key:

View File

@ -964,7 +964,7 @@ def check4rotated(data, metadata=None, verbosity=1):
z, n, e = rotate2zne(wfstream[0], azimuts[0], dips[0], z, n, e = rotate2zne(wfstream[0], azimuts[0], dips[0],
wfstream[1], azimuts[1], dips[1], wfstream[1], azimuts[1], dips[1],
wfstream[2], azimuts[2], dips[2]) wfstream[2], azimuts[2], dips[2])
print('check4rotated: rotated trace {} to ZNE'.format(trace_id)) print('check4rotated: rotated trace {} to ZNE'.format(trace_ids))
# replace old data with rotated data, change the channel code to ZNE # replace old data with rotated data, change the channel code to ZNE
z_index = dips.index(min( z_index = dips.index(min(
dips)) # get z-trace index, z has minimum dip of -90 (dip is measured from 0 to -90, with -90 being vertical) dips)) # get z-trace index, z has minimum dip of -90 (dip is measured from 0 to -90, with -90 being vertical)

View File

@ -719,7 +719,7 @@ class WaveformWidgetPG(QtWidgets.QWidget):
station = self.orig_parent.getTraceID(wfID) station = self.orig_parent.getTraceID(wfID)
abstime = self.wfstart + x abstime = self.wfstart + x
if self.orig_parent.get_current_event(): if self.orig_parent.get_current_event():
self.status_label.setText("station = {}, T = {}, t = {} [s]".format(station, abstime, x)) self.status_label.setText("station = {}, T = {}, t = {} [s], sampling rate = ".format(station, abstime, x))
self.vLine.setPos(mousePoint.x()) self.vLine.setPos(mousePoint.x())
self.hLine.setPos(mousePoint.y()) self.hLine.setPos(mousePoint.y())
@ -4618,8 +4618,6 @@ class InputsTab(PropTab):
self.cuttimesLayout.addWidget(self.tstopBox, 10) self.cuttimesLayout.addWidget(self.tstopBox, 10)
self.cuttimesLayout.addWidget(QLabel('[s]'), 0) self.cuttimesLayout.addWidget(QLabel('[s]'), 0)
from pylot.core.util.structure import DATASTRUCTURE from pylot.core.util.structure import DATASTRUCTURE
self.structureSelect.addItems(list(DATASTRUCTURE.keys())) self.structureSelect.addItems(list(DATASTRUCTURE.keys()))
@ -4628,7 +4626,7 @@ class InputsTab(PropTab):
self.structureSelect.setCurrentIndex(dsind) self.structureSelect.setCurrentIndex(dsind)
layout = QFormLayout() layout = QtWidgets.QFormLayout()
layout.addRow("Data root directory: ", self.dataDirEdit) layout.addRow("Data root directory: ", self.dataDirEdit)
layout.addRow("Full name for user '{0}': ".format(pylot_user), self.fullNameEdit) layout.addRow("Full name for user '{0}': ".format(pylot_user), self.fullNameEdit)
layout.addRow("Data structure: ", self.structureSelect) layout.addRow("Data structure: ", self.structureSelect)