From fa19ae9b9c58e35857bd7f80239e08208edb8531 Mon Sep 17 00:00:00 2001 From: Sebastianw Wehling-Benatelli Date: Mon, 19 Sep 2016 11:35:59 +0200 Subject: [PATCH] [bugfix] only try to calculate moment magnitude given w0 and fc --- QtPyLoT.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/QtPyLoT.py b/QtPyLoT.py index cc4416c2..1ff21462 100755 --- a/QtPyLoT.py +++ b/QtPyLoT.py @@ -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