Commit a8aac2d0 authored by Antonino D'Anna's avatar Antonino D'Anna

added key word savepl and label to mpcac. commented out mpcac_ren, considering removal

parent e00b1b0a
...@@ -16,11 +16,12 @@ m = meff(corr_pp[1], [50, 60], pl=false) ...@@ -16,11 +16,12 @@ m = meff(corr_pp[1], [50, 60], pl=false)
""" """
function meff(corr::Vector{uwreal}, plat::Vector{Int64}; pl::Bool=true, data::Bool=false, function meff(corr::Vector{uwreal}, plat::Vector{Int64}; pl::Bool=true, data::Bool=false,
mu::Union{Vector{Float64}, Nothing}=nothing, kappa::Union{Vector{Float64}, Nothing}=nothing, mu::Union{Vector{Float64}, Nothing}=nothing, kappa::Union{Vector{Float64}, Nothing}=nothing,
wpm::Union{Dict{Int64,Vector{Float64}},Dict{String,Vector{Float64}}, Nothing}=nothing) wpm::Union{Dict{Int64,Vector{Float64}},Dict{String,Vector{Float64}}, Nothing}=nothing, savepl::Bool=false,
label::Union{String, Nothing}=nothing)
dim = length(corr) dim = length(corr)
aux = 0.5 .* log.((corr[2:dim-2] ./ corr[3:dim-1]).^2) aux = 0.5 .* log.((corr[2:dim-2] ./ corr[3:dim-1]).^2)
mass = plat_av(aux, plat, wpm) mass = plat_av(aux, plat, wpm)
if pl if pl || savepl
isnothing(wpm) ? uwerr(mass) : uwerr(mass, wpm) isnothing(wpm) ? uwerr(mass) : uwerr(mass, wpm)
x = 1:length(aux) x = 1:length(aux)
y = abs.(value.(aux)) y = abs.(value.(aux))
...@@ -28,26 +29,39 @@ function meff(corr::Vector{uwreal}, plat::Vector{Int64}; pl::Bool=true, data::Bo ...@@ -28,26 +29,39 @@ function meff(corr::Vector{uwreal}, plat::Vector{Int64}; pl::Bool=true, data::Bo
v = abs(value(mass)) v = abs(value(mass))
e = err(mass) e = err(mass)
filename = "meff/";
figure() figure()
fill_between(plat[1]:plat[2], v-e, v+e, color="green", alpha=0.75) fill_between(plat[1]:plat[2], v-e, v+e, color="green", alpha=0.75)
errorbar(x, y, dy, fmt="x", color="black") l,=errorbar(x, y, dy, fmt="x", color="black")
if !isnothing(label)
l.set_label(label)
legend()
filename*=label*"_"
end
ylabel(L"$m_\mathrm{eff}$") ylabel(L"$m_\mathrm{eff}$")
xlabel(L"$x_0$") xlabel(L"$x_0$")
_, max_idx = findmax(value.(corr)) _, max_idx = findmax(value.(corr))
ylim(v-80*e, v+80*e) ylim(v-80*e, v+80*e)
xlim(left=max_idx) xlim(left=max_idx)
# ylim(v-30*e, v+30*e)
# ylim(0.15, 0.18)
#xlim(64,length(y))
if !isnothing(kappa) if !isnothing(kappa)
title(string(L"$\kappa_1 = $", kappa[1], L" $\kappa_2 = $", kappa[2])) title(string(L"$\kappa_1 = $", kappa[1], L" $\kappa_2 = $", kappa[2]))
filename*="kappa_1_$(kappa[1])_kappa_2_$(kappa[2]).png"
end end
if !isnothing(mu) if !isnothing(mu)
title(string(L"$\mu_1 = $", mu[1], L" $\mu_2 = $", mu[2])) title(string(L"$\mu_1 = $", mu[1], L" $\mu_2 = $", mu[2]))
filename*="mu_1_$(mu[1])_mu_2_$(mu[2]).png"
end end
display(gcf()) if savepl
close("all") tight_layout()
gcf().set_size_inches(10,5)
savefig(filename)
close(gcf())
else
display(gcf())
end
# close("all")
end end
if !data if !data
return mass return mass
...@@ -56,12 +70,13 @@ function meff(corr::Vector{uwreal}, plat::Vector{Int64}; pl::Bool=true, data::Bo ...@@ -56,12 +70,13 @@ function meff(corr::Vector{uwreal}, plat::Vector{Int64}; pl::Bool=true, data::Bo
end end
end end
function meff(corr::Corr, plat::Vector{Int64}; pl::Bool=true, data::Bool=false, function meff(corr::Corr, plat::Vector{Int64}; pl::Bool=true, data::Bool=false,
wpm::Union{Dict{Int64,Vector{Float64}},Dict{String,Vector{Float64}}, Nothing}=nothing) wpm::Union{Dict{Int64,Vector{Float64}},Dict{String,Vector{Float64}}, Nothing}=nothing, savepl::Bool=false,
label::Union{String,Nothing}=nothing)
if corr.mu == [0.0, 0.0] if corr.mu == [0.0, 0.0]
return meff(corr.obs, plat, pl=pl, data=data, kappa=corr.kappa, mu=nothing, wpm=wpm) return meff(corr.obs, plat, pl=pl, data=data, kappa=corr.kappa, mu=nothing, wpm=wpm,savepl=savepl, label=label)
else else
return meff(corr.obs, plat, pl=pl, data=data, mu=corr.mu, kappa=nothing, wpm=wpm) return meff(corr.obs, plat, pl=pl, data=data, mu=corr.mu, kappa=nothing, wpm=wpm,savepl=savepl, label=label)
end end
end end
@doc raw""" @doc raw"""
...@@ -92,7 +107,8 @@ m12 = mpcac(corr_a0p, corr_pp, [50, 60], pl=false, ca=ca) ...@@ -92,7 +107,8 @@ m12 = mpcac(corr_a0p, corr_pp, [50, 60], pl=false, ca=ca)
""" """
function mpcac(a0p::Vector{uwreal}, pp::Vector{uwreal}, plat::Vector{Int64}; ca::Float64=0.0, pl::Bool=true, data::Bool=false, function mpcac(a0p::Vector{uwreal}, pp::Vector{uwreal}, plat::Vector{Int64}; ca::Float64=0.0, pl::Bool=true, data::Bool=false,
kappa::Union{Vector{Float64}, Nothing}=nothing, mu::Union{Vector{Float64}, Nothing}=nothing, kappa::Union{Vector{Float64}, Nothing}=nothing, mu::Union{Vector{Float64}, Nothing}=nothing,
wpm::Union{Dict{Int64,Vector{Float64}},Dict{String,Vector{Float64}}, Nothing}=nothing) wpm::Union{Dict{Int64,Vector{Float64}},Dict{String,Vector{Float64}}, Nothing}=nothing,
savepl::Bool = false, label::Union{String,Nothing}=nothing)
corr_a0p = -a0p[1:end] corr_a0p = -a0p[1:end]
corr_pp = pp[1:end] corr_pp = pp[1:end]
...@@ -113,7 +129,7 @@ function mpcac(a0p::Vector{uwreal}, pp::Vector{uwreal}, plat::Vector{Int64}; ca: ...@@ -113,7 +129,7 @@ function mpcac(a0p::Vector{uwreal}, pp::Vector{uwreal}, plat::Vector{Int64}; ca:
aux = der_a0p ./ ( 2. .* corr_pp[3:end-2]) aux = der_a0p ./ ( 2. .* corr_pp[3:end-2])
mass = plat_av(aux, plat, wpm) mass = plat_av(aux, plat, wpm)
if pl if pl || savepl
isnothing(wpm) ? uwerr(mass) : uwerr(mass, wpm) isnothing(wpm) ? uwerr(mass) : uwerr(mass, wpm)
x = 1:length(aux) x = 1:length(aux)
y = value.(aux) y = value.(aux)
...@@ -123,20 +139,36 @@ function mpcac(a0p::Vector{uwreal}, pp::Vector{uwreal}, plat::Vector{Int64}; ca: ...@@ -123,20 +139,36 @@ function mpcac(a0p::Vector{uwreal}, pp::Vector{uwreal}, plat::Vector{Int64}; ca:
figure() figure()
fill_between(plat[1]:plat[2], v-e, v+e, color="green", alpha=0.75) fill_between(plat[1]:plat[2], v-e, v+e, color="green", alpha=0.75)
errorbar(x, y, dy, fmt="x", color="black") l, = errorbar(x, y, dy, fmt="x", color="black")
filename = "mpcac/"
if !isnothing(label)
l.set_label(label)
legend()
filename *= label*"_"
end
ylabel(L"$m_\mathrm{PCAC}$") ylabel(L"$m_\mathrm{PCAC}$")
xlabel(L"$x_0$") xlabel(L"$x_0$")
_, max_idx = findmax(value.(pp)) _, max_idx = findmax(value.(pp))
ylim(v-20*e, v+20*e) ylim(v-20*e, v+20*e)
xlim(left=max_idx) xlim(left=max_idx)
if !isnothing(kappa) if !isnothing(kappa)
title(string(L"$\kappa_1 = $", kappa[1], L" $\kappa_2 = $", kappa[2])) title(string(L"$\kappa_1 = $", kappa[1], L" $\kappa_2 = $", kappa[2]))
global filename *= "kappa_1_$(kappa[1])_kappa_2_$(kappa[2]).png"
end end
if !isnothing(mu) if !isnothing(mu)
title(string(L"$\mu_1 = $", mu[1], L" $\mu_2 = $", mu[2])) title(string(L"$\mu_1 = $", mu[1], L" $\mu_2 = $", mu[2]))
global filename *="mu_1_$(mu[1])_mu_2_$(mu[2]).png"
end
if savepl
tight_layout()
gcf().set_size_inches(10, 5)
savefig(filename, dpi=100)
savefig(filename)
close(gcf())
elseif pl
display(gcf())
end end
display(gcf())
end end
if !data if !data
return mass return mass
...@@ -146,19 +178,20 @@ function mpcac(a0p::Vector{uwreal}, pp::Vector{uwreal}, plat::Vector{Int64}; ca: ...@@ -146,19 +178,20 @@ function mpcac(a0p::Vector{uwreal}, pp::Vector{uwreal}, plat::Vector{Int64}; ca:
end end
function mpcac(a0p::Corr, pp::Corr, plat::Vector{Int64}; ca::Float64=0.0, pl::Bool=true, data::Bool=false, function mpcac(a0p::Corr, pp::Corr, plat::Vector{Int64}; ca::Float64=0.0, pl::Bool=true, data::Bool=false,
wpm::Union{Dict{Int64,Vector{Float64}},Dict{String,Vector{Float64}}, Nothing}=nothing) wpm::Union{Dict{Int64,Vector{Float64}},Dict{String,Vector{Float64}}, Nothing}=nothing,
savepl::Bool=false, label::Union{String,Nothing}=nothing)
if a0p.kappa == pp.kappa || a0p.mu == pp.mu if a0p.kappa == pp.kappa || a0p.mu == pp.mu
if a0p.mu == [0.0, 0.0] if a0p.mu == [0.0, 0.0]
return mpcac(a0p.obs, pp.obs, plat, ca=ca, pl=pl, data=data, kappa=a0p.kappa, mu=nothing, wpm=wpm) return mpcac(a0p.obs, pp.obs, plat, ca=ca, pl=pl, data=data, kappa=a0p.kappa, mu=nothing, wpm=wpm,savepl=davepl, label=label)
else else
return mpcac(a0p.obs, pp.obs, plat, ca=ca, pl=pl, data=data, mu=a0p.mu, kappa=nothing, wpm=wpm) return mpcac(a0p.obs, pp.obs, plat, ca=ca, pl=pl, data=data, mu=a0p.mu, kappa=nothing, wpm=wpm,savepl=savepl,label=label)
end end
else else
error("mu or kappa values does not match") error("mu or kappa values does not match")
end end
end end
#=
@doc raw""" @doc raw"""
mpcac_ren(a0p::Vector{uwreal}, pp::Vector{uwreal}, plat::Vector{Int64}, za_zp::uwreal; ca::Float64=0.0,ba_bp_z::uwreal=0.0,pl::Bool=true, data::Bool=false, mpcac_ren(a0p::Vector{uwreal}, pp::Vector{uwreal}, plat::Vector{Int64}, za_zp::uwreal; ca::Float64=0.0,ba_bp_z::uwreal=0.0,pl::Bool=true, data::Bool=false,
kappa::Union{Vector{Float64}, Nothing}=nothing, mu::Union{Vector{Float64}, Nothing}=nothing, kappa::Union{Vector{Float64}, Nothing}=nothing, mu::Union{Vector{Float64}, Nothing}=nothing,
...@@ -198,17 +231,16 @@ m12 = mpcac_ren = (corr_a0p,corr_pp,[50,60],za_zp,pl=false, ca=ca, ba_bp_z=ba_bp ...@@ -198,17 +231,16 @@ m12 = mpcac_ren = (corr_a0p,corr_pp,[50,60],za_zp,pl=false, ca=ca, ba_bp_z=ba_bp
``` ```
""" """
function mpcac_ren(a0p::Vector{uwreal}, pp::Vector{uwreal}, plat::Vector{Int64}, za_zp::uwreal; ca::Float64=0.0,ba_bp_z::uwreal=0.0, function mpcac_ren(a0p::Vector{uwreal}, pp::Vector{uwreal}, plat::Vector{Int64}; ca::Float64=0.0,ba_bp_z::uwreal=uwreal(0.0),
pl::Bool=true, data::Bool=false,kappa::Union{Vector{Float64}, Nothing}=nothing, mu::Union{Vector{Float64}, Nothing}=nothing, pl::Bool=true, data::Bool=false,kappa::Union{Vector{Float64}, Nothing}=nothing, mu::Union{Vector{Float64}, Nothing}=nothing,
wpm::Union{Dict{Int64,Vector{Float64}},Dict{String,Vector{Float64}}, Nothing}=nothing,savepl::Bool =false) wpm::Union{Dict{Int64,Vector{Float64}},Dict{String,Vector{Float64}}, Nothing}=nothing,savepl::Bool =false, label::Union{String,Nothing}=nothing)
corr_a0p = -a0p[1:end] corr_a0p = -a0p[1:end]
corr_pp = pp[1:end] corr_pp = pp[1:end]
der_a0p = (corr_a0p[4:end-1] .- corr_a0p[2:end-3]) / 2 # \de_0 a0p der_a0p = (corr_a0p[4:end-1] .- corr_a0p[2:end-3]) / 2 # \de_0 a0p
m_pcac = der_a0p ./(2 * corr_pp[3:end-2]) # Unimproved, unrenormalized mpcac m_pcac = der_a0p ./(2 * corr_pp[3:end-2]) # Unimproved, unrenormalized mpcac
if ba_bp_z !=0.0 if ba_bp_z !=0.0
der_a0p *= 1.0 .+ ba_bp_z*m_pcac #improvement with ba_bp der_a0p .*= 1.0 .+ ba_bp_z*m_pcac #improvement with ba_bp
end end
if ca !=0.0 if ca !=0.0
...@@ -216,7 +248,7 @@ function mpcac_ren(a0p::Vector{uwreal}, pp::Vector{uwreal}, plat::Vector{Int64}, ...@@ -216,7 +248,7 @@ function mpcac_ren(a0p::Vector{uwreal}, pp::Vector{uwreal}, plat::Vector{Int64},
der_a0p += ca*der2_pp der_a0p += ca*der2_pp
end end
m_ren = za_zp.*(der_a0p./(2*corr_pp[3:end-2])) m_ren = (der_a0p./(2*corr_pp[3:end-2]))
mass = plat_av(m_ren,plat,wpm) mass = plat_av(m_ren,plat,wpm)
if pl || savepl if pl || savepl
...@@ -228,28 +260,35 @@ function mpcac_ren(a0p::Vector{uwreal}, pp::Vector{uwreal}, plat::Vector{Int64}, ...@@ -228,28 +260,35 @@ function mpcac_ren(a0p::Vector{uwreal}, pp::Vector{uwreal}, plat::Vector{Int64},
e = err(mass) e = err(mass)
plot= figure() plot= figure()
filename="mpcac/"
fill_between(plat[1]:plat[2], v-e, v+e, color="green", alpha=0.75) fill_between(plat[1]:plat[2], v-e, v+e, color="green", alpha=0.75)
errorbar(x, y, dy, fmt="x", color="black") l,= errorbar(x, y, dy, fmt="x", color="black")
if !isnothing(label)
l.set_label(label)
legend()
filename*=label*"_"
end
ylabel(L"$m^R_\mathrm{PCAC}$") ylabel(L"$m^R_\mathrm{PCAC}$")
xlabel(L"$x_0$") xlabel(L"$x_0$")
_, max_idx = findmax(value.(pp)) _, max_idx = findmax(value.(pp))
# ylim(v-20*e, v+20*e) ylim(v-20*e, v+20*e)
xlim(left=max_idx) xlim(left=max_idx)
filename=""
if !isnothing(kappa) if !isnothing(kappa)
title(string(L"$m_\mathrm{PCAC}^R$ $\mathcal{O(a)} improved","\n",L"$\kappa_1 = $", kappa[1], L" $\kappa_2 = $", kappa[2])) title(string(L"$m_\mathrm{PCAC}^R$ $\mathcal{O(a)}$ improved","\n",L"$\kappa_1 = $", kappa[1], L" $\kappa_2 = $", kappa[2]))
global filename = string("mpcac/kappa_1_$(kappa[1])_kappa_2_$(kappa[2])_renormalize_improved.png") filename *="kappa_1_$(kappa[1])_kappa_2_$(kappa[2])_renormalize_improved.png"
end end
if !isnothing(mu) if !isnothing(mu)
title(string(L"$m_\mathrm{PCAC}^R$ $\mathcal{O(a)} improved","\n",L"$\mu_1 = $", mu[1], L" $\mu_2 = $", mu[2])) title(string(L"$m_\mathrm{PCAC}^R$ $\mathcal{O(a)}$ improved","\n",L"$\mu_1 = $", mu[1], L" $\mu_2 = $", mu[2]))
global filename =string("mpcac/mu_1_$(mu[1])_mu_2_$(mu[2])_renomalized_improved.png") filename *="mu_1_$(mu[1])_mu_2_$(mu[2])_renomalized_improved.png"
end end
if savepl if savepl
plot.tight_layout() tight_layout()
gcf().set_size_inches(10,5)
savefig(filename) savefig(filename)
end end
if pl if pl && !savepl
display(gcf()) display(gcf())
else else
close(plot) close(plot)
...@@ -261,18 +300,20 @@ function mpcac_ren(a0p::Vector{uwreal}, pp::Vector{uwreal}, plat::Vector{Int64}, ...@@ -261,18 +300,20 @@ function mpcac_ren(a0p::Vector{uwreal}, pp::Vector{uwreal}, plat::Vector{Int64},
return (mass, m_ren) return (mass, m_ren)
end end
function mpcac_ren(a0p::Corr, pp::Corr, plat::Vector{Int64}, za_zp::uwreal; ca::Float64,ba_bp_z::uwreal, pl::Bool=true, data::Bool=false, wpm::Union{Dict{Int64,Vector{Float64}},Dict{String,Vector{Float64}}, Nothing}=nothing,savepl::Bool =false)
function mpcac_ren(a0p::Corr, pp::Corr, plat::Vector{Int64}; ca::Float64=0.0,ba_bp_z::uwreal=uwreal(0.0), pl::Bool=true, data::Bool=false,
wpm::Union{Dict{Int64,Vector{Float64}},Dict{String,Vector{Float64}}, Nothing}=nothing,savepl::Bool =false,label::Union{String,Nothing}=nothing)
if a0p.kappa == pp.kappa || a0p.mu == pp.mu if a0p.kappa == pp.kappa || a0p.mu == pp.mu
if a0p.mu == [0.0, 0.0] if a0p.mu == [0.0, 0.0]
return mpcac_ren(a0p.obs, pp.obs, plat, za_zp, ca=ca,ba_bp_z=ba_cp_z, pl=pl, data=data, kappa=a0p.kappa, mu=nothing, wpm=wpm, savepl=savepl) return mpcac_ren(a0p.obs, pp.obs, plat, ca=ca,ba_bp_z=ba_bp_z, pl=pl, data=data, kappa=a0p.kappa, mu=nothing, wpm=wpm, savepl=savepl,label=label)
else else
return mpcac_ren(a0p.obs, pp.obs, plat, za_zp, ca=ca,ba_bp_z=ba_cp_z, pl=pl, data=data, mu=a0p.mu, kappa=nothing, wpm=wpm, savepl=savepl) return mpcac_ren(a0p.obs, pp.obs, plat, ca=ca,ba_bp_z=ba_bp_z, pl=pl, data=data, mu=a0p.mu, kappa=nothing, wpm=wpm, savepl=savepl,label=label)
end end
else else
error("mu or kappa values does not match") error("mu or kappa values does not match")
end end
end end
=#
## Decay constants ## Decay constants
@doc raw""" @doc raw"""
dec_const(a0p::Vector{uwreal}, pp::Vector{uwreal}, plat::Vector{Int64}, m::uwreal, y0::Int64; ca::Float64=0.0, pl::Bool=true, data::Bool=false, wpm::Union{Dict{Int64,Vector{Float64}},Dict{String,Vector{Float64}}, Nothing}=nothing) dec_const(a0p::Vector{uwreal}, pp::Vector{uwreal}, plat::Vector{Int64}, m::uwreal, y0::Int64; ca::Float64=0.0, pl::Bool=true, data::Bool=false, wpm::Union{Dict{Int64,Vector{Float64}},Dict{String,Vector{Float64}}, Nothing}=nothing)
......
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