Commit 02ca2136 authored by Alessandro 's avatar Alessandro

tools for gevp analysis added

parent b75eaed5
function read_dat(ens::String, g1::String="G5", g2::String="G5")
path = joinpath(path_data, ens)
rep = readdir(path, join=true)
aux = read_mesons.(rep, g1, g2)
res = []
for j =1:length(aux[1])
aux2 = [aux[i][j] for i =1:length(aux)]
push!(res, aux2)
end
return res
end
function get_mu(mu_list::Vector{Vector{Float64}}, deg::Bool)
mu_sorted = unique(sort(minimum.(mu_list)))
mul = mu_sorted[1]
deg ? mus = 0.0 : mus = mu_sorted[2]
muh = unique(maximum.(mu_list))
muh = filter(x-> x > mul && x > mus, muh)
return mul, mus, muh
end
function get_lh(mu_list, obs::Array{juobs.Corr}, deg::Bool)
mul, mus, muh = get_mu(mu_list, deg)
obs_lh = Array{juobs.Corr}(undef, 0)
for k = 1:length(mu_list)
mu = mu_list[k]
if mul in mu && mu[1] != mu[2] && !(mus in mu) #l-h
push!(obs_lh, obs[k])
end
end
return obs_lh
end
function get_lh(mu_list, obs::Vector{Vector{juobs.Corr}}, deg::Bool)
mul, mus, muh = get_mu(mu_list, deg)
obs_lh = Array{Array{juobs.Corr}}(undef, length(obs), length(muh))
for n_obs = 1:length(obs)
obs_lh[n_obs] = get_lh(mu_list, obs[n_obs], deg)
end
return obs_lh
end
function get_sh(mu_list, obs::Array{juobs.Corr}, deg::Bool)
mul, mus, muh = get_mu(mu_list, deg)
obs_sh = Array{juobs.Corr}(undef, 0)
for k = 1:length(mu_list)
mu = mu_list[k]
if mus in mu && mu[1] != mu[2] && !(mul in mu)#s-h
push!(obs_sh, obs[k])
end
end
return obs_sh
end
function get_sh(mu_list, obs::Vector{Vector{juobs.Corr}}, deg::Bool)
mul, mus, muh = get_mu(mu_list, deg)
obs_sh = Array{Array{juobs.Corr}}(undef, length(obs), length(muh))
for n_obs = 1:length(obs)
obs_sh[n_obs] = get_sh(mu_list, obs[n_obs], deg)
end
return obs_sh
end
function get_hh(mu_list, obs::Array{juobs.Corr}, deg::Bool)
mul, mus, muh = get_mu(mu_list, deg)
obs_hh = Array{juobs.Corr}(undef,0)
for k = 1:length(mu_list)
mu = mu_list[k]
for i =1:length(muh)
if muh[i] in mu && mu[1] == mu[2]#h-h
push!(obs_hh, obs[k])
end
end
end
return obs_hh
end
function get_hh(mu_list, obs::Vector{Vector{juobs.Corr}}, deg::Bool)
mul, mus, muh = get_mu(mu_list, deg)
obs_hh = Array{Array{juobs.Corr}}(undef, length(obs), length(muh))
for n_obs = 1:length(obs)
obs_hh[n_obs] = get_hh(mu_list, obs[n_obs], deg)
end
return obs_hh
end
mutable struct infoMatt
mat::Vector{Matrix}
mu::Vector{Float64}
y0::Int64
function infoMatt(a11::juobs.Corr, a12::Array{juobs.Corr}, a22::Array{juobs.Corr})
mu = getfield(a11, :mu)
y0 = Int64(getfield(a11, :y0))
diag = [a11.obs, a22[1].obs.+a22[2].obs.+a22[3].obs]
subdiag = [a12[1].obs.+a12[2].obs.+a12[3].obs]
mat = get_matrix(diag, subdiag)
return new(mat, mu, y0)
end
end
function comp_mat(tot11::Array{juobs.Corr}, tot12::Array{Array{juobs.Corr}}, tot22::Array{Array{juobs.Corr}})
mu = getfield.(tot11,:mu)
res = Array{infoMatt}(undef, length(mu))
for i = 1:length(mu)
res[i]= infoMatt(tot11[i], [tot12[1][i],tot12[2][i],tot12[3][i]], [tot22[1][i],tot22[2][i],tot22[3][i]])
end
return res
end
function comp_energy(tot11::Array{juobs.Corr}, tot12::Array{Array{juobs.Corr}}, tot22::Array{Array{juobs.Corr}})
aux_mat = comp_mat(tot11, tot12, tot22)
y0 = getfield(aux_mat[1], :y0)
res_en = Array{infoEn}(undef, length(aux_mat))
for i = 1:length(aux_mat)
mat_obs = getfield(aux_mat[i], :mat)[y0:end-1]
evalues = uwgevp_tot(mat_obs, 5)
res_en[i] = infoEn(energies(evalues), aux_mat[i])
end
return res_en
end
mutable struct infoEn
en_val::Array{Array{uwreal}}
mu::Vector{Float64}
y0::Int64
function infoEn(energ::Array{Array{uwreal}},matr::infoMatt )
en_val = energ
mu = getfield(matr,:mu)
y0 = getfield(matr,:y0)
new(en_val, mu, y0)
end
end
\ No newline at end of file
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