Coverage for /usr/local/lib/python3.11/dist-packages/pyrocko/evalresp.py: 84%
19 statements
« prev ^ index » next coverage.py v6.5.0, created at 2024-03-07 11:54 +0000
« prev ^ index » next coverage.py v6.5.0, created at 2024-03-07 11:54 +0000
1# http://pyrocko.org - GPLv3
2#
3# The Pyrocko Developers, 21st Century
4# ---|P------/S----------~Lg----------
6'''
7Wrapper for the `evalresp
8<https://ds.iris.edu/ds/nodes/dmc/software/downloads/evalresp/>`_ C library.
9'''
11import time
14class EvalrespNotAvailable(Exception):
15 pass
18def import_ext():
19 try:
20 from pyrocko import evalresp_ext as ext
21 return ext
22 except ImportError:
23 raise EvalrespNotAvailable(
24 'The pyrocko.evalresp module is not supported on your platform.')
27def have_evalresp():
28 try:
29 import_ext()
30 return True
31 except EvalrespNotAvailable:
32 return False
35def evalresp(
36 sta_list='*',
37 cha_list='*',
38 net_code='*',
39 locid='*',
40 instant=None,
41 units='VEL', # VEL, DIS, ACC, DEF
42 file='',
43 freqs=None,
44 rtype='AP', # CS, AP
45 verbose='',
46 start_stage=-1,
47 stop_stage=0,
48 stdio_flag=0,
49 listinterp_out_flag=0,
50 listinterp_in_flag=0,
51 listinterp_tension=1000.0):
53 ext = import_ext()
55 datime = time.strftime('%Y,%j,%H:%M:%S', time.gmtime(instant))
57 return ext.evalresp(sta_list, cha_list, net_code, locid, datime,
58 units, file, freqs, rtype, verbose,
59 start_stage, stop_stage, stdio_flag,
60 listinterp_out_flag, listinterp_in_flag,
61 listinterp_tension)