Commit 363f46a1 authored by AlejandroSaezGonzalvo's avatar AlejandroSaezGonzalvo

bug fixed in bayesian_av from juobs_tools.jl

parent 6d6b63bb
......@@ -351,7 +351,7 @@ function bayesian_av(fun::Function, y::Array{uwreal}, tmin_array::Array{Int64},
for INDEX in tmin_array ## vary tmin
for j in tmax_array ## vary tmax
try
#try
x = [i for i in INDEX+1:1:j]
yy = y[INDEX+1:1:j]
Ncut = total - length(x)
......@@ -359,7 +359,7 @@ function bayesian_av(fun::Function, y::Array{uwreal}, tmin_array::Array{Int64},
W = 1 ./ dy .^2
p00 = [0.5 for i in 1:1:k]
chisq = fit_defs(fun,x,W)
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)
......@@ -367,9 +367,9 @@ 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])
catch e
@warn string(":/ Negative window for error propagation at tmin = ", INDEX, ", tmax = ", j, "; skipping that point")
end
#catch e
# @warn string(":/ Negative window for error propagation at tmin = ", INDEX, ", tmax = ", j, "; skipping that point")
#end
end
end
......@@ -409,7 +409,7 @@ function bayesian_av(fun1::Function, fun2::Function, y::Array{uwreal}, tmin_arra
W = 1 ./ dy .^2
p00 = [0.5 for i in 1:1:k1]
chisq = fit_defs(fun1,x,W)
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)
......@@ -419,7 +419,7 @@ function bayesian_av(fun1::Function, fun2::Function, y::Array{uwreal}, tmin_arra
push!(p1, up[1])
p00 = [0.5 for i in 1:1:k2]
chisq = fit_defs(fun2,x,W)
chisq = gen_chisq(fun2,x,dy)
fit = curve_fit(fun2,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)
......
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