Skip to content

Commit

Permalink
Added a status monitor parameter. Refs #7789.
Browse files Browse the repository at this point in the history
  • Loading branch information
wdzhou committed Feb 14, 2014
1 parent e6d4c98 commit f049a5b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Expand Up @@ -208,6 +208,9 @@ namespace Algorithms
/// Final goodness value (Rwp/Chi-square)
double m_finalGoodnessValue;

///
size_t m_numFitCalls;

};


Expand Down
14 changes: 11 additions & 3 deletions Code/Mantid/Framework/Algorithms/src/FitPeak.cpp
Expand Up @@ -67,7 +67,7 @@ namespace Algorithms
*/
FitOneSinglePeak::FitOneSinglePeak() : m_fitMethodSet(false), m_peakRangeSet(false),
m_peakWidthSet(false), m_peakWindowSet(false), m_usePeakPositionTolerance(false),
m_wsIndex(0)
m_wsIndex(0), m_numFitCalls(0)
{
}

Expand Down Expand Up @@ -329,7 +329,8 @@ namespace Algorithms
/** Fit peak with simple schemem
*/
bool FitOneSinglePeak::simpleFit()
{
{
m_numFitCalls = 0;
string errmsg;
if (!hasSetupToFitPeak(errmsg))
{
Expand Down Expand Up @@ -380,6 +381,8 @@ namespace Algorithms
g_log.information() << "One-Step-Fit Best (Chi^2 = " << m_bestRwp << ") Fitted Function: "
<< compfunc->asString() << "\n";

g_log.notice() << "Number of calls of Fit = " << m_numFitCalls << "\n";

return false;
}

Expand Down Expand Up @@ -506,6 +509,8 @@ namespace Algorithms
*/
bool FitOneSinglePeak::highBkgdFit()
{
m_numFitCalls = 0;

// Check and initialization
string errmsg;
if (!hasSetupToFitPeak(errmsg))
Expand Down Expand Up @@ -565,6 +570,8 @@ namespace Algorithms
g_log.information() << "MultStep-Fit: Best Fitted Peak: " << m_peakFunc->asString()
<< "Final " << m_costFunction << " = " << m_finalFitGoodness << "\n";

g_log.notice() << "Number of calls on Fit = " << m_numFitCalls << "\n";

return false;
}

Expand Down Expand Up @@ -662,7 +669,6 @@ namespace Algorithms
IAlgorithm_sptr fit;
try
{

fit = createChildAlgorithm("Fit", -1, -1, true);
}
catch (Exception::NotFoundError &)
Expand Down Expand Up @@ -696,6 +702,7 @@ namespace Algorithms
g_log.error("Fit for background is not executed. ");
throw std::runtime_error("Fit for background is not executed. ");
}
++ m_numFitCalls;

// Retrieve result
std::string fitStatus = fit->getProperty("OutputStatus");
Expand Down Expand Up @@ -785,6 +792,7 @@ namespace Algorithms
{
throw runtime_error("Fit is not executed on multi-domain function/data. ");
}
++ m_numFitCalls;

// Retrieve result
std::string fitStatus = fit->getProperty("OutputStatus");
Expand Down

0 comments on commit f049a5b

Please sign in to comment.