function gevp_GPOF_BMA(ensinfo::EnsInfo,corr::Vector{juobs.Corr};N::Int64=4,TA::Vector{Int64}=[2],TB::Vector{Int64}=[7,8],pl::Bool=true,wpm::Union{Nothing,Dict{String,Vector{Float64}}}=nothing)
new_corr=gevp_GPOF(ensinfo,corr,N=N,TA=TA,TB=TB)
@.one_exp_fit(x,p)=p[1]+p[2]*exp(-p[3]*x)
Nparam=3
y0=getfield(corr[1],:y0)
T=length(corr[1].obs)-y0
# fit time ranges for bayesian_av
tmin=collect(10:12)
tmax=collect(T-40:T-39)
MAve=Vector{uwreal}(undef,length(corr))
forkineachindex(new_corr)# mass index
AIC=Vector{Float64}(undef,0)
Masses=Vector{uwreal}(undef,0)
forjineachindex(new_corr[k])# ta and tb gevp index
function plot_cat_tot(cat::Vector{Cat},ylab::LaTeXString;xlabel::Union{Nothing,Vector{Vector{String}}}=nothing,Wlabel::String="TIC",cut::Float64=2.5,save::Bool=false)
@@ -560,6 +562,74 @@ function plot_hist(cat::Vector{Cat} ; save::Bool=false)
end
## PLOT FOR FDS/fD
function plot_chi_fds_ratio(c::Cat,ff_vec::Vector{Function},ylab::LaTeXString,phi2_ph::uwreal,ensinfo::Vector{EnsInfo};p::Union{String,Nothing}=nothing,n::Union{Nothing,Int64}=nothing)
@@ -60,14 +68,14 @@ function read_t0(path::String, ens::String, dtr::Int64)
end
end
# in this function you have to implement the tsm reader
function get_corr(path::String,ens::EnsInfo,g1::String="G5",g2::String="G5";rw::Bool=false,legacy::Bool=false,path_rw::String="",tsm::Bool=false)
function get_corr(path::String,ens::EnsInfo,g1::String="G5",g2::String="G5";rw::Bool=false,legacy::Bool=false,path_rw::String="",tsm::Bool=false,ex::Bool=false)
This method takes as input an EnsInfo object and a vector of Corr. For each element of the vector a 2x2 matrix is computed where each element of the matrix is shifted by a tau=4 value in time.
It is used for gevp problem with single gamma structure and a tau shift in time.
The method return a vector of MatInfo for each element of the vector Corr, corresponding to different masses
"""
function comp_mat_tau_shift(ensinfo::EnsInfo,tot_obs::Vector{juobs.Corr},tau::Int64)
@@ -265,42 +351,43 @@ function gevp_mass(mat_obs::Vector{MatInfo}, path_plat::String; t0::Int64=2,pl::
end
returnplat_en0
end
function gevp_mass(mat_obs::Vector{MatInfo},path_m_ps::String,path_m_vec::String;t0::Int64=2,pl::Bool=true,wpm::Union{Nothing,Dict{Int64,Vector{Float64}}}=nothing)
function gevp_mass(mat_obs::Vector{MatInfo},path_m_ps::String,path_m_vec::String;t0::Int64=2,pl::Bool=true,wpm::Union{Nothing,Dict{String,Vector{Float64}}}=nothing)
y0s=getfield.(mat_obs,:y0)
mu_list=getfield.(mat_obs,:mu)
plat_en0=Vector{uwreal}(undef,length(mat_obs))
plat_en1=Vector{uwreal}(undef,length(mat_obs))
foriin1:length(mat_obs)
mat=getfield(mat_obs[i],:mat_list)#matrices to diagonalise for a given sector [i]
mat=getfield(mat_obs[i],:mat_list)#[y0s[i]+1:end-1] #matrices to diagonalise for a given sector [i]
evals=getall_eigvals(mat,t0)
en=energies(evals,wpm=wpm)#ground and excited state energy
This function takes as input a vector of MatInfo and for each of them solve the associated eigenvalue problem.
Then, the ground state energies extracted from the eigenvalues are fitted varying several time ranges and a Bayesian Model Average
is performed to asses a final result.
It can be used with both MatInfo with different gamma structure (comp_mat_multigamma) and with MatInfo with time shifts (comp_mat_tau_shift)
The method returns the weighted average of the ground state energy for each element of the vector of MatInfo.
"""
function gevp_mass_BMA(mat_obs::Vector{MatInfo};tt0::Int64=2,pl::Bool=true,wpm::Union{Nothing,Dict{String,Vector{Float64}}}=nothing,path_plt::Union{String,Nothing}=nothing)
This method takes as input an EnsInfo object and a vector of Correlators.
Then it calls comp_mat_GPOF to compute a matrix a la BMW. For each TA, TB, a gevp is solved and the corresponding eigenvectors are used to project the original correlators
to the ground state.
This function return a vector of vector of uwreal, where the first index correspond to the index in mass of the original corr vector passed as input,
while the second index labels different choices of ta and tb for the GEVP.
"""
function gevp_GPOF(ensinfo::EnsInfo,corr::Vector{juobs.Corr};N::Int64=4,TA::Vector{Int64}=[2,4],TB::Vector{Int64}=[7,8])
This function takes as input an EnsInfo object and a vector of Corr.
A projection to the ground state using gevp_GPOF is built for each element of corr. Then the new_corr is used to compute effective maasses
and finally the latter are fitted several times by varying the time ranges. Eventually, a BMA is performed (bayesian_av) for each value of the mass.
It returns a vector of uwreal containing the weighted averaged results for each value of the mass.
"""
function gevp_GPOF_BMA(ensinfo::EnsInfo,corr::Vector{juobs.Corr};N::Int64=4,TA::Vector{Int64}=[2],TB::Vector{Int64}=[7,8],pl::Bool=true,wpm::Union{Nothing,Dict{String,Vector{Float64}}}=nothing)
new_corr=gevp_GPOF(ensinfo,corr,N=N,TA=TA,TB=TB)
@.one_exp_fit(x,p)=p[1]+p[2]*exp(-p[3]*x)
Nparam=3
y0=getfield(corr[1],:y0)
T=length(corr[1].obs)-y0
# fit time ranges for bayesian_av
tmin=collect(14:16)
tmax=collect(T-35:T-34)
MAve=Vector{uwreal}(undef,length(corr))
forkineachindex(new_corr)# mass index
AIC=Vector{Float64}(undef,0)
Masses=Vector{uwreal}(undef,0)
forjineachindex(new_corr[k])# ta and tb gevp index
function gevp_dec(mat_obs::Vector{MatInfo},mass::Vector{uwreal},path_plat::String;t0::Int64=2,wpm::Union{Nothing,Dict{Int64,Vector{Float64}}}=nothing,pl::Bool=true,n::Int64=1,pseudo::Bool=true,wilson::Bool=false)
y0s=getfield.(mat_obs,:y0)
mu_list=getfield.(mat_obs,:mu)
...
...
@@ -334,6 +628,47 @@ function gevp_dec(mat_obs::Vector{MatInfo}, mass::Vector{uwreal}, path_plat::Str
end
returnplat_dec0,data
end
function gevp_dec_BMA(mat_obs::Vector{MatInfo},mass::Vector{uwreal};t0::Int64=2,wpm::Union{Nothing,Dict{String,Vector{Float64}}}=nothing,pl::Bool=true,n::Int64=1,pseudo::Bool=true,wilson::Bool=false)
y0s=getfield.(mat_obs,:y0)
mu_list=getfield.(mat_obs,:mu)
plat_dec0=Vector{uwreal}(undef,length(mat_obs))
data=Vector{Vector{uwreal}}(undef,0)
foriineachindex(mat_obs)
mat=getfield(mat_obs[i],:mat_list)#matrices to diagonalise for a given sector [i]
evecs=getall_eig(mat,t0)
elem=mat_elem(evecs,mat,mass[i],n)#ground and excited state energy
# println("Decay constant for the ensemble ", mat_obs[i].ensinfo.id, " failed in the sector ", mu_list[i], " pseudo sector?", pseudo)
# println("The associated effective mass is ", mass[i])
# plat_dec0[i] = uwreal(0)
#end
end
returnplat_dec0,data
end
function mat_elem(evec::Vector{Matrix{uwreal}},ct_mat::Vector{Matrix{uwreal}},mass::uwreal,n::Int64)
t=length(evec)
res=Vector{uwreal}(undef,t)
...
...
@@ -366,6 +701,13 @@ function dec(mat_elem::Vector{uwreal}, plat::Array{Int64}, mass::uwreal, mu::Vec
returnsqrt(2/mass)*aux
end
end
function dec_automatic_plat(mat_elem::uwreal,mass::uwreal,mu::Vector{Float64};pl::Bool=true,wilson::Bool=false)
if!wilson
returnsqrt(2/(mass)^3)*sum(mu)*mat_elem
else
returnsqrt(2/mass)*mat_elem
end
end
function vec_dec(mat_elem::Vector{uwreal},plat::Array{Int64},mass::uwreal;pl::Bool=true)
aux=plat_av(mat_elem,plat)
ifpl
...
...
@@ -418,6 +760,101 @@ function get_fstar_tm(obs::Vector{juobs.Corr}, m::Vector{uwreal}, ens::EnsInfo,
plat=select_plateau(ens,mu_list,path_plat)
returndec_const_w.(obs,obs,plat,m,pl=pl,wpm=wpm)
end
"""
This function computes the decay constant for wilson twisted mass fermions and perform a
bayesian model average for plateau determination.
"""
function get_f_tm_BMA(corr::Vector{juobs.Corr},m::Vector{uwreal},ens::EnsInfo;pl::Bool=true,wpm::Union{Dict{Int64,Vector{Float64}},Dict{String,Vector{Float64}},Nothing}=nothing,