feature/port-to-py3 #11

Merged
marcel merged 59 commits from feature/port-to-py3 into develop 2022-03-21 15:30:06 +01:00
7 changed files with 18 additions and 16 deletions
Showing only changes of commit bd9c1d0f73 - Show all commits

View File

@ -35,9 +35,11 @@ import traceback
import json
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"
kaan marked this conversation as resolved Outdated

Please remove commented code if not needed for backup solution implementation. In this case just remove.

Please remove commented code if not needed for backup solution implementation. In this case just remove.
matplotlib.use('Qt5Agg')
# matplotlib.rcParams['backend.qt4'] = 'PySide'
# matplotlib.rcParams['savefig.dpi'] = 300
from PySide2 import QtGui, QtCore, QtWidgets
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
try:
from matplotlib.backends.backend_qt5agg import FigureCanvas
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.BORDERS, 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
self.add_merid_paral()

View File

@ -73,7 +73,7 @@ class Event(ObsPyEvent):
text = lines[0]
self.addNotes(text)
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)
self.origins.append(origin)
except:

View File

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

View File

@ -49,7 +49,7 @@ def which(program, parameter):
:rtype: str
"""
try:
from PySide.QtCore import QSettings
from PySide2.QtCore import QSettings
settings = QSettings()
for key in settings.allKeys():
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],
wfstream[1], azimuts[1], dips[1],
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
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)

View File

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