Commit 211d2807 authored by AlejandroSaezGonzalvo's avatar AlejandroSaezGonzalvo

Update bayesian_av to plot weights

parent fa1cacf5
......@@ -368,7 +368,7 @@ function bayesian_av(fun::Function, y::Array{uwreal}, tmin_array::Array{Int64},
chisq = gen_chisq(fun,x,dy)
fit = curve_fit(fun,x,value.(yy),W,p00)
isnothing(wpm) ? (up,chi_exp) = fit_error(chisq,coef(fit),yy) : (up,chi_exp) = fit_error(chisq,coef(fit),yy,wpm)
uwerr(up[1],wpm)
isnothing(wpm) ? uwerr(up[1]) : uwerr(up[1],wpm)
chi2 = sum(fit.resid.^2) * dof(fit) / chi_exp
push!(AIC, chi2 + 2*k + 2*Ncut)
push!(chi2chi2exp, chi2 / dof(fit))
......@@ -401,6 +401,13 @@ function bayesian_av(fun::Function, y::Array{uwreal}, tmin_array::Array{Int64},
xlabel(L"model")
display(gcf())
figure()
bar(x, weight_model, color="green")
ylabel(L"$weight$")
xlabel(L"model")
display(gcf())
end
if !data
......@@ -438,7 +445,7 @@ function bayesian_av(fun1::Function, fun2::Function, y::Array{uwreal}, tmin_arra
chisq = gen_chisq(fun1,x,dy)
fit = curve_fit(fun1,x,value.(yy),W,p00)
isnothing(wpm) ? (up,chi_exp) = fit_error(chisq,coef(fit),yy) : (up,chi_exp) = fit_error(chisq,coef(fit),yy,wpm)
uwerr(up[1],wpm)
isnothing(wpm) ? uwerr(up[1]) : uwerr(up[1],wpm)
chi2 = sum(fit.resid.^2) * dof(fit) / chi_exp
push!(AIC, chi2 + 2*k1 + 2*Ncut)
push!(chi2chi2exp, chi2 / dof(fit))
......@@ -482,6 +489,13 @@ function bayesian_av(fun1::Function, fun2::Function, y::Array{uwreal}, tmin_arra
xlabel(L"model")
display(gcf())
figure()
bar(x, weight_model, color="green")
ylabel(L"$weight$")
xlabel(L"model")
display(gcf())
end
if !data
......@@ -489,7 +503,7 @@ function bayesian_av(fun1::Function, fun2::Function, y::Array{uwreal}, tmin_arra
else
return (p1_mean, systematic_err, p1, weight_model)
end
end
......
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