[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
This commit is contained in:
Sebastian Wehling-Benatelli 2016-09-21 10:27:47 +02:00
parent 777941b669
commit ca7ce5f13c
2 changed files with 9 additions and 10 deletions

View File

@ -1004,9 +1004,8 @@ class MainWindow(QMainWindow):
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, self.inputs.get('rho'), self.inputs.get('vp'), station_mag = calcMoMw(wf, w0, self.inputs.get('rho'),
dist, 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

View File

@ -14,7 +14,7 @@ from pylot.core.util.utils import getPatternLine
from scipy.optimize import curve_fit from scipy.optimize import curve_fit
from scipy import integrate, signal from scipy import integrate, signal
from pylot.core.io.data import Data 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 from pylot.core.util.utils import common_range
@ -141,8 +141,8 @@ class Magnitude(object):
def setinvdir(self, invdir): def setinvdir(self, invdir):
self.invdir = invdir self.invdir = invdir
def getinvdir(self): def get_metadata(self):
return self.invdir return read_metadata(self.invdir)
def getpicdic(self): def getpicdic(self):
return self.picdic return self.picdic
@ -243,7 +243,7 @@ class M0Mw(Magnitude):
# call subfunction to estimate source spectrum # call subfunction to estimate source spectrum
# and to derive w0 and fc # and to derive w0 and fc
[w0, fc] = calcsourcespec(selwf, picks[key]['P']['mpp'], \ [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()) inc, self.getQp(), self.getiplot())
if w0 is not None: if w0 is not None:
@ -251,8 +251,8 @@ class M0Mw(Magnitude):
zdat = selwf.select(component="Z") zdat = selwf.select(component="Z")
if len(zdat) == 0: # check for other components if len(zdat) == 0: # check for other components
zdat = selwf.select(component="3") zdat = selwf.select(component="3")
[Mo, Mw] = calcMoMw(zdat, w0, self.getrho(), self.getvp(), \ [Mo, Mw] = calcMoMw(zdat, w0, self.getrho(), self.getvp(),
delta, self.getinvdir()) delta)
else: else:
Mo = None Mo = None
Mw = None Mw = None
@ -265,7 +265,7 @@ class M0Mw(Magnitude):
self.picdic = picks 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 Subfunction of run_calcMoMw to calculate individual
seismic moments and corresponding moment magnitudes. seismic moments and corresponding moment magnitudes.