Commit bc1bcae9 authored by Alessandro 's avatar Alessandro

Added wpm documentation in fit_routine

parent bb15ee61
......@@ -8,7 +8,7 @@ include("juobs_tools.jl")
include("juobs_obs.jl")
export read_mesons, read_ms1, read_ms, read_md
export get_matrix, uwgevp_tot, energies, uwdot, uweigvals, uweigvecs, uweigen, invert, getall_eigvals, getall_eigvecs
export get_matrix, energies, uwdot, uweigvals, uweigvecs, uweigen, invert, getall_eigvals, getall_eigvecs
export corr_obs, plat_av, lin_fit, x_lin_fit, y_lin_fit, fit_routine
export meff, dec_const_pcvc, comp_t0
......
......@@ -63,7 +63,6 @@ function get_matrix(corr_diag::Vector{Vector{uwreal}}, corr_upper::Vector{Vector
aux = Matrix{uwreal}(undef, n, n)
for t in 1:time
count=0
#testing = corr_upper[1][1]
for i in range(n-1,1, step=-1)
for j in range(n, i+1, step=-1)
aux[i,j] = corr_upper[d-count][t]
......@@ -91,7 +90,6 @@ function energies(evals::Union{Vector{Vector{uwreal}},Array{Array{uwreal}} })
eff_en = Array{Array{uwreal}}(undef, n)
aux_en = Vector{uwreal}(undef, time-1)
for i in 1:n
#aux_en = Vector{uwreal}(undef, time-1)
for t in 1:time-1
ratio = evals[t][i] / evals[t+1][i]
aux_en[t] = 0.5*log(ratio * ratio)
......
......@@ -145,11 +145,19 @@ 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, xdata::Array{<:Real}, ydata::Array{uwreal}, param::Int64=3)
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 )
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
The method return an array upar with the best fit parameters with their errors.
The flag wpm is an optional array of Float64 of lenght 4. The first three paramenters specify the criteria to determine
the summation windows:
vp[1]: The autocorrelation function is summed up to t = round(vp[1]).
vp[2]: The sumation window is determined using U. Wolff poposal with S_\tau = wpm[2]
vp[3]: The autocorrelation function Γ(t) is summed up a point where its error δΓ(t) is a factor vp[3] times larger than the signal.
An additional fourth parameter vp[4], tells ADerrors to add a tail to the error with \tau_{exp} = wpm[4].
Negative values of wpm[1:4] are ignored and only one component of wpm[1:3] needs to be positive.
'''@example
@. model(x,p) = p[1] + p[2] * exp(-(p[3]-p[1])*x)
fit_routine(model, ydata, param=3)
......
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