Commit c0a39dc6 authored by Alberto Ramos's avatar Alberto Ramos

Added minimum window in automatic window procedure

Thanks to R. Sommer
parent c8c82f51
......@@ -18,6 +18,7 @@ const iprm = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41,
167,173,179,181,191,193,197,199,211,223,227,229]
const DEFAULT_STAU = 4.0
const DO_BIN = false
const MINW = 6
is_int32(str::String) = Base.tryparse(Int32, str) !== nothing
......@@ -259,12 +260,12 @@ function wopt_ulli(nd::Int64, stau::Float64, gmm::Vector{Float64})
for i in 2:length(gmm)
tiw = tiw + gmm[i]/gmm[1]
if (tiw <= 0.5)
return i
return maximum(MINW,i)
else
tau = stau/log((2.0*tiw+1.0)/(2.0*tiw-1.0))
gw = exp(-(i-1.0)/tau) - tau/sqrt((i-1.0)*nd)
if (gw < 0.0)
return i
return maximum(MINW,i)
end
end
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment