Skip to content

Commit

Permalink
Merge pull request #7998 from andfoy/fix_sosfilt_zi_fir
Browse files Browse the repository at this point in the history
Fix issues with the initial state when a SOS filter has no IIR part
  • Loading branch information
takagi committed Nov 30, 2023
2 parents 3e86aa0 + 3e7f86f commit b81289d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions cupyx/scipy/signal/_signaltools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1549,6 +1549,7 @@ def sosfilt_zi(sos):
# Take the difference between the non-adjusted output values and
# compute which initial output state would cause them to be constant.
y_zi = cupy.linalg.solve(C1 - C2, y2 - y1)
y_zi = cupy.nan_to_num(y_zi, nan=0, posinf=cupy.inf, neginf=-cupy.inf)
zi_s[0, 2:] = y_zi
x_s, _ = sosfilt(sos_s, x_s, zi=zi_s)

Expand Down

0 comments on commit b81289d

Please sign in to comment.