Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add frequency estimators by Jacobsen and Quinn #503

Merged
merged 27 commits into from
Mar 1, 2024
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f6d2d76
Add frequency estimators by Jacobsen and Quinn
Jun 28, 2023
d975c51
Use `quinn()` consistently.
Sep 21, 2023
3c14536
Fix bug in complex QF algorithm.
Sep 21, 2023
d222015
Simplify return value by omitting `converged`.
Sep 21, 2023
b58f0bd
Add tests for quinn frequency estimator.
Sep 21, 2023
bb13a66
Add more tests to jacobsen function.
Jan 20, 2024
447d8ad
Update src/estimation.jl
mbaz Jan 23, 2024
573f40d
Update src/estimation.jl
mbaz Jan 23, 2024
a5b55c0
Update src/estimation.jl
mbaz Jan 23, 2024
6ceb76a
Update src/estimation.jl
mbaz Jan 23, 2024
61754ca
Update src/estimation.jl
mbaz Jan 23, 2024
0d6407d
Update src/estimation.jl
mbaz Jan 23, 2024
c3505e9
Update src/estimation.jl
mbaz Jan 23, 2024
b16513d
Fix effects of off-by-one error in `jacobsen`. Improve docstrings.
Jan 25, 2024
9f2a1d5
Add tests for `jacobsen` estimator.
Jan 25, 2024
82f71ad
For clarity, use `N` instead of `T` in `quinn`
Jan 26, 2024
06a9e59
Improve test.
Jan 26, 2024
6df7c4a
Improve `jacobsen` frequency estimator for real inputs
Feb 2, 2024
9d866ae
Merge branch 'master' into quinn-jacobsen
ViralBShah Feb 5, 2024
a4be57e
Remove special-casing of Jacobsen for real signals.
Feb 20, 2024
a30c56a
Merge branch 'quinn-jacobsen' of github.com:mbaz/DSP.jl into quinn-ja…
Feb 20, 2024
0e64809
Merge branch 'master' into quinn-jacobsen
mbaz Feb 21, 2024
8996468
Merge branch 'master' into quinn-jacobsen
mbaz Feb 22, 2024
f60fc0d
Clarify use of Jacobsen for real signals
Feb 22, 2024
d5bb478
Correctly implement wrapping behavior in Jacobsen
Feb 24, 2024
8d0aacc
Update frequency estimation tests to improve code coverage
Feb 25, 2024
64058c6
Merge branch 'master' into quinn-jacobsen
mbaz Feb 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use quinn() consistently.
Miguel Bazdresch committed Sep 21, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit d975c519923dc527775fe515096f0f2ad73dae1e
14 changes: 7 additions & 7 deletions src/estimation.jl
Original file line number Diff line number Diff line change
@@ -77,19 +77,19 @@ function jacobsen(x::Vector{<:Complex}, Fs::Real = 1.0)
end

"""
qf(x::Vector, f0::Real = 0.0, Fs::Real = 1.0 ; tol = 1e-6, maxiters = 20)
quinn(x::Vector, f0::Real = 0.0, Fs::Real = 1.0 ; tol = 1e-6, maxiters = 20)

qf(x::Vector, Fs::Real = 1.0 ; kwargs...)
quinn(x::Vector, Fs::Real = 1.0 ; kwargs...)

qf(x::Vector ; kwargs...)
quinn(x::Vector ; kwargs...)

Algorithms by Quinn and Quinn & Fernandes for frequency estimation. Given a
signal `x` and an initial guess `f0`, estimate and return the frequency of the
largest sinusoid in `x`. `Fs` is the sampling frequency. All frequencies are
expressed in Hz.

If the initial guess `f0` is not provided or if it is equal to zero, then a guess
martinholters marked this conversation as resolved.
Show resolved Hide resolved
is calculated by `qf` using Jacobsen's estimator. The sampling frequency `Fs`
is calculated by `quinn` using Jacobsen's estimator. The sampling frequency `Fs`
defaults to `1.0`.

The following keyword arguments control the algorithm's behavior:
@@ -114,9 +114,9 @@ estimation of frequency", Biometrika, Vol. 78 (1991).
Signal Processing, Vol. 19 (2009), Elsevier.

"""
qf(x ; kwargs...) = qf(x, 0.0, 1.0 ; kwargs...)
quinn(x ; kwargs...) = quinn(x, 0.0, 1.0 ; kwargs...)
mbaz marked this conversation as resolved.
Show resolved Hide resolved

qf(x, Fs ; kwargs...) = qf(x, 0.0, Fs ; kwargs...)
quinn(x, Fs ; kwargs...) = quinn(x, 0.0, Fs ; kwargs...)
mbaz marked this conversation as resolved.
Show resolved Hide resolved

function quinn(x::Vector{<:Real}, f0::Real, Fs::Real ; tol = 1e-6, maxiters = 20)
fₙ = Fs/2
@@ -156,7 +156,7 @@ function quinn(x::Vector{<:Real}, f0::Real, Fs::Real ; tol = 1e-6, maxiters = 20
α = 2β-α
end

fₙ*acos(0.5*β)/π, abs(β) <= 2.0, iter == maxiters
fₙ*acos(0.5*β)/π, abs(β) <= 2.0, iter == maxiters
end

function quinn(x::Vector{<:Complex}, f0::Real, Fs::Real ; tol = 1e-6, maxiters = 20)