Commit 225ac7af authored by Javier's avatar Javier

minor bugs in comp_t0 + error normalization t2E

error finding non-defined id
parent 9c245c00
......@@ -469,6 +469,7 @@ function comp_t0(Y::YData, plat::Vector{Int64}; L::Int64, pl::Bool=false,
replica = size.([Ysl], 1)
#Truncation
if id in keys(ADerrors.wsg.str2id)
n_ws = findfirst(x-> x == ws.str2id[id], ws.map_nob)
if !isnothing(n_ws)
ivrep_ws = ws.fluc[n_ws].ivrep
......@@ -484,6 +485,7 @@ function comp_t0(Y::YData, plat::Vector{Int64}; L::Int64, pl::Bool=false,
error("Automatic truncation failed. R = 1\nTry using truncate_data!")
end
end
end
Ysl = isnothing(rw) ? Ysl : apply_rw(Ysl, rw)
xmax = size(Ysl, 2)
......@@ -552,8 +554,10 @@ function comp_t0(Y::Vector{YData}, plat::Vector{Int64}; L::Int64, pl::Bool=false
if !all(id .== id[1])
error("IDs are not equal")
end
id = id[1]
#Truncation
n_ws = findfirst(x-> x == ws.str2id[id[1]], ws.map_nob)
if id in keys(ADerrors.wsg.str2id)
n_ws = findfirst(x-> x == ws.str2id[id], ws.map_nob)
if !isnothing(n_ws)
ivrep_ws = ws.fluc[n_ws].ivrep
......@@ -571,6 +575,7 @@ function comp_t0(Y::Vector{YData}, plat::Vector{Int64}; L::Int64, pl::Bool=false
end
replica = size.(Ysl, 1)
end
end
Ysl = isnothing(rw) ? Ysl : apply_rw(Ysl, rw)
tmp = Ysl[1]
......@@ -583,7 +588,7 @@ function comp_t0(Y::Vector{YData}, plat::Vector{Int64}; L::Int64, pl::Bool=false
for i = 1:xmax
k = 1
for j = nt0-dt0:nt0+dt0
Y_aux[i, k] = uwreal(tmp[:, i, j], id[1], replica)
Y_aux[i, k] = uwreal(tmp[:, i, j], id, replica)
k = k + 1
end
end
......@@ -629,6 +634,10 @@ end
function t0_guess(t::Vector{Float64}, Ysl::Array{Float64, 3}, plat::Vector{Int64}, L::Int64)
t2E_ax = t.^2 .* mean(mean(Ysl[:, plat[1]:plat[2], :], dims=2), dims=1)[1, 1, :] / L^3
#look for values t2E: t2E > 0.3 and 0.0 < t2E_ax < 0.3
if !(any(t2E_ax .> 0.3) && any((t2E_ax .< 0.3) .& (t2E_ax .> 0.0)))
error("Error finding solutions. Check volume normalization!")
end
t0_aux = minimum(abs.(t2E_ax .- 0.3))
nt0 = findfirst(x-> abs(x - 0.3) == t0_aux, t2E_ax) #index closest value to t0
return nt0
......
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