diff --git a/src/traditional_de/estimate_delay.jl b/src/traditional_de/estimate_delay.jl index 4c1b2aa..40efcb0 100644 --- a/src/traditional_de/estimate_delay.jl +++ b/src/traditional_de/estimate_delay.jl @@ -51,11 +51,9 @@ function estimate_delay(x::AbstractVector, method::String, return mincrossing(c, τs) elseif method=="exp_decay" c = autocor(x, τs; demean=true) - if any(x -> x ≤ 0, c) - error("The correlation function has elements that are ≤ 0. "* - "We can't fit an exponential to it. Please choose another method.") - end - τ = exponential_decay_fit(τs, c) + idx = length(c) + idx = findfirst(<(0), c) + τ = exponential_decay_fit(τs[:idx], c[:idx]) return round(Int,τ) elseif method=="exp_extrema" c = autocor(x, τs; demean=true)