Skip to content

Commit

Permalink
Avoid BoundsError in groupzp (#433)
Browse files Browse the repository at this point in the history
* Avoid `BoundsError` in `groupzp`

Fixes #432.

* Bump version to 0.7.1
  • Loading branch information
martinholters authored Jun 17, 2021
1 parent eb4f8d7 commit 44b5117
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
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.7.0"
version = "0.7.1"

[deps]
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
Expand Down
3 changes: 3 additions & 0 deletions src/Filters/coefficients.jl
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,9 @@ function groupzp(z, p)
groupedz[i] = splice!(z, closest_zero_idx)
if !isreal(groupedz[i])
i += 1
if closest_zero_idx > length(z)
closest_zero_idx = length(z)
end
groupedz[i] = splice!(z, closest_zero_idx)
end
i += 1
Expand Down
11 changes: 11 additions & 0 deletions test/filter_conversion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -344,3 +344,14 @@ end
@test coefb(f) == [0.0, 0.0, 1.0]
end
end

@testset "issue #432" begin
bp1 = 0.75
bp2 = 10.0
Fsamp = 180
responsetype = Bandpass(bp1, bp2; fs = Fsamp)
designmethod = Elliptic(11, 0.25, 40)
bpass = digitalfilter(responsetype, designmethod)
H = SecondOrderSections(bpass) # this shouldn't throw
@test H isa SecondOrderSections
end

2 comments on commit 44b5117

@martinholters
Copy link
Member Author

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/39007

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.7.1 -m "<description of version>" 44b5117cc36be2898f9be665ea47e60dc647d0cd
git push origin v0.7.1

Please sign in to comment.