From ca7ce5f13c4c4968f2686743c698d5539f0c2e88 Mon Sep 17 00:00:00 2001 From: Sebastianw Wehling-Benatelli Date: Wed, 21 Sep 2016 10:27:47 +0200 Subject: [PATCH] [change] signature of calcMoMw changed; renamed getinvdir to get_metadata removed an unused remnant parameter invdir from definition of calcMoMw; method getinvdir from Magnitude class has been renamed and modified and returns now the metadata information and not only the inventory directory --- QtPyLoT.py | 5 ++--- pylot/core/analysis/magnitude.py | 14 +++++++------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/QtPyLoT.py b/QtPyLoT.py index 90ae45be..ef494399 100755 --- a/QtPyLoT.py +++ b/QtPyLoT.py @@ -1004,9 +1004,8 @@ class MainWindow(QMainWindow): self.inputs.get('Qp'), 0) if w0 is None or fc is None: continue - station_mag = calcMoMw(wf, w0, self.inputs.get('rho'), self.inputs.get('vp'), - dist, - fninv) + station_mag = calcMoMw(wf, w0, self.inputs.get('rho'), + self.inputs.get('vp'), dist) mags[station] = station_mag mag = np.median([M[1] for M in mags.values()]) # give some information on the processing diff --git a/pylot/core/analysis/magnitude.py b/pylot/core/analysis/magnitude.py index dc894f67..b65c9ab2 100644 --- a/pylot/core/analysis/magnitude.py +++ b/pylot/core/analysis/magnitude.py @@ -14,7 +14,7 @@ from pylot.core.util.utils import getPatternLine from scipy.optimize import curve_fit from scipy import integrate, signal from pylot.core.io.data import Data -from pylot.core.util.dataprocessing import restitute_data +from pylot.core.util.dataprocessing import restitute_data, read_metadata from pylot.core.util.utils import common_range @@ -141,8 +141,8 @@ class Magnitude(object): def setinvdir(self, invdir): self.invdir = invdir - def getinvdir(self): - return self.invdir + def get_metadata(self): + return read_metadata(self.invdir) def getpicdic(self): return self.picdic @@ -243,7 +243,7 @@ class M0Mw(Magnitude): # call subfunction to estimate source spectrum # and to derive w0 and fc [w0, fc] = calcsourcespec(selwf, picks[key]['P']['mpp'], \ - self.getinvdir(), self.getvp(), delta, az, \ + self.get_metadata(), self.getvp(), delta, az, \ inc, self.getQp(), self.getiplot()) if w0 is not None: @@ -251,8 +251,8 @@ class M0Mw(Magnitude): zdat = selwf.select(component="Z") if len(zdat) == 0: # check for other components zdat = selwf.select(component="3") - [Mo, Mw] = calcMoMw(zdat, w0, self.getrho(), self.getvp(), \ - delta, self.getinvdir()) + [Mo, Mw] = calcMoMw(zdat, w0, self.getrho(), self.getvp(), + delta) else: Mo = None Mw = None @@ -265,7 +265,7 @@ class M0Mw(Magnitude): self.picdic = picks -def calcMoMw(wfstream, w0, rho, vp, delta, inv): +def calcMoMw(wfstream, w0, rho, vp, delta): ''' Subfunction of run_calcMoMw to calculate individual seismic moments and corresponding moment magnitudes.