Skip to content

Commit

Permalink
implement reset! for FIRInterpolator and tests (#626)
Browse files Browse the repository at this point in the history
* implement `reset!` for FIRInterpolator and tests

* bump version to 0.8.2

* repurpose existing test
  • Loading branch information
wheeheee authored Feb 10, 2025
1 parent 4a88779 commit d08699a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "DSP"
uuid = "717857b8-e6f2-59f4-9121-6e50c889abd2"
version = "0.8.1"
version = "0.8.2"

[deps]
Bessels = "0e736298-9ec6-45e8-9647-e4fc86a2fe38"
Expand Down
5 changes: 2 additions & 3 deletions src/Filters/stream_filt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,11 @@ setphase!(self::FIRFilter, ϕ::Real) = setphase!(self.kernel, ϕ)
# reset! filter and its kernel to an initial state
#

# Generic case for FIRInterpolator and FIRStandard
function reset!(kernel::FIRKernel)
function reset!(kernel::FIRStandard)
kernel
end

function reset!(kernel::FIRRational)
function reset!(kernel::Union{FIRRational,FIRInterpolator})
kernel.ϕIdx = 1
kernel.inputDeficit = 1
kernel
Expand Down
5 changes: 3 additions & 2 deletions test/resample.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,10 @@ end
@test y_jl expected_result_3d

# check buffer is resized properly (vs old implementation)
for dims in 1:3
# also test that FIRInterpolator/Decimator is reset!ed properly (issue #625)
for dims in 1:3, rate in (1.2, 0.8, 4, 2//1, 1//2)
A = rand(3, 3, 3)
@test resample(A, 1.2; dims) == mapslices(v -> resample(v, 1.2), A; dims)
@test resample(A, rate; dims) == mapslices(v -> resample(v, rate), A; dims)
end
end

Expand Down

2 comments on commit d08699a

@martinholters
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/124693

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.8.2 -m "<description of version>" d08699ae3cf37f973a7e77054383a8928bf5c2da
git push origin v0.8.2

Please sign in to comment.