1# http://pyrocko.org - GPLv3
2#
3# The Pyrocko Developers, 21st Century
4# ---|P------/S----------~Lg----------
6from . import autopick_ext
7import numpy as num
10class AutopickError(Exception):
11 pass
14def recursive_stalta(
15 tshort, tlong, kshort, klong, kderivative, energytrace,
16 temp=None, inplace=True):
18 if not energytrace.ydata.dtype == num.float32:
19 raise AutopickError(
20 'energytrace given to recursive_stalta() must have data in '
21 'float32 format.')
23 ns = int(round(tshort/energytrace.deltat))
24 nl = int(round(tlong/energytrace.deltat))
26 if temp is None:
27 temp = num.zeros((ns+2,), dtype=num.float32)
29 if not inplace:
30 energytrace = energytrace.copy()
32 autopick_ext.recursive_stalta(
33 ns, nl, kshort/ns, klong/nl, kderivative, energytrace.ydata,
34 temp, temp is None)
36 if inplace:
37 return temp
38 else:
39 return energytrace, temp