Commit d790fe3f authored by Alejandro Saez's avatar Alejandro Saez

Update in bayesian_av

Now model labels in plots
parent e3532dd0
......@@ -347,6 +347,7 @@ function bayesian_av(fun::Function, y::Array{uwreal}, tmin_array::Array{Int64},
AIC = Array{Float64,1}()
chi2chi2exp = Array{Float64,1}()
p1 = Array{uwreal,1}()
mods = Array{String,1}()
if tmax_array[end] > length(y)
error("Error: upper bound for the fits is bigger than last data point")
......@@ -373,6 +374,8 @@ function bayesian_av(fun::Function, y::Array{uwreal}, tmin_array::Array{Int64},
push!(AIC, chi2 + 2*k + 2*Ncut)
push!(chi2chi2exp, chi2 / dof(fit))
push!(p1, up[1])
push!(mods,string("[", INDEX+1, ",", j, "]"))
catch e
@warn string(":/ Negative window for error propagation at tmin = ", INDEX, ", tmax = ", j, "; skipping that point")
end
......@@ -396,14 +399,14 @@ function bayesian_av(fun::Function, y::Array{uwreal}, tmin_array::Array{Int64},
figure()
fill_between(1:length(p1), v-e, v+e, color="green", alpha=0.75)
errorbar(x, y, dy, fmt="x", color="black")
errorbar(mods, y, dy, fmt="x", color="black")
ylabel(L"$p_1$")
xlabel(L"model")
display(gcf())
figure()
bar(x, weight_model, color="green")
errorbar(mods, weight_model, 0*dy, color="green")
ylabel(L"$weight$")
xlabel(L"model")
......@@ -424,6 +427,7 @@ function bayesian_av(fun1::Function, fun2::Function, y::Array{uwreal}, tmin_arra
AIC = Array{Float64,1}()
chi2chi2exp = Array{Float64,1}()
p1 = Array{uwreal,1}()
mods = Array{String,1}()
if tmax_array[end] > length(y)
error("Error: upper bound for the fits is bigger than last data point")
......@@ -451,6 +455,8 @@ function bayesian_av(fun1::Function, fun2::Function, y::Array{uwreal}, tmin_arra
push!(chi2chi2exp, chi2 / dof(fit))
push!(p1, up[1])
push!(mods,string("[", INDEX+1, ",", j, "]"))
p00 = [0.5 for i in 1:1:k2]
chisq = gen_chisq(fun2,x,dy)
fit = curve_fit(fun2,x,value.(yy),W,p00)
......@@ -461,6 +467,8 @@ function bayesian_av(fun1::Function, fun2::Function, y::Array{uwreal}, tmin_arra
push!(chi2chi2exp, chi2 / dof(fit))
push!(p1, up[1])
push!(mods,string("[", INDEX+1, ",", j, "]"))
catch e
@warn string(":/ Negative window for error propagation at tmin = ", INDEX, ", tmax = ", j, "; skipping that point")
end
......@@ -484,14 +492,14 @@ function bayesian_av(fun1::Function, fun2::Function, y::Array{uwreal}, tmin_arra
figure()
fill_between(1:length(p1), v-e, v+e, color="green", alpha=0.75)
errorbar(x, y, dy, fmt="x", color="black")
errorbar(mods, y, dy, fmt="x", color="black")
ylabel(L"$p_1$")
xlabel(L"model")
display(gcf())
figure()
bar(x, weight_model, color="green")
errorbar(mods, weight_model, 0*dy, color="green")
ylabel(L"$weight$")
xlabel(L"model")
......
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