Skip to content

Commit d08699a

Browse files
authored
implement reset! for FIRInterpolator and tests (#626)
* implement `reset!` for FIRInterpolator and tests * bump version to 0.8.2 * repurpose existing test
1 parent 4a88779 commit d08699a

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "DSP"
22
uuid = "717857b8-e6f2-59f4-9121-6e50c889abd2"
3-
version = "0.8.1"
3+
version = "0.8.2"
44

55
[deps]
66
Bessels = "0e736298-9ec6-45e8-9647-e4fc86a2fe38"

src/Filters/stream_filt.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,12 +244,11 @@ setphase!(self::FIRFilter, ϕ::Real) = setphase!(self.kernel, ϕ)
244244
# reset! filter and its kernel to an initial state
245245
#
246246

247-
# Generic case for FIRInterpolator and FIRStandard
248-
function reset!(kernel::FIRKernel)
247+
function reset!(kernel::FIRStandard)
249248
kernel
250249
end
251250

252-
function reset!(kernel::FIRRational)
251+
function reset!(kernel::Union{FIRRational,FIRInterpolator})
253252
kernel.ϕIdx = 1
254253
kernel.inputDeficit = 1
255254
kernel

test/resample.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,10 @@ end
6464
@test y_jl expected_result_3d
6565

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

0 commit comments

Comments
 (0)