Skip to content

Commit

Permalink
refactor: change default findsignal(fast=true)
Browse files Browse the repository at this point in the history
  • Loading branch information
mchitre committed Aug 18, 2023
1 parent dc9a7f6 commit c49f33e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/dsp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -582,10 +582,12 @@ julia> y4[513:512+length(x4)] += 0.6 * real(x4) # time 0.003125π“ˆ, index 129
julia> y = resample(y4, 1//4)
julia> y .+= 0.1 * randn(length(y))
julia> findsignal(x, y, 3)
([33, 64, 129], [0.000781, 0.001538, 0.003125], ComplexF64[...])
julia> findsignal(x, y, 3; fast=false)
([33, 64, 129], [0.000775, 0.001545, 0.003124], ComplexF64[...])
```
"""
function findsignal(r, s, n=1; prominance=0.2, fast=false)
function findsignal(r, s, n=1; prominance=0.2, fast=true)
# coarse arrival time estimation
r = analytic(r)
r = r / std(r)
Expand Down
6 changes: 5 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,11 @@ end
y4[513:512+length(x4)] += 0.6 * real(x4) # time 0.003125π“ˆ, index 129.0
y = resample(y4, 1//4)
y .+= 0.1 * randn(length(y))
p, t, a = findsignal(x, y, 3)
p, t, a = findsignal(x, y, 3; fast=false)
@test p == [33, 64, 129]
@test t β‰ˆ [0.000775, 0.001545, 0.003124] atol=2e-6
@test real(a) / real(a[1]) β‰ˆ [1.0, -0.8, 0.6] atol=1e-2
p, t, a = findsignal(x, y, 3; fast=true)
@test p == [33, 64, 129]
@test t β‰ˆ [0.000775, 0.001545, 0.003124] atol=1e-5
@test real(a) / real(a[1]) β‰ˆ [1.0, -0.8, 0.6] atol=1e-2
Expand Down

0 comments on commit c49f33e

Please sign in to comment.