Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
02d49bac
Commit
02d49bac
authored
6 years ago
by
Pospelov, Gennady
Browse files
Options
Downloads
Patches
Plain Diff
More accurate processing of first and last iterations
parent
fa6dac6f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Core/Fitting/FitSuite.cpp
+6
-0
6 additions, 0 deletions
Core/Fitting/FitSuite.cpp
Core/Fitting/FitSuite.h
+3
-0
3 additions, 0 deletions
Core/Fitting/FitSuite.h
GUI/coregui/Views/FitWidgets/GUIFitObserver.cpp
+9
-4
9 additions, 4 deletions
GUI/coregui/Views/FitWidgets/GUIFitObserver.cpp
with
18 additions
and
4 deletions
Core/Fitting/FitSuite.cpp
+
6
−
0
View file @
02d49bac
...
@@ -156,6 +156,12 @@ FitSuiteStrategies* FitSuite::fitStrategies()
...
@@ -156,6 +156,12 @@ FitSuiteStrategies* FitSuite::fitStrategies()
return
m_impl
->
fitStrategies
();
return
m_impl
->
fitStrategies
();
}
}
bool
FitSuite
::
isFirstIteration
()
const
{
// FIXME temporary method: before refactoring first iteration had index 0
return
m_impl
->
numberOfIterations
()
==
1
;
}
bool
FitSuite
::
isLastIteration
()
const
bool
FitSuite
::
isLastIteration
()
const
{
{
return
m_impl
->
isLastIteration
();
return
m_impl
->
isLastIteration
();
...
...
This diff is collapsed.
Click to expand it.
Core/Fitting/FitSuite.h
+
3
−
0
View file @
02d49bac
...
@@ -127,6 +127,9 @@ public:
...
@@ -127,6 +127,9 @@ public:
//! Returns reference to fit parameters
//! Returns reference to fit parameters
FitSuiteStrategies
*
fitStrategies
();
FitSuiteStrategies
*
fitStrategies
();
//! temporary method to check if it is first iteration
bool
isFirstIteration
()
const
;
//! if the last iteration is done (used by observers to print summary)
//! if the last iteration is done (used by observers to print summary)
bool
isLastIteration
()
const
;
bool
isLastIteration
()
const
;
...
...
This diff is collapsed.
Click to expand it.
GUI/coregui/Views/FitWidgets/GUIFitObserver.cpp
+
9
−
4
View file @
02d49bac
...
@@ -18,7 +18,6 @@
...
@@ -18,7 +18,6 @@
#include
"FitSuite.h"
#include
"FitSuite.h"
#include
"GUIHelpers.h"
#include
"GUIHelpers.h"
#include
"MinimizerUtils.h"
#include
"MinimizerUtils.h"
#include
<QDebug>
GUIFitObserver
::
GUIFitObserver
(
QObject
*
parent
)
GUIFitObserver
::
GUIFitObserver
(
QObject
*
parent
)
:
QObject
(
parent
)
:
QObject
(
parent
)
...
@@ -44,6 +43,9 @@ void GUIFitObserver::update(FitSuite* subject)
...
@@ -44,6 +43,9 @@ void GUIFitObserver::update(FitSuite* subject)
if
(
m_block_update_plots
)
if
(
m_block_update_plots
)
m_on_finish_notifier
.
wait
(
lock
,
[
this
]()
{
return
m_block_update_plots
;
});
m_on_finish_notifier
.
wait
(
lock
,
[
this
]()
{
return
m_block_update_plots
;
});
if
(
subject
->
isFirstIteration
())
emit
logInfoUpdate
(
QString
::
fromStdString
(
subject
->
setupToString
()));
FitProgressInfo
info
;
FitProgressInfo
info
;
info
.
m_chi2
=
subject
->
getChi2
();
info
.
m_chi2
=
subject
->
getChi2
();
info
.
m_iteration_count
=
(
int
)
subject
->
numberOfIterations
();
info
.
m_iteration_count
=
(
int
)
subject
->
numberOfIterations
();
...
@@ -51,11 +53,12 @@ void GUIFitObserver::update(FitSuite* subject)
...
@@ -51,11 +53,12 @@ void GUIFitObserver::update(FitSuite* subject)
emit
progressInfoUpdate
(
info
);
emit
progressInfoUpdate
(
info
);
if
(
subject
->
isLastIteration
())
emit
logInfoUpdate
(
reportToString
(
subject
));
m_simData
.
reset
(
subject
->
simulationResult
().
data
());
m_simData
.
reset
(
subject
->
simulationResult
().
data
());
emit
plotsUpdate
();
emit
plotsUpdate
();
if
(
subject
->
isLastIteration
())
emit
logInfoUpdate
(
reportToString
(
subject
));
}
}
//! Returns true if data could be plotted, when there are resources for it.
//! Returns true if data could be plotted, when there are resources for it.
...
@@ -66,7 +69,9 @@ bool GUIFitObserver::is_suitable_iteration(FitSuite* fitSuite)
...
@@ -66,7 +69,9 @@ bool GUIFitObserver::is_suitable_iteration(FitSuite* fitSuite)
return
false
;
return
false
;
int
n_iter
=
static_cast
<
int
>
(
fitSuite
->
numberOfIterations
());
int
n_iter
=
static_cast
<
int
>
(
fitSuite
->
numberOfIterations
());
return
n_iter
==
0
||
n_iter
%
m_update_interval
==
0
||
n_iter
==
fitSuite
->
isLastIteration
();
return
n_iter
==
fitSuite
->
isFirstIteration
()
||
n_iter
%
m_update_interval
==
0
||
fitSuite
->
isLastIteration
();
}
}
//! Returns true if given iteration should be obligary plotted.
//! Returns true if given iteration should be obligary plotted.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment