[bugfix] various bugfixes while testing on Windows with py3

This commit is contained in:
Marcel Paffrath 2017-07-14 15:26:39 +02:00
parent 3869922378
commit a017c4deb4
7 changed files with 25 additions and 17 deletions

View File

@ -1940,6 +1940,9 @@ class MainWindow(QMainWindow):
if picks['epp'] and picks['lpp']:
epp = picks['epp'] - stime
lpp = picks['lpp'] - stime
else:
epp = None
lpp = None
spe = picks['spe']
if not spe and epp and lpp:

View File

@ -6,7 +6,7 @@
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore
from PySide import QtCore
qt_resource_data = b"\
\x00\x00\x9e\x04\

View File

@ -253,8 +253,8 @@ def picks_from_picksdict(picks, creation_info=None):
lpp = phase['lpp']
pick.time_errors.lower_uncertainty = onset - epp
pick.time_errors.upper_uncertainty = lpp - onset
except KeyError as e:
warnings.warn(e.message, RuntimeWarning)
except (KeyError, TypeError) as e:
warnings.warn(str(e), RuntimeWarning)
try:
picker = phase['picker']
except KeyError as e:
@ -274,7 +274,7 @@ def picks_from_picksdict(picks, creation_info=None):
else:
pick.polarity = 'undecidable'
except KeyError as e:
if 'fm' in e.message: # no polarity information found for this phase
if 'fm' in str(e): # no polarity information found for this phase
pass
else:
raise e

View File

@ -480,14 +480,15 @@ def getResolutionWindow(snr, extent):
'global': {'HRW': 40., 'MRW': 100., 'LRW': 200., 'VLRW': 300.}
}
if snr < 1.5:
time_resolution = res_wins[extent]['VLRW']
elif snr < 2.:
time_resolution = res_wins[extent]['LRW']
elif snr < 3.:
time_resolution = res_wins[extent]['MRW']
elif snr >3.:
time_resolution = res_wins[extent]['HRW']
if snr:
if snr < 1.5:
time_resolution = res_wins[extent]['VLRW']
elif snr < 2.:
time_resolution = res_wins[extent]['LRW']
elif snr < 3.:
time_resolution = res_wins[extent]['MRW']
elif snr >3.:
time_resolution = res_wins[extent]['HRW']
else:
time_resolution = res_wins[extent]['VLRW']

View File

@ -4,7 +4,6 @@
import os
import glob
import sys
from obspy.io.xseed import Parser
import numpy as np
@ -170,7 +169,7 @@ def read_metadata(path_to_inventory):
invfile = list()
respfile = list()
# possible file extensions specified here:
inv = dict(dless=dlfile, xml=invfile, resp=respfile, dseed=dlfile)
inv = dict(dless=dlfile, xml=invfile, resp=respfile, dseed=dlfile[:])
if os.path.isfile(path_to_inventory):
ext = os.path.splitext(path_to_inventory)[1].split('.')[1]
inv[ext] += [path_to_inventory]

View File

@ -19,6 +19,7 @@ class map_projection(QtGui.QWidget):
'''
QtGui.QWidget.__init__(self)
self._parent = parent
self.metadata = parent.metadata
self.parser = parent.metadata[1]
self.picks = None
self.picks_dict = None

View File

@ -829,7 +829,7 @@ class PickDlg(QDialog):
self.drawArrivals()
except Exception as e:
print('Warning: Could not init expected picks from taup: {}'.format(e))
def setupUi(self):
menuBar = QtGui.QMenuBar(self)
if not self._embedded:
@ -952,7 +952,11 @@ class PickDlg(QDialog):
station_id = self.data.traces[0].get_id()
parser = self.parent().metadata[1]
station_coords = parser.get_coordinates(station_id)
source_origin = self.parent().get_current_event().origins[0]
origins = self.parent().get_current_event().origins
if origins:
source_origin = origins[0]
else:
raise ValueError('No source origin given.')
arrivals = self.model.get_travel_times_geo(source_origin.depth,
source_origin.latitude,
source_origin.longitude,
@ -2760,7 +2764,7 @@ class InputsTab(PropTab):
from pylot.core.util.structure import DATASTRUCTURE
self.structureSelect.addItems(DATASTRUCTURE.keys())
self.structureSelect.addItems(list(DATASTRUCTURE.keys()))
dsind = findComboBoxIndex(self.structureSelect, curstructure)