Commit 0f1d86e0 authored by Javier's avatar Javier

juobs_tools minor changes

doc updated + minor redefinition
parent 1bc3f110
......@@ -141,7 +141,7 @@ Computes the results of a linear interpolation/extrapolation in the y axis
y_lin_fit(par::Vector{uwreal}, x::Union{uwreal, Float64}) = par[1] + par[2] * x
@doc raw"""
fit_routine(model::Function, ydata::Array{uwreal}, param::Int64=3)
fit_routine(model::Function, xdata::Array{<:Real}, ydata::Array{uwreal}, param::Int64=3)
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
......@@ -155,7 +155,7 @@ function fit_routine(model::Function, xdata::Array{<:Real}, ydata::Array{uwreal}
yer = err.(ydata)
chisq = gen_chisq(model, xdata, yer)
fit = curve_fit(model, xdata, yval, 1.0 ./ yer.^2, fill(0.5, param))
isnothing(wpm) ? (upar, chi_exp) = fit_error(chisq, coef(fit), ydata) : (upar, chi_exp) = fit_error(chisq, coef(fit), ydata, wpm)
(upar, chi_exp) = isnothing(wpm) ? fit_error(chisq, coef(fit), ydata) : fit_error(chisq, coef(fit), ydata, wpm)
for i = 1:length(upar)
uwerr(upar[i])
print("\n Fit parameter: ", i, ": ")
......
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