From 4e520df145e20af55c6e3e033b501ea67cc5bb80 Mon Sep 17 00:00:00 2001 From: Sebastian Wehling-Benatelli Date: Wed, 28 Sep 2016 10:59:50 +0200 Subject: [PATCH] [new] added Wood-Anderson amplitude output for further analysis --- pylot/core/analysis/magnitude.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/pylot/core/analysis/magnitude.py b/pylot/core/analysis/magnitude.py index 085cbe8c..994c2230 100644 --- a/pylot/core/analysis/magnitude.py +++ b/pylot/core/analysis/magnitude.py @@ -126,6 +126,8 @@ class RichterMagnitude(Magnitude): 'sensitivity': 1 } + _amplitudes = dict() + def __init__(self, stream, event, calc_win, verbosity=False, iplot=0): super(RichterMagnitude, self).__init__(stream, event, verbosity, iplot) @@ -141,6 +143,15 @@ class RichterMagnitude(Magnitude): def calc_win(self, value): self._calc_win = value + @property + def amplitudes(self): + return self._amplitudes + + @amplitudes.setter + def amplitudes(self, value): + station, a0 = value + self._amplitudes[station] = a0 + def peak_to_peak(self, st, t0): # simulate Wood-Anderson response @@ -203,11 +214,12 @@ class RichterMagnitude(Magnitude): continue delta = degrees2kilometers(a.distance) onset = pick.time - wapp = self.peak_to_peak(wf, onset) + a0 = self.peak_to_peak(wf, onset) + self.amplitudes = (station, a0) # using standard Gutenberg-Richter relation # TODO make the ML calculation more flexible by allowing # use of custom relation functions - mag = dict(mag=np.log10(wapp) + richter_magnitude_scaling(delta)) + mag = dict(mag=np.log10(a0) + richter_magnitude_scaling(delta)) self.magnitudes = (station, mag)