Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
juobs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Javier Ugarrio
juobs
Commits
e9fc5112
Commit
e9fc5112
authored
Jul 14, 2021
by
Alessandro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fit routine now returns par and chi^2_corr
parent
46964452
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
+13
-8
src/juobs_tools.jl
src/juobs_tools.jl
+13
-8
No files found.
src/juobs_tools.jl
View file @
e9fc5112
...
@@ -398,8 +398,10 @@ function fit_routine(model::Function, xdata::Array{<:Real}, ydata::Array{uwreal}
...
@@ -398,8 +398,10 @@ function fit_routine(model::Function, xdata::Array{<:Real}, ydata::Array{uwreal}
print
(
"
\n
Fit parameter: "
,
i
,
": "
)
print
(
"
\n
Fit parameter: "
,
i
,
": "
)
details
(
upar
[
i
])
details
(
upar
[
i
])
end
end
chis2_corrected
=
(
length
(
yval
)
-
param
)
*
chisq
(
coef
(
fit
),
ydata
)
/
chi_exp
println
(
"Chisq / chiexp: "
,
chisq
(
coef
(
fit
),
ydata
),
" / "
,
chi_exp
,
" (dof: "
,
length
(
yval
)
-
param
,
")"
)
println
(
"Chisq / chiexp: "
,
chisq
(
coef
(
fit
),
ydata
),
" / "
,
chi_exp
,
" (dof: "
,
length
(
yval
)
-
param
,
")"
)
return
upar
println
(
"Chisq corrected: "
,
chis2_corrected
)
return
upar
,
value
(
chis2_corrected
)
end
end
function
fit_routine
(
model
::
Function
,
xdata
::
Array
{
uwreal
},
ydata
::
Array
{
uwreal
},
param
::
Int64
=
3
;
function
fit_routine
(
model
::
Function
,
xdata
::
Array
{
uwreal
},
ydata
::
Array
{
uwreal
},
param
::
Int64
=
3
;
...
@@ -454,6 +456,8 @@ function fit_routine(model::Function, xdata::Array{uwreal}, ydata::Array{uwreal}
...
@@ -454,6 +456,8 @@ function fit_routine(model::Function, xdata::Array{uwreal}, ydata::Array{uwreal}
(
upar
,
chi2_exp
)
=
isnothing
(
wpm
)
?
fit_error
(
chisq_full_cov
,
sol
.
minimizer
,
data
)
:
fit_error
(
chisq_full_cov
,
sol
.
minimizer
,
data
,
wpm
)
(
upar
,
chi2_exp
)
=
isnothing
(
wpm
)
?
fit_error
(
chisq_full_cov
,
sol
.
minimizer
,
data
)
:
fit_error
(
chisq_full_cov
,
sol
.
minimizer
,
data
,
wpm
)
println
(
"Chisq / chiexp: "
,
min_fun_cov
(
sol
.
minimizer
),
" / "
,
chi2_exp
,
" (dof: "
,
length
(
ydata
)
-
param
,
")"
)
println
(
"Chisq / chiexp: "
,
min_fun_cov
(
sol
.
minimizer
),
" / "
,
chi2_exp
,
" (dof: "
,
length
(
ydata
)
-
param
,
")"
)
chis2_corrected
=
(
length
(
ydata
)
-
param
)
*
min_fun_cov
(
sol
.
minimizer
)
/
chi2_exp
println
(
"Chisq corrected: "
,
chis2_corrected
)
else
else
chisq_full
(
p
,
d
)
=
get_chi2
(
model
,
d
,
ddat
,
p
,
Nalpha
)
chisq_full
(
p
,
d
)
=
get_chi2
(
model
,
d
,
ddat
,
p
,
Nalpha
)
min_fun
(
t
)
=
chisq_full
(
t
,
dat
)
min_fun
(
t
)
=
chisq_full
(
t
,
dat
)
...
@@ -461,19 +465,20 @@ function fit_routine(model::Function, xdata::Array{uwreal}, ydata::Array{uwreal}
...
@@ -461,19 +465,20 @@ function fit_routine(model::Function, xdata::Array{uwreal}, ydata::Array{uwreal}
(
upar
,
chi2_exp
)
=
isnothing
(
wpm
)
?
fit_error
(
chisq_full
,
sol
.
minimizer
,
data
)
:
fit_error
(
chisq_full
,
sol
.
minimizer
,
data
,
wpm
)
(
upar
,
chi2_exp
)
=
isnothing
(
wpm
)
?
fit_error
(
chisq_full
,
sol
.
minimizer
,
data
)
:
fit_error
(
chisq_full
,
sol
.
minimizer
,
data
,
wpm
)
println
(
"Chisq / chiexp: "
,
min_fun
(
sol
.
minimizer
),
" / "
,
chi2_exp
,
" (dof: "
,
length
(
ydata
)
-
param
,
")"
)
println
(
"Chisq / chiexp: "
,
min_fun
(
sol
.
minimizer
),
" / "
,
chi2_exp
,
" (dof: "
,
length
(
ydata
)
-
param
,
")"
)
chis2_corrected
=
(
length
(
ydata
)
-
param
)
*
min_fun
(
sol
.
minimizer
)
/
chi2_exp
println
(
"Chisq corrected: "
,
chis2_corrected
)
end
end
#### chisq_full, min_fun out of conditional ->
#### chisq_full, min_fun out of conditional ->
#### COMPILER WARNING ** incremental compilation may be fatally broken for this module **
#### COMPILER WARNING ** incremental compilation may be fatally broken for this module **
# Info
# Info
for
i
=
1
:
length
(
upar
)
#
for i = 1:length(upar)
isnothing
(
wpm
)
?
uwerr
(
upar
[
i
])
:
uwerr
(
upar
[
i
],
wpm
)
#
isnothing(wpm) ? uwerr(upar[i]) : uwerr(upar[i], wpm)
print
(
"
\n
Fit parameter: "
,
i
,
": "
)
#
print("\n Fit parameter: ", i, ": ")
details
(
upar
[
i
])
#
details(upar[i])
end
#
end
return
upar
return
upar
,
chis2_corrected
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment