[refs #200] take advantage of the newly imported input file for magnitude calculation

This commit is contained in:
Sebastian Wehling-Benatelli 2016-09-08 15:31:23 +02:00
parent 6e6b3570a8
commit 3d41e0abcd
2 changed files with 10 additions and 9 deletions

View File

@ -78,7 +78,7 @@ class MainWindow(QMainWindow):
self.createAction = createAction
# read settings
settings = QSettings()
infile = os.path.join(os.path.expanduser('~'), 'pylot.in')
infile = os.path.join(os.path.expanduser('~'), '.pylot', 'pylot.in')
self._inputs = AutoPickParameter(infile)
if settings.value("user/FullName", None) is None:
fulluser = QInputDialog.getText(self, "Enter Name:", "Full name")
@ -402,6 +402,10 @@ class MainWindow(QMainWindow):
self.fileMenu.addSeparator()
self.fileMenu.addAction(self.fileMenuActions[-1])
@property
def inputs(self):
return self._inputs
def getRoot(self):
settings = QSettings()
return settings.value("data/dataRoot")
@ -989,9 +993,9 @@ class MainWindow(QMainWindow):
wf = self.get_data().getWFData().select(station=station)
onset = pick.time
dist = degrees2kilometers(a.distance)
w0, fc = calcsourcespec(wf, onset, fninv, 3000., dist,
w0, fc = calcsourcespec(wf, onset, fninv, self.inputs.get('vp'), dist,
a.azimuth, a.takeoff_angle,
"300f**0.8", 0)
self.inputs.get('Qp'), 0)
stat_mags = calcMoMw(wf, w0, 2700., 3000., dist, fninv)
mags[station] = stat_mags
mag = np.median([M[1] for M in mags.values()])

View File

@ -304,7 +304,7 @@ def calcMoMw(wfstream, w0, rho, vp, delta, inv):
return Mo, Mw
def calcsourcespec(wfstream, onset, inventory, vp, delta, azimuth, incidence, Qp, iplot):
def calcsourcespec(wfstream, onset, inventory, vp, delta, azimuth, incidence, qp, iplot):
'''
Subfunction to calculate the source spectrum and to derive from that the plateau
(usually called omega0) and the corner frequency assuming Aki's omega-square
@ -342,11 +342,8 @@ def calcsourcespec(wfstream, onset, inventory, vp, delta, azimuth, incidence, Qp
print ("Calculating source spectrum ....")
# get Q value
qu = Qp.split('f**')
# constant Q
Q = int(qu[0])
# A, i.e. power of frequency
A = float(qu[1])
Q, A = qp
delta = delta * 1000 # hypocentral distance in [m]
fc = None