update 50
This commit is contained in:
parent
2cec38a1c1
commit
46e594d5e7
2 changed files with 4 additions and 7 deletions
|
@ -55,7 +55,6 @@ def c_render2(xs, cascade, phase=False):
|
||||||
def c_render3(xs, cascade, mode='magnitude'):
|
def c_render3(xs, cascade, mode='magnitude'):
|
||||||
"""c_render optimized and specifically for first/second-order filters"""
|
"""c_render optimized and specifically for first/second-order filters"""
|
||||||
import numexpr as ne
|
import numexpr as ne
|
||||||
j = np.complex(0, 1)
|
|
||||||
|
|
||||||
# obviously this could be extended to higher orders
|
# obviously this could be extended to higher orders
|
||||||
eq2 = '(b0 + b1*s + b2*s**2)/(a0 + a1*s + a2*s**2)'
|
eq2 = '(b0 + b1*s + b2*s**2)/(a0 + a1*s + a2*s**2)'
|
||||||
|
@ -91,15 +90,15 @@ def c_render3(xs, cascade, mode='magnitude'):
|
||||||
fa = freq - step
|
fa = freq - step
|
||||||
fb = freq + step
|
fb = freq + step
|
||||||
|
|
||||||
s = xs/fa*j
|
s = xs/fa*1j
|
||||||
ya = ne.evaluate(eq)
|
ya = ne.evaluate(eq)
|
||||||
s = xs/fb*j
|
s = xs/fb*1j
|
||||||
yb = ne.evaluate(eq)
|
yb = ne.evaluate(eq)
|
||||||
|
|
||||||
slope = (yb - ya)/(2*step)
|
slope = (yb - ya)/(2*step)
|
||||||
ys += -slope/(xs/freq*tau)
|
ys += -slope/(xs/freq*tau)
|
||||||
else:
|
else:
|
||||||
s = xs/freq*j
|
s = xs/freq*1j
|
||||||
ys += ne.evaluate(eq)
|
ys += ne.evaluate(eq)
|
||||||
if mode == 'phase':
|
if mode == 'phase':
|
||||||
ys = degrees_clamped(ys)
|
ys = degrees_clamped(ys)
|
||||||
|
|
|
@ -44,9 +44,7 @@ def tsp(N, m=0.5):
|
||||||
# this has been tweaked to prevent overflow:
|
# this has been tweaked to prevent overflow:
|
||||||
s = np.square(np.arange(NN2 + 1) / NN)
|
s = np.square(np.arange(NN2 + 1) / NN)
|
||||||
|
|
||||||
j = np.complex(0, 1)
|
H = np.exp(4j * M * np.pi * s)
|
||||||
|
|
||||||
H = np.exp(j * 4 * M * np.pi * s)
|
|
||||||
H2 = np.r_[H, np.conj(H[1:NN2][::-1])]
|
H2 = np.r_[H, np.conj(H[1:NN2][::-1])]
|
||||||
|
|
||||||
x = np.fft.ifft(H2)
|
x = np.fft.ifft(H2)
|
||||||
|
|
Loading…
Add table
Reference in a new issue