Given a model function with a number param of parameters and an array of uwreal,
Given a model function with a number param of parameters and an array of uwreal,
this function fit ydata with the given model and print fit information
this function fit ydata with the given model and print fit information
The method return an array upar with the best fit parameters with their errors.
The method return an array upar with the best fit parameters with their errors.
'''@example
'''@example
@. 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, xdata, 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)
...
@@ -269,8 +271,10 @@ function gen_chisq(f::Function, x::Array{<:Real}, err::Vector{Float64})
...
@@ -269,8 +271,10 @@ function gen_chisq(f::Function, x::Array{<:Real}, err::Vector{Float64})
returnchisq
returnchisq
end
end
#TODO: COMBINED FITS, COVARIANCE X-Y
#TODO: COMBINED FITS, UPDATE DOC
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)
function fit_routine(model::Function,xdata::Array{uwreal},ydata::Array{uwreal},param::Int64=3;