Skip to content

Commit

Permalink
Add property minimum peak height. Refs #7001.
Browse files Browse the repository at this point in the history
  • Loading branch information
wdzhou committed Jun 18, 2013
1 parent c757b36 commit fad6486
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,9 @@ class DLLExport FindPeaks : public API::Algorithm

std::string m_minimizer;

/// Minimum peak height
double m_minHeight;

};

} // namespace Algorithms
Expand Down
11 changes: 9 additions & 2 deletions Code/Mantid/Framework/Algorithms/src/FindPeaks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ using namespace Mantid::Kernel;
using namespace Mantid::API;
using namespace Mantid::DataObjects;

const double MINHEIGHT = 2.00000001;
// const double MINHEIGHT = 2.00000001;

namespace Mantid
{
Expand Down Expand Up @@ -238,6 +238,10 @@ namespace Algorithms
declareProperty("RawPeakParameters", false,
"false generates table with effective centre/width/height parameters. true generates a table with peak function parameters");


declareProperty("MinimumPeakHeight", DBL_MIN, "Minimum allowed peak height. ");


// Debug Workspaces
/*
declareProperty(new WorkspaceProperty<API::MatrixWorkspace>("BackgroundWorkspace", "", Direction::Output),
Expand Down Expand Up @@ -391,6 +395,9 @@ namespace Algorithms
// Peak parameters are give via a table workspace
m_rawPeaksTable = getProperty("RawPeakParameters");

// Minimum peak height
m_minHeight = getProperty("MinimumPeakHeight");

return;
}

Expand Down Expand Up @@ -1899,7 +1906,7 @@ namespace Algorithms
error = "Flat spectrum";
return false;
}
else if (height <= MINHEIGHT)
else if (height <= m_minHeight)
{
error = "Fluctuation is less than minimum allowed value.";
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ namespace Algorithms
"An output workspace containing the mask.");
declareProperty("MaxOffset", 1.0, "Maximum absolute value of offsets; default is 1");
declareProperty("MaxChiSq", 100., "Maximum chisq value for individual peak fit allowed. (Default: 100)");

declareProperty("MinimumPeakHeight", 2.0, "Minimum value allowed for peak height.");
//Disable default gsl error handler (which is to call abort!)
gsl_set_error_handler_off();

Expand Down Expand Up @@ -647,6 +649,9 @@ namespace Algorithms

#endif

double minpeakheight = getProperty("MinimumPeakHeight");


API::IAlgorithm_sptr findpeaks = createChildAlgorithm("FindPeaks", -1, -1, false);
findpeaks->setProperty("InputWorkspace", inputW);
findpeaks->setProperty<int>("FWHM",7);
Expand All @@ -663,6 +668,7 @@ namespace Algorithms
findpeaks->setProperty<bool>("HighBackground", this->getProperty("HighBackground"));
findpeaks->setProperty<int>("MinGuessedPeakWidth",4);
findpeaks->setProperty<int>("MaxGuessedPeakWidth",4);
findpeaks->setProperty<double>("MinimumPeakHeight", minpeakheight);
findpeaks->executeAsChildAlg();
ITableWorkspace_sptr peakslist = findpeaks->getProperty("PeaksList");
std::vector<size_t> banned;
Expand Down

0 comments on commit fad6486

Please sign in to comment.