support for installing liba.pyi during pip install
[liba.git] / python / test / hpf.py
blob892925dc5376dba323150b2408ceb18ac7e0bebc
1 #!/usr/bin/env python
2 import os, sys, math
4 base = os.path.dirname(__file__)
5 path = os.path.dirname(base)
6 sys.path.insert(0, path)
7 if len(sys.argv) > 1:
8 sys.stdout = open(sys.argv[1], "w")
10 import liba # type: ignore
12 Ts = 1.0
13 f_0 = 1.0
14 f_e = 1000.0
15 c = (f_e - f_0) / Ts
16 T = 1.0 / 10000
17 t = 0
18 x = []
19 while t <= Ts:
20 x.append(t)
21 t += T
22 hpf = liba.hpf(10, 0.01)
23 for i in range(len(x)):
24 x1 = math.cos(2 * math.pi * (f_0 * x[i] + 0.5 * c * x[i] * x[i]))
25 print("%g,%g,%g" % (x[i], x1, hpf(x1)))
27 hpf.zero()
28 hpf.alpha
29 hpf.output
30 hpf.input