1# http://pyrocko.org - GPLv3
2#
3# The Pyrocko Developers, 21st Century
4# ---|P------/S----------~Lg----------
5import time
8class EvalrespNotAvailable(Exception):
9 pass
12def import_ext():
13 try:
14 from pyrocko import evalresp_ext as ext
15 return ext
16 except ImportError:
17 raise EvalrespNotAvailable(
18 'The pyrocko.evalresp module is not supported on your platform.')
21def have_evalresp():
22 try:
23 import_ext()
24 return True
25 except EvalrespNotAvailable:
26 return False
29def evalresp(
30 sta_list='*',
31 cha_list='*',
32 net_code='*',
33 locid='*',
34 instant=None,
35 units='VEL', # VEL, DIS, ACC, DEF
36 file='',
37 freqs=None,
38 rtype='AP', # CS, AP
39 verbose='',
40 start_stage=-1,
41 stop_stage=0,
42 stdio_flag=0,
43 listinterp_out_flag=0,
44 listinterp_in_flag=0,
45 listinterp_tension=1000.0):
47 ext = import_ext()
49 datime = time.strftime('%Y,%j,%H:%M:%S', time.gmtime(instant))
51 return ext.evalresp(sta_list, cha_list, net_code, locid, datime,
52 units, file, freqs, rtype, verbose,
53 start_stage, stop_stage, stdio_flag,
54 listinterp_out_flag, listinterp_in_flag,
55 listinterp_tension)