Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
FitRoutines
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
Antonino D'Anna
FitRoutines
Commits
3e595063
Commit
3e595063
authored
May 20, 2026
by
Antonino D'Anna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added find_first and find_all routines. Cleaned fit_scan
parent
deee6ba8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
3 deletions
+65
-3
src/find_fit.jl
src/find_fit.jl
+64
-0
src/fit_scan.jl
src/fit_scan.jl
+1
-3
No files found.
src/find_fit.jl
0 → 100644
View file @
3e595063
function
find_first
(
model
,
xdata
,
ydata
,
npar
;
condition
,
tmin
=
1
,
tmax
=
lastindex
(
xdata
),
W
=
Float64
[],
logfile
=
FitRoutines
.
NoPrint
(),
wpm
=
Dict
{
Int64
,
Vector
{
Float64
}}(),
C
=
Matrix
{
Float64
}(
undef
,
0
,
0
),
guess
=
fill
(
0.5
,
npar
),
corr
=
false
)
println
(
logfile
,
"Starting fits: find first mode"
)
Printf
.
@printf
logfile
"Scanning region [%.12e, %.12e]
\n
"
xdata
[
tmin
[
1
]]
xdata
[
tmax
[
1
]]
ranges
=
Ranges
(
tmin
,
tmax
)
println
(
logfile
,
ranges
)
flush
(
logfile
)
for
r
in
ranges
length
(
r
)
<=
npar
&&
continue
;
println
(
logfile
,
"="
^
80
,
"
\n
"
)
Printf
.
@printf
logfile
"Fit range [%.5e, %.5e]
\n
"
xdata
[
r
[
1
]]
xdata
[
r
[
end
]]
fit
=
try
fit_routine
(
model
,
xdata
[
r
],
ydata
[
r
],
npar
,
W
=
W
,
C
=
C
,
guess
=
guess
,
logfile
=
logfile
,
corr
=
corr
)
catch
e
Printf
.
@printf
logfile
"Error during fit routine: %s
\n
"
e
.
msg
@error
"Error in fit range [%.5e,%.5e]
\n
"
xdata
[
r
[
1
]]
xdata
[
r
[
end
]]
continue
;
end
condition
(
fit
)
&&
return
FitRes
(;
fit
...
,
range
=
(
xdata
[
r
[
1
]],
xdata
[
r
[
end
]]))
flush
(
logfile
)
end
return
nothing
end
function
find_all
(
model
,
xdata
,
ydata
,
npar
;
condition
,
tmin
=
1
,
tmax
=
lastindex
(
xdata
),
W
=
Float64
[],
logfile
=
FitRoutines
.
NoPrint
(),
wpm
=
Dict
{
Int64
,
Vector
{
Float64
}}(),
C
=
Matrix
{
Float64
}(
undef
,
0
,
0
),
guess
=
fill
(
0.5
,
npar
),
corr
=
false
)
println
(
logfile
,
"Starting fits: find first mode"
)
Printf
.
@printf
logfile
"Scanning region [%.12e, %.12e]
\n
"
xdata
[
tmin
[
1
]]
xdata
[
tmax
[
1
]]
ranges
=
Ranges
(
tmin
,
tmax
)
println
(
logfile
,
ranges
)
flush
(
logfile
)
res
=
FitRes
[];
for
r
in
reverse
(
ranges
)
length
(
r
)
<=
npar
&&
continue
;
println
(
logfile
,
"="
^
80
,
"
\n
"
)
Printf
.
@printf
logfile
"Fit range [%.5e, %.5e]
\n
"
xdata
[
r
[
1
]]
xdata
[
r
[
end
]]
fit
=
try
fit_routine
(
model
,
xdata
[
r
],
ydata
[
r
],
npar
,
W
=
W
,
C
=
C
,
guess
=
guess
,
logfile
=
logfile
,
corr
=
corr
)
catch
e
Printf
.
@printf
logfile
"Error during fit routine: %s
\n
"
e
.
msg
@error
"Error in fit range [%.5e,%.5e]
\n
"
xdata
[
r
[
1
]]
xdata
[
r
[
end
]]
continue
;
end
condition
(
fit
)
&&
push!
(
res
,
FitRes
(;
fit
...
,
range
=
(
xdata
[
r
[
1
]],
xdata
[
r
[
end
]])))
flush
(
logfile
)
end
return
res
end
src/fit_scan.jl
View file @
3e595063
...
...
@@ -14,9 +14,7 @@ function fit_scan(model,xdata,ydata,npar;
corr
=
false
)
println
(
logfile
,
"Starting Fit Scan"
)
Printf
.
@printf
logfile
"Scanning region [%.12e, %.12e]
\n
"
xdata
[
1
]
xdata
[
end
]
vdata
=
Vector
{
NamedTuple
}()
## vector of fit results
Printf
.
@printf
logfile
"Scanning region [%.12e, %.12e]
\n
"
xdata
[
tmin
[
1
]]
xdata
[
tmax
[
1
]]
ranges
=
Ranges
(
tmin
,
tmax
)
println
(
logfile
,
ranges
)
flush
(
logfile
)
...
...
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