function plat_av(obs::Vector{uwreal},plat::Vector{Int64},W::Matrix{Float64},wpm::Union{Dict{Int64,Vector{Float64}},Dict{String,Vector{Float64}},Nothing}=nothing)
println(logfile,"\t\tFit routine in [$(xdata[1]),...,$(xdata[end])]")
println(logfile,"\t\tparameters :",par...)
println(logfile,"\t\tchi2: ",chi2)
println(logfile,"\t\tchiexp: ",chiexp)
println(logfile,"\t\tpvalue: ",pval)
end
return(par=par,chi2=chi2,chiexp=chiexp,pval=pval)
end
#= function fit_routine(model::Vector{Function}, xdata::Vector{Array{Float64, N}} where N, ydata::Vector{Array{uwreal, N}} where N, param::Int64; wpm::Union{Dict{Int64,Vector{Float64}},Dict{String,Vector{Float64}}, Nothing}=nothing,
correlated_fit::Bool=false)
if !(length(model) == length(xdata) == length(ydata))
error("Dimension mismatch")
end
N = length(model)
dat = ydata[1]
idx = Vector{Vector{Int64}}(undef, N)
e = Vector{Vector{Float64}}(undef, N)
j = 1
for i = 1:N
if isnothing(wpm)
uwerr.(ydata[i])
else
else
# println(yaux for yaux in ydata[i])
W=[1/y.err^2foryinydata]
for yaux in ydata[i]
[uwerr(yaux[k], wpm) for k in 1:length(yaux)]
end
# [[uwerr(yaux[k], wpm) for k in eachindex(yaux)] for yaux in ydata[i]]