Skip to content

Commit

Permalink
Remove lint
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettj403 committed Dec 20, 2024
1 parent 7de6bc3 commit 22f95cd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions czt.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,16 @@ def iczt(X, N=None, W=None, A=1.0, simple=True, t_method="scipy", f_method="nump
k = np.arange(n)
Wk22 = W ** (-(k ** 2) / 2)
x = Wk22 * X

# See https://github.com/garrettj403/CZT/issues/17
u = (-1) ** k * W ** (k * (k - n + 0.5) + (n / 2 - 0.5) * n) # /p is removed from here (1)
u = (-1) ** k * W ** (k * (k - n + 0.5) + (n / 2 - 0.5) * n) # /p is removed from here (1)
p = np.r_[1, W ** k[1:] - 1]
lp = np.abs(p) # lp stand for ln(p)
lp = np.abs(p) # lp stands for ln(p)
lp = np.cumsum(np.log(lp)) + np.angle(np.cumprod(p/lp))*1j
# above seperate the magnitude and angle of the entries in p
# it cumsum magnitude in log domain to replace the unstable cumprod of the magnitude
# and cumprod only the normalized angle to ensure the angle is also stable when X is long
u /= np.exp(lp+lp[::-1]) # /p from (1) is moved to here as +lp in exp()
u /= np.exp(lp+lp[::-1]) # /p from (1) is moved to here as +lp in exp()

z = np.zeros(n, dtype=complex)
uhat = np.r_[0, u[-1:0:-1]]
Expand Down

0 comments on commit 22f95cd

Please sign in to comment.