1# http://pyrocko.org - GPLv3 

2# 

3# The Pyrocko Developers, 21st Century 

4# ---|P------/S----------~Lg---------- 

5 

6from . import autopick_ext 

7import numpy as num 

8 

9 

10class AutopickError(Exception): 

11 pass 

12 

13 

14def recursive_stalta( 

15 tshort, tlong, kshort, klong, kderivative, energytrace, 

16 temp=None, inplace=True): 

17 

18 if not energytrace.ydata.dtype == num.float32: 

19 raise AutopickError( 

20 'energytrace given to recursive_stalta() must have data in ' 

21 'float32 format.') 

22 

23 ns = int(round(tshort/energytrace.deltat)) 

24 nl = int(round(tlong/energytrace.deltat)) 

25 

26 if temp is None: 

27 temp = num.zeros((ns+2,), dtype=num.float32) 

28 

29 if not inplace: 

30 energytrace = energytrace.copy() 

31 

32 autopick_ext.recursive_stalta( 

33 ns, nl, kshort/ns, klong/nl, kderivative, energytrace.ydata, 

34 temp, temp is None) 

35 

36 if inplace: 

37 return temp 

38 else: 

39 return energytrace, temp