Commit 785cb709 authored by Javier's avatar Javier

plat_av moved to juobs_tools and lin_fit exported

parent 1bcd9f33
......@@ -7,7 +7,7 @@ include("juobs_tools.jl")
include("juobs_obs.jl")
export read_mesons, read_ms1
export apply_rw, corr_obs
export plat_av, meff, dec_const_pcvc
export apply_rw, corr_obs, plat_av, lin_fit
export meff, dec_const_pcvc
end # module
function plat_av(obs::Vector{uwreal}, plat::Vector{Int64})
uwerr.(obs)
w = 1 ./ err.(obs)[plat[1]:plat[2]].^2
av = sum(w .* obs[plat[1]:plat[2]]) / sum(w)
return av
end
function meff(obs::Vector{uwreal}, plat::Vector{Int64}; pl::Bool=true, data::Bool=false )
dim = length(obs)
aux = log.(obs[2:dim-2] ./ obs[3:dim-1])
......
......@@ -57,7 +57,14 @@ function corr_obs(cdata::Array{CData, 1}; real::Bool=true, rw::Union{Array{Array
return Corr(obs, cdata)
end
#TODO: interpolation
function plat_av(obs::Vector{uwreal}, plat::Vector{Int64})
uwerr.(obs)
w = 1 ./ err.(obs)[plat[1]:plat[2]].^2
av = sum(w .* obs[plat[1]:plat[2]]) / sum(w)
return av
end
function lin_fit(x::Vector{Float64}, v::Vector{Float64}, e::Vector{Float64})
sig2 = e .* e
S = sum(1 ./ sig2)
......@@ -79,4 +86,6 @@ function lin_fit(x::Vector{Float64}, y::Vector{uwreal})
(fitp, csqexp) = fit_error(chisq, value.(par), y)
return (fitp, csqexp)
end
\ No newline at end of file
end
#TODO: interpolation
\ No newline at end of file
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