Skip to content

Commit

Permalink
fix filtfilt pad length
Browse files Browse the repository at this point in the history
  • Loading branch information
wheeheee committed Jan 23, 2025
1 parent 0aad92d commit 2ef0e05
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Filters/filt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,10 @@ end
# Zero phase digital filtering for second order sections
function filtfilt(f::SecondOrderSections{:z,T,G}, x::AbstractArray{S}) where {T,G,S}
zi = filt_stepstate(f)
pad_length = 6 * length(f.biquads)
pad_length = min(6 * length(f.biquads), size(x, 1) - 1)
t = promote_type(T, G, S)
zitmp = similar(zi, t)
extrapolated = Vector{t}(undef, size(x, 1)+pad_length*2)
extrapolated = Vector{t}(undef, size(x, 1) + pad_length * 2)
out = similar(x, t)

for col in CartesianIndices(axes(x)[2:end])
Expand Down

0 comments on commit 2ef0e05

Please # to comment.