[Bugfix] Time array improper calculated (rounding errors?)

This commit is contained in:
Ludger Küperkoch 2018-06-26 10:51:39 +02:00
parent 8487d696c6
commit 88ddbc1efc

View File

@ -6,6 +6,7 @@ Revised/extended summer 2017.
:author: Ludger Küperkoch / MAGS2 EP3 working group :author: Ludger Küperkoch / MAGS2 EP3 working group
""" """
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import numpy as np import numpy as np
import obspy.core.event as ope import obspy.core.event as ope
@ -219,7 +220,7 @@ class LocalMagnitude(Magnitude):
sqH = np.sqrt(power_sum) sqH = np.sqrt(power_sum)
# get time array # get time array
th = np.arange(0, len(sqH) * dt, dt) th=np.arange(0, st[0].stats.npts/st[0].stats.sampling_rate, st[0].stats.delta)
# get maximum peak within pick window # get maximum peak within pick window
iwin = getsignalwin(th, t0 - stime, self.calc_win) iwin = getsignalwin(th, t0 - stime, self.calc_win)
ii = min([iwin[len(iwin) - 1], len(th)]) ii = min([iwin[len(iwin) - 1], len(th)])