[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']: if picks['epp'] and picks['lpp']:
epp = picks['epp'] - stime epp = picks['epp'] - stime
lpp = picks['lpp'] - stime lpp = picks['lpp'] - stime
else:
epp = None
lpp = None
spe = picks['spe'] spe = picks['spe']
if not spe and epp and lpp: if not spe and epp and lpp:

View File

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

View File

@ -253,8 +253,8 @@ def picks_from_picksdict(picks, creation_info=None):
lpp = phase['lpp'] lpp = phase['lpp']
pick.time_errors.lower_uncertainty = onset - epp pick.time_errors.lower_uncertainty = onset - epp
pick.time_errors.upper_uncertainty = lpp - onset pick.time_errors.upper_uncertainty = lpp - onset
except KeyError as e: except (KeyError, TypeError) as e:
warnings.warn(e.message, RuntimeWarning) warnings.warn(str(e), RuntimeWarning)
try: try:
picker = phase['picker'] picker = phase['picker']
except KeyError as e: except KeyError as e:
@ -274,7 +274,7 @@ def picks_from_picksdict(picks, creation_info=None):
else: else:
pick.polarity = 'undecidable' pick.polarity = 'undecidable'
except KeyError as e: 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 pass
else: else:
raise e raise e

View File

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

View File

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

View File

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

View File

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