Commit e56a3bed authored by Alessandro 's avatar Alessandro

Analysis updated with new HAWK ensembles. New functional forms, general updates

parent 9fdef14c
......@@ -32,6 +32,14 @@ ll 65 80
lh 67 80
hh 67 85
t0 20 80
#D450
ll 79 100
ls 85 105
lh 78 88
ss 85 105
sh 85 100
hh 90 120
t0 25 100
#N300
ll 78 105
lh 92 108
......@@ -90,6 +98,14 @@ ss 123 140
sh 130 145
hh 133 175
t0 25 170
#E250
ll 120 148
ls 123 140
lh 125 145
ss 123 140
sh 130 145
hh 133 175
t0 25 170
#J500
ll 120 148
ls 123 140
......
......@@ -6,31 +6,35 @@ ens_db = Dict(
"H105r002" => [32, 3.4, false, 0.12151, 2, nothing],
"H101" => [32, 3.4, true, 0.17979, 2, nothing],
"H400" => [32, 3.46, true, 0.16345, 1, nothing],
"D450" => [64, 3.46, false, 0.0, 1, nothing],
"N200" => [48, 3.55, false, 0.09222, 1, nothing],
"N202" => [48, 3.55, true, 0.13407, 2, nothing],
"N203" => [48, 3.55, false, 0.11224, 1, nothing],
"D200" => [64, 3.55, false, 0.06611, 2, 100],
"N300" => [48, 3.70, true, 0.10630, 1, nothing],
"N300r002" => [48, 3.70, true, 0.10630, 1, nothing],
"N302" => [48, 3.70, false, 0.10630, 1, nothing],
"J303" => [64, 3.70, false, 0.06514, 2, nothing],
"E300" => [96, 3.70, false, 0.00000, 1, nothing],
"E250" => [96, 3.55, false, 0.00000, 1, nothing],
"J500" => [64, 3.85, true, 0.00000, 2, nothing],
"J501" => [64, 3.85, false, 0.00000, 2, nothing],
"J501" => [64, 3.85, false, 0.00000, 1, nothing],
)
trunc_db = Dict(
"H102r002" => nothing,
#"H102r001" => nothing,
"H105r002" => nothing,
"H101" => [1001,1009],
"H101" => nothing,
"H400" => nothing,
"D450" => nothing,
"N200" => nothing,
"N202" => nothing,
"N203" => nothing,
"D200" => 645, #1000
"N300" => 1279,
"D200" => nothing, #1000
"N300r002" => 1521,
"N302" => nothing,
"J303" => 721,
"E300" => nothing,
"J303" => nothing,
"E300" => 1136,
"E250" => 751,
"J500" => [745,649], #[751, 655],
"J501" => nothing
......@@ -46,17 +50,18 @@ ens_nms = Dict(
"N202" => 899,
"N203" => 1543,
"D200" => 2001,
"N300" => 1540,
"N300r002" => 1540,
"N302" => 2201,
"J303" => 1073,
"E300" => 1139
"E300" => 1139,
"J500" => 1875
)
#PDG
const hc = 197.3269804 #MeV fm
const M_values = [1869.65, 2010.26, 1968.34, 2112.2, 2980.3, 3096.916] #MD, MD*, MDs, MDs*, \eta_c, J/\psi (MeV)
const M_error = [0.05, 0.05, 0.07, 0.4, 1.2, 0.011]
const M_values = [1869.58, 2010.26, 1968.34, 2112.2, 2983.9, 3096.916] #MD, MD*, MDs, MDs*, \eta_c, J/\psi (MeV)
const M_error = [0.09, 0.05, 0.07, 0.4, 0.9, 0.011]
#1802.05243
const b_values = [3.40, 3.46, 3.55, 3.70, 3.85]
const b_values2 = [3.40, 3.46, 3.55, 3.70]
......@@ -67,8 +72,8 @@ const ZM_tm_error = [42, 33, 42, 48, 55] .* 1e-4
#1608.08900
const t0_data = [2.86, 3.659, 5.164, 8.595, 14.040]
const t0_error = [11, 16, 18, 29, 49] .* 1e-3
const t0_ph_value = #=[0.415] =# [0.4137]
const t0_ph_error = ones(1,1) .* #=4e-3 =# 3.6e-3
const t0_ph_value = #=[0.415] =# [0.1445*sqrt(8)]
const t0_ph_error = ones(1,1) .* #=4e-3 =# 0.00058*sqrt(8)
# 1808.09236
const ZA_data = [0.75642, 0.76169, 0.76979, 0.78378, 0.79667]
const ZA_err = [72, 93, 43, 47, 47] .*1e-5
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -50,14 +50,14 @@ const path_bdio_tm_shifted = "/Users/alessandroconigli/Lattice/data/bdio_charm/t
const path_plot = "/Users/alessandroconigli/MyDrive/phd/analysis/charm_gevp_2022/CharmPaper/plots" # path were to save plots
# ensembles to analyse
const ens_list = [ "E300"]
const ens_list = [ "N203"]
# reweighting and mass shift flags
const rwf = true
println("Warning! mass_shift set to false ")
# println("Warning! mass_shift set to false ")
const mass_shift = false
const tau = 3 # gevp shift parameter
const T0 = 2
const TSM = true # set whether TSM is used or not
const TSM = false # set whether TSM is used or not
#@warning("\nTSM FLAG MODE: $(TSM)\n")
......@@ -89,9 +89,12 @@ wpmm["N200"] = [-1.0, 2.0, -1.0, -1.0] #14.0*5.164]
wpmm["N203"] = [-1.0, 2.0, -1.0, -1.0] # 14.0*5.164]
#wpmm["D200"] = [-1.0, 4.0, -1.0, 14.0*5.164]
wpmm["D200"] = [-1.0, 2.0, -1.0, -1.0]
wpmm["N300"] = [-1.0, 2.0, -1.0, -1.0 ] #14.0*8.595]
wpmm["N300r002"] = [-1.0, 2.0, -1.0, -1.0 ] #14.0*8.595]
wpmm["N302"] = [-1.0, 2.0, -1.0, -1.0 ] #14.0*8.595]
wpmm["J303"] = [-1.0, 2.0, -1.0, -1.0 ] #14.0*8.595]
wpmm["J500"] = [-1.0, 2.0, -1.0, -1.0 ] #14.0*8.595]
wpmm["J501"] = [-1.0, 2.0, -1.0, -1.0 ] #14.0*8.595]
wpmm["E250"] = [-1.0, 2.0, -1.0, -1.0 ] #14.0*8.595]
## TESTING TSM WITH MULTIPLE replicas
data_sl = read_data_sloppy(path_data_tm, "E300", "G5", "G5", legacy=false)
......@@ -121,12 +124,13 @@ obs_tm = Vector(undef, length(ensinfo))
@time begin
@showprogress for (k,ens) in enumerate(ensinfo)
println("\n Ensemble: ", ens.id)
# pp corr
corr_pp[k], pp_tmW[k], _ = get_corr(path_data_tm, ens, "G5", "G5", rw=rwf, path_rw=path_rw, tsm=TSM)
# t0
t0_ens, yw_store[k], w_store[k] = get_t0(path_data_w, ens, rw=rwf, path_rw=path_rw, pl=true)
obs_tm[k] = OrderedDict()
obs_tm[k]["t0"] = t0_ens
# correlators
corr_pp[k], pp_tmW[k], _ = get_corr(path_data_tm, ens, "G5", "G5", rw=rwf, path_rw=path_rw, tsm=TSM)
a1a1, _ = get_corr(path_data_tm, ens, "G1G5", "G1G5", rw=rwf, path_rw=path_rw, tsm=TSM)
a2a2, _ = get_corr(path_data_tm, ens, "G2G5", "G2G5", rw=rwf, path_rw=path_rw, tsm=TSM)
......@@ -144,6 +148,36 @@ obs_tm = Vector(undef, length(ensinfo))
end
end
## plots for paper of D, D_s and eta_c correlators
yyd = corr_pp[1][4].obs; uwerr.(yyd)
yyds = corr_pp[1][5].obs; uwerr.(yyds)
yyeta = corr_pp[1][6].obs; uwerr.(yyeta)
xx = collect(1:length(yyd))
errorbar(xx, value.(yyd), err.(yyd).*50, fmt="s", color="forestgreen", capsize=2, mfc="none", label=L"$D$")
errorbar(xx, value.(yyds), err.(yyds).*50, fmt="s", color="tomato", capsize=2, mfc="none", label=L"$D_s$")
errorbar(xx, value.(yyeta), err.(yyeta).*50, fmt="s", color="royalblue", capsize=2, mfc="none", label=L"$\eta_c$")
yscale("log")
legend()
xlim(65,128)
xlabel(L"$t/a$")
ylabel(L"$f_{\mathrm{PP}(x_0, y_0)}$")
# ylim(1e-22, 1e-4)
tight_layout()
display(gcf())
savefig("/Users/alessandroconigli/Desktop/corr_comparison.pdf")
close("all")
##
# test masses D200
plat = [[85,105], [85,105], [85,105], [85,90], [88,98], [90,94], [85,90], [88,94], [90,94] ]
# test masses J501
plat = [[145,165], [120,155], [120,155], [125,155], [145,155], [145,165], [125,150], [145,165], [145,165] ]
# test masses E250
plat = [[115,145], [115,160], [115,160], [118,125], [125,142], [130,160], [118,125], [125,142], [130,160] ]
# test masses J500
plat = [[130,160], [140,160], [138,150], [140,160], [138,150]]
mtest = meff(corr_pp[1][5], [138,150], pl=true, wpm=wpmm)
##
#=============== ANALYSIS ===============#
Mtotps = Vector{Vector{uwreal}}(undef, length(ensinfo)) # required for decay constants
......@@ -152,8 +186,11 @@ Mtotvec = Vector{Vector{uwreal}}(undef, length(ensinfo)) # required for decay co
@time begin
@showprogress for (k,ens) in enumerate(ensinfo)
# gevp matrix for ps and vec masses
mat_mass = comp_mat_multigamma(ens, corr_pp[k], corr_pa[k], corr_aa[k])
m_tm_ps, m_tm_vec = gevp_mass_BMA(mat_mass, tt0=T0, pl=true, wpm=wpmm, path_plt=path_plot)
# mat_mass = comp_mat_multigamma(ens, corr_pp[k], corr_pa[k], corr_aa[k])
# m_tm_ps, m_tm_vec = gevp_mass_BMA(mat_mass, tt0=T0, pl=true, wpm=wpmm, path_plt=path_plot)
m_tm_ps = meff.(corr_pp[k], plat, pl=true, wpm=wpmm)
m_tm_vec = meff.(corr_aa[k], plat, pl=true, wpm=wpmm)
# push!(m_tm_vec, uwreal([1.029, 0.001],"mhvec_D200"))
Mtotps[k] = m_tm_ps
Mtotvec[k] = m_tm_vec
......@@ -195,6 +232,18 @@ Mtotvec = Vector{Vector{uwreal}}(undef, length(ensinfo)) # required for decay co
obs_tm[k]["fpik"] = 0.0
end
end
##
# test D200
plat = [[85,105], [85,105], [85,105], [85,90], [88,98], [90,94], [85,90], [88,94], [90,94] ]
# test J501
plat = [[120,155], [120,155], [120,155], [125,155], [130,155], [132,145], [125,150], [130,145], [132,145] ]
# test E250
plat = [[115,150], [120,155], [120,155], [115,128], [130,155], [135,160], [115,128], [130,145], [135,160] ]
# test masses J500
plat = [[130,160], [140,160], [138,150], [140,160], [138,150] ]
dec_const_pcvc(corr_pp[1][5], plat[5], Mtotps[1][5], pl=true)
##
# Decay constants
close("all")
......@@ -206,11 +255,14 @@ for (k,ens) in enumerate(ensinfo)
# dec_ps = gevp_dec_BMA(mat_dec_ps, Mtotps[k], t0=T0, wpm=wpmm, pl=true, n=1, pseudo=true, wilson=false )
# dec_ps_test = get_f_tm(corr_pp[k], Mtotps[k], ens, path_plat_tm_dps, pl=true, wpm=wpmm )
path_plt_ps = joinpath(path_plot, "plateaus", ens.id, "fps")
dec_tm_ps = get_f_tm_BMA(corr_pp[k], Mtotps[k], ens, pl=true, wpm=wpmm, path_plt=path_plot, ps="fps")
path_plt_vec = joinpath(path_plot, "plateaus", ens.id, "fps")
dec_tm_vec = get_f_tm_BMA(corr_aa[k], Mtotvec[k], ens, pl=true, wpm=wpmm, path_plt=path_plot, ps="fvec")
# commented for testing D200
# path_plt_ps = joinpath(path_plot, "plateaus", ens.id, "fps")
# dec_tm_ps = get_f_tm_BMA(corr_pp[k], Mtotps[k], ens, pl=true, wpm=wpmm, path_plt=path_plot, ps="fps")
#
# path_plt_vec = joinpath(path_plot, "plateaus", ens.id, "fps")
# dec_tm_vec = get_f_tm_BMA(corr_aa[k], Mtotvec[k], ens, pl=true, wpm=wpmm, path_plt=path_plot, ps="fvec")
dec_tm_ps = dec_const_pcvc.(corr_pp[k], plat, Mtotps[k], pl=true, wpm=wpmm)
dec_tm_vec = dec_const.(corr_aa[k], plat, Mtotvec[k], pl=true, wpm=wpmm)
mu_list = gen_mulist[k]
mul, mus, muh = get_mu(mu_list, ens.deg)
......@@ -248,7 +300,6 @@ if mass_shift
# read dm computed by AS
rep = filter(x->occursin(ens.id, x), readdir(path_bdio_md,join=true))[1]
ens.deg ? Nmolt =3. : Nmolt = 1. # required for symmetric point ensembles if shifting s only
println(Nmolt)
deltam[k] = read_BDIO(rep, "ll_obs", "dm")[1] * Nmolt
# these two lines for dm computed locally by me
# fname = joinpath(path_bdio_md, string(ens.id,".bdio"))
......
using Base: String
using Base: @kwdef
using LaTeXStrings: length
using OrderedCollections
using juobs, BDIO, DelimitedFiles, ADerrors, LaTeXStrings, PyPlot
using ProgressMeter
#============= SET UP VARIABLES ===========#
rcParams = PyPlot.PyDict(PyPlot.matplotlib."rcParams")
rcParams["text.usetex"] = true
rcParams["mathtext.fontset"] = "cm"
rcParams["font.size"] =10
rcParams["axes.labelsize"] =22
rcParams["axes.titlesize"] = 18
plt.rc("text", usetex=true) # set to true once you install latex
#============ PATHS & INFO =================#
# path to data
const path_data_w = "/Users/alessandroconigli/Lattice/data/aux_obs_data/wilson" # required for t0 at finite a
const path_data_tm = "/Users/alessandroconigli/Lattice/data/charm_full_Dirac" # charm correlators
# path to plateau
const path_plat_w = "/Users/alessandroconigli/Lattice/data/aux_obs_data/plat_wilson.txt"
const path_plat_tm_mps = "/Users/alessandroconigli/Lattice/gevp-automated-analysis/plat/plat_tm_mps.txt"
const path_plat_tm_mvec = "/Users/alessandroconigli/Lattice/gevp-automated-analysis/plat/plat_tm_mvec.txt"
const path_plat_tm_dps = "/Users/alessandroconigli/Lattice/gevp-automated-analysis/plat/plat_tm_dps.txt"
const path_plat_tm_dvec = "/Users/alessandroconigli/Lattice/gevp-automated-analysis/plat/plat_tm_dvec.txt"
# path to aux obs
const path_rw = "/Users/alessandroconigli/Lattice/data/aux_obs_data/rwf" # reweighting factors
const path_md = "/Users/alessandroconigli/Lattice/data/aux_obs_data/md/" # pbp dat file for mass shift
# path to bdio
# const path_bdio_md = "/Users/alessandroconigli/Lattice/data/bdio_charm/md/LAT22/" # path to delta m computed by me
const path_bdio_md = "/Users/alessandroconigli/Lattice/data/bdio_charm/AS_ligth_obs/" # path to delta m computed by AS
const path_bdio_tm = "/Users/alessandroconigli/Lattice/data/bdio_charm/tm" # path where to store results
const path_bdio_tm_shifted = "/Users/alessandroconigli/Lattice/data/bdio_charm/tm_shifted" # path were to store shifted results
const path_plot = "/Users/alessandroconigli/MyDrive/phd/analysis/charm_gevp_2022/CharmPaper/plots" # path were to save plots
# ensembles to analyse
const ens_list = [ "J303"]
# reweighting and mass shift flags
const rwf = true
# println("Warning! mass_shift set to false ")
const mass_shift = false
const tau = 3 # gevp shift parameter
const T0 = 2
const TSM = false # set whether TSM is used or not
#@warning("\nTSM FLAG MODE: $(TSM)\n")
#=============== INCLUDES ===============#
include("types.jl")
include("tools.jl")
include("const.jl")
include("read_bdio.jl")
#=============== ENSEMBLE INFO FROM DATABASE ==================#
ensinfo = Vector{EnsInfo}(undef, length(ens_list))
for i in 1:length(ens_list)
ens = ens_list[i]
try
ensinfo[i]= EnsInfo(ens, ens_db[ens], trunc_db[ens])
catch
error("The ensemble id ", ens, " was not found in the const.jl ens_db database.
Please check the ensemble id or update the database")
end
end
wpmm = Dict{String, Vector{Float64}}()
wpmm["H101"] = [-1.0, 2.0, -1.0, -1.0] #14.0*2.86]
wpmm["H102r002"] = [-1.0, 2.0, -1.0, -1.0] #14.0*2.86]
wpmm["H105r002"] = [-1.0, 2.0, -1.0, -1.0]# 14.0*2.86]
wpmm["H400"] = [-1.0, 2.0, -1.0, -1.0] #14.0*3.659]
wpmm["N202"] = [-1.0, 2.0, -1.0, -1.0] #14.0*5.164]
wpmm["N200"] = [-1.0, 2.0, -1.0, -1.0] #14.0*5.164]
wpmm["N203"] = [-1.0, 2.0, -1.0, -1.0] # 14.0*5.164]
#wpmm["D200"] = [-1.0, 4.0, -1.0, 14.0*5.164]
wpmm["D200"] = [-1.0, 2.0, -1.0, -1.0]
wpmm["N300r002"] = [-1.0, 2.0, -1.0, -1.0 ] #14.0*8.595]
wpmm["N302"] = [-1.0, 2.0, -1.0, -1.0 ] #14.0*8.595]
wpmm["J303"] = [-1.0, 2.0, -1.0, -1.0 ] #14.0*8.595]
wpmm["J500"] = [-1.0, 2.0, -1.0, -1.0 ] #14.0*8.595]
wpmm["J501"] = [-1.0, 2.0, -1.0, -1.0 ] #14.0*8.595]
wpmm["E250"] = [-1.0, 2.0, -1.0, -1.0 ] #14.0*8.595]
##
#=============== LOAD DATA AND STORE t0 ===============#
corr_pp = Vector{Vector{juobs.Corr}}(undef, length(ens_list))
corr_pa = Vector{Vector{juobs.Corr}}(undef, length(ens_list))
corr_aa = Vector{Vector{juobs.Corr}}(undef, length(ens_list))
yw_store = Vector{Matrix{uwreal}}(undef, length(ens_list)) # store YW info from t0
w_store = Vector{uwreal}(undef, length(ens_list)) # store W info from t0
pp_tmW = Vector{Vector{Vector{uwreal}}}(undef, length(ens_list)) # store W info from corr_pp
gen_mulist = Vector{Vector{Vector{Float64}}}(undef, length(ens_list)) # store mu values
# obs storage
obs_tm = Vector(undef, length(ensinfo))
@time begin
@showprogress for (k,ens) in enumerate(ensinfo)
println("\n Ensemble: ", ens.id)
corr_pp[k], pp_tmW[k], _ = get_corr(path_data_tm, ens, "G5", "G5", rw=rwf, path_rw=path_rw, tsm=TSM)
gen_mulist[k] = getfield.(corr_pp[k], :mu)
end
end
##
mlh, data_lh = juobs.meff(corr_pp[1][4], [127,150], data=true)
msh, data_sh = juobs.meff(corr_pp[1][5], [135,175], data=true)
mhh, data_hh = juobs.meff(corr_pp[1][6], [135,175], data=true)
data_lh ./= mlh ; uwerr.(data_lh)
data_sh ./= msh ; uwerr.(data_sh)
data_hh ./= mhh ; uwerr.(data_hh)
##
fig= figure("pyplot_subplot_column",figsize=(12,4))
subplots_adjust(wspace=0.0)
xx = collect(1:length(data_lh))
subplot(131)
errorbar(xx, value.(data_lh), err.(data_lh), fmt="*", capsize=2, color="navy", mfc="none", label=L"$D$")
fill_between(collect(127:150) , 1 - err(mlh), 1 + err(mlh), color="red", alpha=0.5)
xlabel(L"$x_0/a$")
ylabel(L"$m^{\mathrm{eff}}(x_0)/m_{\mathrm{PS}}$")
xlim(96,190)
ylim(0.98,1.02)
legend()
aa = subplot(132)
setp(aa.get_yticklabels(), visible=false )
errorbar(xx, value.(data_sh), err.(data_sh), fmt="*", capsize=2, color="orange", mfc="none", label=L"$D_s$")
fill_between(collect(135:175) , 1 - err(msh), 1 + err(msh), color="red", alpha=0.5)
xlabel(L"$x_0/a$")
xlim(96,190)
ylim(0.98,1.02)
legend()
aa=subplot(133)
setp(aa.get_yticklabels(), visible=false )
errorbar(xx, value.(data_hh), err.(data_hh), fmt="*", capsize=2, color="darkgreen", mfc="none", label=L"$\eta_c$")
fill_between(collect(135:175) , 1 - err(mhh), 1 + err(mhh), color="red", alpha=0.5)
xlabel(L"$x_0/a$")
xlim(96,190)
ylim(0.98,1.02)
legend()
ax = fig.add_axes([0.78,0.3,0.15,0.2])
errorbar(xx, value.(data_hh), err.(data_hh), fmt="*", capsize=2, color="darkgreen", mfc="none")
fill_between(collect(135:175) , 1 - err(mhh), 1 + err(mhh), color="red", alpha=0.5)
xlim(120,180)
ylim(0.999,1.001)
tight_layout()
display(gcf())
savefig("/Users/alessandroconigli/Desktop/meff_comparison.pdf")
close("all")
\ No newline at end of file
using Base: String
using Base: @kwdef
using LaTeXStrings: length
using OrderedCollections
using juobs, BDIO, DelimitedFiles, ADerrors, LaTeXStrings, PyPlot
using ProgressMeter
#============= SET UP VARIABLES ===========#
rcParams = PyPlot.PyDict(PyPlot.matplotlib."rcParams")
rcParams["text.usetex"] = true
rcParams["mathtext.fontset"] = "cm"
rcParams["font.size"] =10
rcParams["axes.labelsize"] =22
rcParams["axes.titlesize"] = 18
plt.rc("text", usetex=true) # set to true once you install latex
#============ PATHS & INFO =================#
# path to data
const path_data_w = "/Users/alessandroconigli/Lattice/data/aux_obs_data/wilson" # required for t0 at finite a
const path_data_tm = "/Users/alessandroconigli/Lattice/data/charm_full_Dirac" # charm correlators
# path to aux obs
const path_rw = "/Users/alessandroconigli/Lattice/data/aux_obs_data/rwf" # reweighting factors
const path_md = "/Users/alessandroconigli/Lattice/data/aux_obs_data/md/" # pbp dat file for mass shift
const ens_list = [ "E250"]
# reweighting and mass shift flags
const rwf = false
#=============== INCLUDES ===============#
include("types.jl")
include("tools.jl")
include("const.jl")
include("read_bdio.jl")
ensinfo = Vector{EnsInfo}(undef, length(ens_list))
for i in 1:length(ens_list)
ens = ens_list[i]
try
ensinfo[i]= EnsInfo(ens, ens_db[ens], trunc_db[ens])
catch
error("The ensemble id ", ens, " was not found in the const.jl ens_db database.
Please check the ensemble id or update the database")
end
end
##
# testing for E250 (in chunk2 and chunk2bis there's an overlap)
db = [ "sloppy_chunk0","sloppy_chunk1", "sloppy_chunk2", "sloppy_chunk3", "sloppy_chunk5", "sloppy_chunk5"]
pp = joinpath(path_data_tm, "E250")
aux = filter(x-> occursin("sloppy_chunk", x), readdir(pp,join=true))
data_1 = juobs.read_mesons(aux[1], "G5","G5", legacy=false) # 1 -> 196
data_2 = juobs.read_mesons(aux[2], "G5","G5", legacy=false) # 201 -> 296 # trunc at 20 elem
data_2b = juobs.read_mesons(aux[3], "G5","G5", legacy=false) # 301 -> 396
data_3 = juobs.read_mesons(aux[4], "G5","G5", legacy=false) # 401 -> 596
data_4 = juobs.read_mesons(aux[5], "G5","G5", legacy=false) # 601 -> 796
data_5 = juobs.read_mesons(aux[6], "G5","G5", legacy=false) # 801 -> 1006
juobs.concat_data!(data_1, data_2)
juobs.concat_data!(data_1, data_2b)
juobs.concat_data!(data_1, data_3)
juobs.concat_data!(data_1, data_4)
juobs.concat_data!(data_1, data_5)
##
data_sl = read_data_sloppy_multichunks(path_data_tm, "E250", "G5", "G5", legacy=false)
data_corr = read_data_correction(path_data_tm, "E250", "G5", "G5", legacy=false)
corr_pp, _ = get_corr(path_data_tm, ensinfo[1], "G5", "G5", rw=false, path_rw=path_rw, tsm=true)
mm = meff.(corr_pp, fill([130, 150],9), pl=true )
function get_corr_TSM_multichunks(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)
if path_rw == ""
p_rw = path
else
p_rw = path_rw
end
aux1 = read_data_sloppy_multichunks(path, ens.id, g1, g2, legacy=legacy)
aux2 = read_data_correction(path, ens.id, g1, g2, legacy=legacy)
try # single replica
# sloppy
vcfg = getfield(aux1[1], :vcfg)
delta = vcfg[1][2] - vcfg[1][1]
cut_trunc = Int64.((ens.trunc .-1)./delta) .+ 1
truncate_data!(aux1, cut_trunc )
# correction
vcfg = getfield(aux2[1], :vcfg)
delta = vcfg[1][2] - vcfg[1][1]
cut_trunc = Int64.((ens.trunc .-1)./delta) .+ 1
truncate_data!(aux2, cut_trunc)
catch # multiple replica
# sloppy
vcfg = getfield.(aux1[1], :vcfg)
delta = vcfg[1][2] - vcfg[1][1]
cut_trunc = Int64.((ens.trunc .-1)./delta) .+ 1
truncate_data!(aux1, cut_trunc )
# correction
vcfg = getfield.(aux2[1], :vcfg)
delta = vcfg[1][2] - vcfg[1][1]
cut_trunc = Int64.((ens.trunc .-1)./delta) .+ 1
truncate_data!(aux2, cut_trunc)
end
if !rw
obs = corr_obs_TSM.(aux1, aux2, L=ens.L, info=true)#, idm_corr=collect(1:ens.idm_corr) )
return (getindex.(obs, 1), getindex.(obs, 2))
else
obs = corr_obs_TSM.(aux1, aux2, L=ens.L, rw=read_rw(p_rw, ens.id), info=true) #, idm_corr=collect(1:ens.idm_corr))
return (getindex.(obs, 1), getindex.(obs, 2), getindex.(obs, 3))
end
end
## testing apply_rw with gaps
data_sl = read_data_sloppy_multichunks(path_data_tm, "E300", "G5", "G5", legacy=false);
data_corr = read_data_correction(path_data_tm, "E300", "G5", "G5", legacy=false);
L = ensinfo[1].L;
idd = [ensinfo[1].id];
real_data = true;
vcfg_sl = getfield(data_sl[1], :vcfg);
replica_sl = Int64(maximum(vcfg_sl))
vcfg_corr = getfield(data_corr[1], :vcfg);
replica_corr = Int64(maximum(vcfg_corr));
#truncate data
nms = sum(replica_sl); # assuming vcfg_sl >= vcfg_corr
delta_vcfg = vcfg_sl[1][2] - vcfg_sl[1][1];
idm_sl = collect(1:delta_vcfg:replica_sl[1])
for ii in eachindex(data_sl[1])[2:end]
delta_vcfg = vcfg_sl[ii][2] - vcfg_sl[ii][1]
aux = collect(1:delta_vcfg:replica_sl[ii]) .+ replica_sl[ii-1]
append!(idm_sl, aux)
end
delta_vcfg = vcfg_corr[1][2] - vcfg_corr[1][1]
idm_corr = collect(1:delta_vcfg:replica_corr[1])
for ii in eachindex(data_corr[1])[2:end]
delta_vcfg = vcfg_corr[ii][2] - vcfg_corr[ii][1]
aux = collect(1:delta_vcfg:replica_corr[ii]) .+ replica_corr[ii-1]
append!(idm_corr, aux)
end
data1 = real_data ? getfield.(data_sl[1], :re_data) ./ L^3 : getfield.(data_sl, :im_data) ./ L^3
data2 = real_data ? getfield.(data_corr[1], :re_data) ./ L^3 : getfield.(data_corr, :im_data) ./ L^3
rw = read_rw(path_rw, ensinfo[1].id)
data1_r, W = juobs.apply_rw(data1, rw, vcfg_sl)
data2_r, W = juobs.apply_rw(data2, rw, vcfg_corr)
tmp1 = vcat(data1_r...)
tmp2 = vcat(data2_r...)
tmpW = vcat(W...)
nt = size(tmp1, 2)
ow1 = [uwreal(tmp1[:, x0], idd[1], replica_sl, idm_sl, nms ) for x0 = 1:nt]
ow2 = [uwreal(tmp2[:, x0], idd[1], replica_sl, idm_corr, nms) for x0 = 1:nt]
W_obs = uwreal(tmpW, idd[1], replica_sl, idm_sl, nms)
obs1 = [ow1[x0] / W_obs for x0 = 1:nt]
obs2 = [ow2[x0] / W_obs for x0 = 1:nt]
pp = juobs.Corr(obs1 + obs2, data_sl[1])
\ No newline at end of file
......@@ -23,6 +23,32 @@ function read_data_sloppy(path::String, ens::String, g1::String="G5", g2::String
error("mesons.dat file not found for ensemble ", ens, " in path ", p)
end
end
function read_data_sloppy_multichunks(path::String, ens::String, g1::String="G5", g2::String="G5"; legacy::Bool=false)
p = joinpath(path, ens)
db = Dict("J500" => ["sloppy_chunk0", "sloppy_chunk1"],
"E300" => ["sloppy_chunk0", "sloppy_chunk1", "sloppy_chunk2" ],
"N302" => ["sloppy"], "J501" => ["sloppy"],
"E250" => [ "sloppy_chunk0","sloppy_chunk1", "sloppy_chunk2", "sloppy_chunk3", "sloppy_chunk4", "sloppy_chunk5"]
)
store_cdata_aux = []
for rep in db[ens]
aux = filter(x-> occursin(rep, x), readdir(p,join=true))
data_chunk = juobs.read_mesons(aux, g1, g2, legacy=legacy, id=ens)
if ens == "E250" && rep == "sloppy_chunk1"
juobs.truncate_data!.(data_chunk, 20)
end
push!(store_cdata_aux, data_chunk)
end
for k in 2:length(store_cdata_aux)
juobs.concat_data!(store_cdata_aux[1], store_cdata_aux[k])
end
if length(store_cdata_aux[1][1]) == 1
return getindex.(store_cdata_aux[1], 1)
else
return store_cdata_aux[1]
end
end
# read correction TSM
function read_data_correction(path::String, ens::String, g1::String="G5", g2::String="G5"; legacy::Bool=false)
p = joinpath(path, ens)
......@@ -35,8 +61,12 @@ function read_data_correction(path::String, ens::String, g1::String="G5", g2::St
end
function read_pbp(path::String, ens::String)
p = joinpath(path, ens)
rep = filter(x->occursin("pbp.dat", x), readdir(p, join=true))
rep = filter(x->occursin("pbp", x), readdir(p, join=true))
if length(rep)!=0
if ens == "D200"
md_aux = read_md.(rep)
return [hcat(md_aux...)]
end
return read_md.(rep)
else
error("pbp.dat file not found for ensemble ", ens, " in path ", p)
......@@ -48,6 +78,12 @@ function read_rw(path::String, ens::String)
if ens == "J500"
return [read_ms1(rep[1]), read_ms1(rep[2], v="1.4")]
end
if ens == "J501"
return [read_ms1(rep[1]), read_ms1(rep[2], v="1.4") ]
end
if ens == "E250"
return read_ms1(rep[1], v="1.6")
end
if length(rep)!=0
try
length(rep) == 1 ? (return read_ms1(rep[1])) : (return read_ms1.(rep))
......@@ -86,22 +122,37 @@ function get_corr(path::String, ens::EnsInfo, g1::String="G5", g2::String="G5";
obs = corr_obs.(aux, L=ens.L, rw=read_rw(p_rw, ens.id), info=true)
return (getindex.(obs, 1), getindex.(obs, 2), getindex.(obs, 3))
end
else
if ens.id in ["J500", "J501", "E250", "E300"]
aux1 = read_data_sloppy_multichunks(path, ens.id, g1, g2, legacy=legacy)
else
aux1 = read_data_sloppy(path, ens.id, g1, g2, legacy=legacy)
end
aux2 = read_data_correction(path, ens.id, g1, g2, legacy=legacy)
if !isnothing(ens.trunc)
try # single replica
if ens.id == "E300"
truncate_data!(aux1, 455)
else
vcfg = getfield(aux1[1], :vcfg)
delta = vcfg[1][2] - vcfg[1][1]
delta = vcfg[2] - vcfg[1]
cut_trunc = Int64.((ens.trunc .-1)./delta) .+ 1
println(cut_trunc)
truncate_data!(aux1, cut_trunc )
truncate_data!(aux2, cut_trunc)
vcfg2 = getfield(aux2[1], :vcfg)
delta2 = vcfg2[2] - vcfg2[1]
cut_trunc2 = Int64.((ens.trunc .-1)./delta2) .+ 1
truncate_data!(aux2, cut_trunc2)
end
catch # multiple replica
vcfg = getfield.(aux1[1], :vcfg)
delta = vcfg[1][2] - vcfg[1][1]
cut_trunc = Int64.((ens.trunc .-1)./delta) .+ 1
truncate_data!(aux1, cut_trunc )
truncate_data!(aux2, cut_trunc)
vcfg2 = getfield.(aux2[1], :vcfg)
delta2 = vcfg2[1][2] - vcfg2[1][1]
cut_trunc2 = Int64.((ens.trunc .-1)./delta2) .+ 1
truncate_data!(aux2, cut_trunc2)
end
end
......@@ -420,12 +471,9 @@ function gevp_mass_BMA(mat_obs::Vector{MatInfo}; tt0::Int64=2,pl::Bool=true, wpm
# evecs = getall_eig(mat, t0)
entot = juobs.energies(evals, wpm=wpm)
@. gs_model(x,p) = p[1] #+ p[2] * exp(-(p[3])*x)
param = 1
tminaux = round.(Int64, collect(18:30) * sqrt(value(t0(mat_obs[k].ensinfo.beta) / t0(3.7))))
tminaux = round.(Int64, collect(18:38) * sqrt(value(t0(mat_obs[k].ensinfo.beta) / t0(3.7))))
T = length(entot[1])
tmaxaux = round.(Int64, collect(8:20) * sqrt(value(t0(mat_obs[k].ensinfo.beta) / t0(3.7))))
tmaxaux = round.(Int64, collect(10:24) * sqrt(value(t0(mat_obs[k].ensinfo.beta) / t0(3.7))))
tmax = T .- collect(reverse(tmaxaux))
tmax = tmax[1:3:end]
tmin = tminaux[1:2:end]
......@@ -436,8 +484,29 @@ function gevp_mass_BMA(mat_obs::Vector{MatInfo}; tt0::Int64=2,pl::Bool=true, wpm
else
pp1 = pp2 = nothing
end
if mat_obs[1].ensinfo.id == "D200"
@. gs_model(x,p) = p[1] #+ p[2] * exp(-(p[3])*x)
param = 1
en0[k], syst1, all_res1, FitDict1 = juobs.bayesian_av(gs_model, entot[1], tmin, tmax, param, pl=pl, wpm=wpm, data=true, label=L"$m_{\mathrm{ps}}$", path_plt=pp1, plt_title=t)
try
en1[k], syst2, all_res2, FitDict2 = juobs.bayesian_av(gs_model, entot[2], tmin, tmax, param, pl=pl, wpm=wpm, data=true, label=L"$m_{\mathrm{v}}$", path_plt=pp2, plt_title=t)
catch
@warn "Vector mass failed"
en1[k] = uwreal(1.0)
end
else
@. gs_model1(x,p) = p[1] #+ p[2] * exp(-(p[3])*x)
param = 1
en0[k], syst1, all_res1, FitDict1 = juobs.bayesian_av(gs_model1, entot[1], tmin, tmax, param, pl=pl, wpm=wpm, data=true, label=L"$m_{\mathrm{ps}}$", path_plt=pp1, plt_title=t)
try
en1[k], syst2, all_res2, FitDict2 = juobs.bayesian_av(gs_model1, entot[2], tmin, tmax, param, pl=pl, wpm=wpm, data=true, label=L"$m_{\mathrm{v}}$", path_plt=pp2, plt_title=t)
catch
@warn "Vector mass failed"
en1[k] = uwreal(1.0)
end
end
close("all")
if pl
......@@ -773,7 +842,7 @@ function get_f_tm_BMA(corr::Vector{juobs.Corr}, m::Vector{uwreal}, ens::EnsInfo;
tminaux = round.(Int64, collect(15:32) * sqrt(value(t0(ens.beta) / t0(3.7))))
T = length(corr[1].obs)
tmaxaux = round.(Int64, collect(20:35) * sqrt(value(t0(ens.beta) / t0(3.7))))
tmaxaux = round.(Int64, collect(10:25) * sqrt(value(t0(ens.beta) / t0(3.7))))
tmax = T .- collect(reverse(tmaxaux))
tmax = tmax[1:3:end]
tmin = tminaux[1:2:end] .+ corr[1].y0
......@@ -795,9 +864,12 @@ function get_f_tm_BMA(corr::Vector{juobs.Corr}, m::Vector{uwreal}, ens::EnsInfo;
ll = ps == "fps" ? L"$f_{\mathrm{ps}}$" : L"$f_{\mathrm{v}}$"
name_bma = "f$(k)_BMA.pdf"
isnothing(path_plt) ? tt=nothing : tt = joinpath(path_plt,name_bma)
try
F[k], syst, all_res, FitDict = juobs.bayesian_av(const_fit, data, tmin, tmax, 1, pl=pl, wpm=wpm, data=true, path_plt=tt, plt_title=t, label=ll )
if pl
try
fig = figure(figsize=(10,7.5))
modstot = FitDict["mods"]
......@@ -848,9 +920,13 @@ function get_f_tm_BMA(corr::Vector{juobs.Corr}, m::Vector{uwreal}, ens::EnsInfo;
end
close()
catch
println("plot failed")
@warn "plot failed"
end
end
catch
@warn "Decay failed"
F[k] = uwreal(0.0)
end
end
return F
......@@ -1044,8 +1120,8 @@ function aic_weight(aic)
w_aux ./= sum(w_aux)
idx_in = sortperm(w_aux, rev=true)
cum_w = cumsum(w_aux[idx_in])
println(cum_w[end])
stop = findfirst(x->x>=0.999, cum_w)
#stop = findfirst(x->x>=0.999, cum_w)
stop = length(aic)
idx = sort(idx_in[1:stop])
w = w_aux[idx] ./ sum(w_aux[idx])
# w = w_aux ./ sum(w_aux)
......
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