[bugfix] only try to calculate moment magnitude given w0 and fc

This commit is contained in:
Sebastian Wehling-Benatelli 2016-09-19 11:35:59 +02:00
parent 8ee515e79f
commit fa19ae9b9c

View File

@ -998,9 +998,16 @@ class MainWindow(QMainWindow):
w0, fc = calcsourcespec(wf, onset, fninv, self.inputs.get('vp'), dist,
a.azimuth, a.takeoff_angle,
self.inputs.get('Qp'), 0)
stat_mags = calcMoMw(wf, w0, 2700., 3000., dist, fninv)
mags[station] = stat_mags
if w0 is None or fc is None:
continue
station_mag = calcMoMw(wf, w0, 2700., 3000., dist, fninv)
mags[station] = station_mag
mag = np.median([M[1] for M in mags.values()])
# give some information on the processing
print('number of stations used: {0}\n'.format(len(mags.values())))
print('stations used:\n')
for s in mags.keys(): print('\t{0}'.format(s))
return Magnitude(mag=mag, magnitude_type='Mw')
else:
return None