[new, bugfix] use new metadata concept in the scope of QtPyLoT; consistent use of input variables

input variables should always be used; avoid hard-coded parameters
This commit is contained in:
Sebastian Wehling-Benatelli 2016-09-20 13:45:49 +02:00
parent 6a2bbe3f91
commit a54ffe01f8

View File

@ -54,6 +54,7 @@ from pylot.core.util.defaults import FILTERDEFAULTS, COMPNAME_MAP, \
from pylot.core.util.errors import FormatError, DatastructureError, \ from pylot.core.util.errors import FormatError, DatastructureError, \
OverwriteError OverwriteError
from pylot.core.util.connection import checkurl from pylot.core.util.connection import checkurl
from pylot.core.util.dataprocessing import read_metadata
from pylot.core.util.utils import fnConstructor, getLogin, \ from pylot.core.util.utils import fnConstructor, getLogin, \
full_range full_range
from pylot.core.io.location import create_creation_info, create_event from pylot.core.io.location import create_creation_info, create_event
@ -987,6 +988,7 @@ class MainWindow(QMainWindow):
if ans == QMessageBox.Yes: if ans == QMessageBox.Yes:
settings.setValue("inventoryFile", fninv) settings.setValue("inventoryFile", fninv)
settings.sync() settings.sync()
metadata = read_metadata(fninv)
for a in o.arrivals: for a in o.arrivals:
if a.phase in 'sS': if a.phase in 'sS':
continue continue
@ -997,12 +999,14 @@ class MainWindow(QMainWindow):
continue continue
onset = pick.time onset = pick.time
dist = degrees2kilometers(a.distance) dist = degrees2kilometers(a.distance)
w0, fc = calcsourcespec(wf, onset, fninv, self.inputs.get('vp'), dist, w0, fc = calcsourcespec(wf, onset, metadata, self.inputs.get('vp'), dist,
a.azimuth, a.takeoff_angle, a.azimuth, a.takeoff_angle,
self.inputs.get('Qp'), 0) self.inputs.get('Qp'), 0)
if w0 is None or fc is None: if w0 is None or fc is None:
continue continue
station_mag = calcMoMw(wf, w0, 2700., 3000., dist, fninv) station_mag = calcMoMw(wf, w0, self.inputs.get('rho'), self.inputs.get('vp'),
dist,
fninv)
mags[station] = station_mag mags[station] = station_mag
mag = np.median([M[1] for M in mags.values()]) mag = np.median([M[1] for M in mags.values()])
# give some information on the processing # give some information on the processing