@@ -249,7 +249,7 @@ The method return an array upar with the best fit parameters with their errors.
...
@@ -249,7 +249,7 @@ The method return an array upar with the best fit parameters with their errors.
@. model(x,p) = p[1] + p[2] * exp(-(p[3]-p[1])*x)
@. model(x,p) = p[1] + p[2] * exp(-(p[3]-p[1])*x)
fit_routine(model, ydata, param=3)
fit_routine(model, ydata, param=3)
"""
"""
function fit_routine(model::Function,xdata::Array{<:Real},ydata::Array{uwreal},param::Int64=3;wpm::Union{Dict{Int64,Vector{Float64}},Dict{String,Vector{Float64}},Nothing}=nothing)
function fit_routine(model::Function,xdata::Array{<:Real},ydata::Array{uwreal},param::Int64=3;wpm::Union{Dict{Int64,Vector{Float64}},Dict{String,Vector{Float64}},Nothing}=nothing)
uwerr.(ydata)
uwerr.(ydata)
yval=value.(ydata)
yval=value.(ydata)
yer=err.(ydata)
yer=err.(ydata)
...
@@ -268,6 +268,65 @@ function gen_chisq(f::Function, x::Array{<:Real}, err::Vector{Float64})
...
@@ -268,6 +268,65 @@ function gen_chisq(f::Function, x::Array{<:Real}, err::Vector{Float64})
chisq(par,dat)=sum((dat.-f(x,par)).^2./err.^2)
chisq(par,dat)=sum((dat.-f(x,par)).^2./err.^2)
returnchisq
returnchisq
end
end
#TODO: COMBINED FITS, COVARIANCE X-Y
function fit_routine(model::Function,xdata::Array{uwreal},ydata::Array{uwreal},param::Int64=3;wpm::Union{Dict{Int64,Vector{Float64}},Dict{String,Vector{Float64}},Nothing}=nothing)