Mantid
Loading...
Searching...
No Matches
FindSXPeaks.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
8#include "MantidAPI/Axis.h"
10#include "MantidAPI/Run.h"
13#include "MantidIndexing/IndexInfo.h"
18#include "MantidKernel/Unit.h"
20
21#include <vector>
22
23using namespace Mantid::DataObjects;
24using namespace Mantid::API;
26
27namespace Mantid::Crystal {
28
29const std::string FindSXPeaks::strongestPeakStrategy = "StrongestPeakOnly";
30const std::string FindSXPeaks::allPeaksStrategy = "AllPeaks";
31const std::string FindSXPeaks::allPeaksNSigmaStrategy = "AllPeaksNSigma";
32
33const std::string FindSXPeaks::relativeResolutionStrategy = "RelativeResolution";
34const std::string FindSXPeaks::absoluteResolutionPeaksStrategy = "AbsoluteResolution";
35
36// Register the class into the algorithm factory
38
39using namespace Kernel;
40using namespace API;
42
44 : API::Algorithm(), m_MinRange(DBL_MAX), m_MaxRange(-DBL_MAX), m_MinWsIndex(0), m_MaxWsIndex(0) {}
45
50 auto wsValidation = std::make_shared<CompositeValidator>();
51 wsValidation->add<HistogramValidator>();
52
53 auto unitValidation = std::make_shared<CompositeValidator>(CompositeRelation::OR);
54 unitValidation->add<WorkspaceUnitValidator>("TOF");
55 unitValidation->add<WorkspaceUnitValidator>("dSpacing");
56
57 wsValidation->add(unitValidation);
58
59 declareProperty(std::make_unique<WorkspaceProperty<>>("InputWorkspace", "", Direction::Input, wsValidation),
60 "The name of the Workspace2D to take as input");
61 declareProperty("RangeLower", EMPTY_DBL(), "The X value to search from (default 0)");
62 declareProperty("RangeUpper", EMPTY_DBL(), "The X value to search to (default total number of bins)");
63 auto mustBePositive = std::make_shared<BoundedValidator<int>>();
64 mustBePositive->setLower(0);
65 declareProperty("StartWorkspaceIndex", 0, mustBePositive, "Start workspace index (default 0)");
66 declareProperty("EndWorkspaceIndex", EMPTY_INT(), mustBePositive,
67 "End workspace index (default to total number of histograms)");
68
69 // ---------------------------------------------------------------
70 // Peak strategies + Threshold
71 // ---------------------------------------------------------------
72 auto mustBePositiveDouble = std::make_shared<BoundedValidator<double>>();
73 mustBePositiveDouble->setLower(0.0);
74
75 std::vector<std::string> peakFindingStrategy = {strongestPeakStrategy, allPeaksStrategy, allPeaksNSigmaStrategy};
76 declareProperty("PeakFindingStrategy", strongestPeakStrategy,
77 std::make_shared<StringListValidator>(peakFindingStrategy),
78 "Different options for peak finding."
79 "1. StrongestPeakOnly: Looks only for the strongest peak in each "
80 "spectrum (provided there is "
81 "one). This options is more performant than the AllPeaks option.\n"
82 "2. AllPeaks: This strategy will find all peaks in each "
83 "spectrum. This is slower than StrongestPeakOnly. Note that the "
84 "recommended ResolutionStrategy in this mode is AbsoluteResolution.\n"
85 "3. AllPeaksNSigma: This stratergy will look for peaks by bins that are"
86 " more than nsigma different in intensity. Note that the "
87 "recommended ResolutionStrategy in this mode is AbsoluteResolution.\n");
88
89 // Declare
90 declareProperty("SignalBackground", 10.0, mustBePositiveDouble,
91 "Multiplication factor for the signal background. Peaks which are"
92 " below the estimated background are discarded. The background is "
93 "estimated"
94 " to be an average of the first and the last signal and multiplied"
95 " by the SignalBackground property.\n");
96
97 declareProperty("AbsoluteBackground", 30.0, mustBePositiveDouble,
98 "Peaks which are below the specified absolute background are discarded."
99 " The background is gloabally specified for all spectra. Inspect your "
100 "data in the InstrumentView to get a good feeling for the background "
101 "threshold.\n"
102 "Background thresholds which are too low will mistake noise for peaks.");
103
105 "NSigma", 5.0, mustBePositiveDouble,
106 "Multiplication factor on error used to compare the difference in intensity between consecutive bins.");
107
108 // Enable
109 setPropertySettings("SignalBackground", std::make_unique<EnabledWhenProperty>(
112
113 setPropertySettings("AbsoluteBackground",
114 std::make_unique<EnabledWhenProperty>(
116
117 setPropertySettings("NSigma", std::make_unique<EnabledWhenProperty>("PeakFindingStrategy",
120
121 // Group
122 const std::string peakGroup = "Peak Finding Settings";
123 setPropertyGroup("PeakFindingStrategy", peakGroup);
124 setPropertyGroup("SignalBackground", peakGroup);
125 setPropertyGroup("AbsoluteBackground", peakGroup);
126 setPropertyGroup("NSigma", peakGroup);
127
128 // ---------------------------------------------------------------
129 // Resolution
130 // ---------------------------------------------------------------
131 // Declare
132 std::vector<std::string> resolutionStrategy = {relativeResolutionStrategy, absoluteResolutionPeaksStrategy};
133 declareProperty("ResolutionStrategy", relativeResolutionStrategy,
134 std::make_shared<StringListValidator>(resolutionStrategy),
135 "Different options for the resolution."
136 "1. RelativeResolution: This defines a relative tolerance "
137 "needed to avoid peak duplication in number of pixels. "
138 "This selection will enable the Resolution property and "
139 "disable the XResolution, PhiResolution, ThetaResolution.\n"
140 "1. AbsoluteResolution: This defines an absolute tolerance "
141 "needed to avoid peak duplication in number of pixels. "
142 "This selection will disable the Resolution property and "
143 "enable the XResolution, PhiResolution, "
144 "ThetaResolution.\n");
145
146 declareProperty("Resolution", 0.01, mustBePositiveDouble,
147 "Tolerance needed to avoid peak duplication in number of pixels");
148
149 declareProperty("XResolution", 0., mustBePositiveDouble,
150 "Absolute tolerance in time-of-flight or d-spacing needed to avoid peak "
151 "duplication in number of pixels. The values are specified "
152 "in either microseconds or angstroms.");
153
154 declareProperty("PhiResolution", 1., mustBePositiveDouble,
155 "Absolute tolerance in the phi "
156 "coordinate needed to avoid peak "
157 "duplication in number of pixels. The "
158 "values are specified in degrees.");
159
160 declareProperty("TwoThetaResolution", 1., mustBePositiveDouble,
161 "Absolute tolerance of two theta value needed to avoid peak "
162 "duplication in number of pixels. The values are specified "
163 "in degrees.");
164
165 // Enable
166 setPropertySettings("Resolution", std::make_unique<EnabledWhenProperty>(
169
170 setPropertySettings("XResolution", std::make_unique<EnabledWhenProperty>(
173
174 setPropertySettings("PhiResolution", std::make_unique<EnabledWhenProperty>(
177
178 setPropertySettings("TwoThetaResolution", std::make_unique<EnabledWhenProperty>(
181
182 // Group
183 const std::string resolutionGroup = "Resolution Settings";
184 setPropertyGroup("ResolutionStrategy", resolutionGroup);
185 setPropertyGroup("Resolution", resolutionGroup);
186 setPropertyGroup("XResolution", resolutionGroup);
187 setPropertyGroup("PhiResolution", resolutionGroup);
188 setPropertyGroup("TwoThetaResolution", resolutionGroup);
189
190 // Declare
191 declareProperty("MinNBinsPerPeak", EMPTY_INT(), mustBePositive,
192 "Minimum number of bins contributing to a peak in an individual spectrum");
193
194 declareProperty("MinNSpectraPerPeak", EMPTY_INT(), mustBePositive,
195 "Minimum number of spectra contributing to a peak after they are grouped");
196
197 declareProperty("MaxNSpectraPerPeak", EMPTY_INT(), mustBePositive,
198 "Maximum number of spectra contributing to a peak after they are grouped");
199
200 // Group
201 const std::string peakValidationGroup = "Peak Validation Settings";
202 setPropertyGroup("MinNBinsPerPeak", peakValidationGroup);
203 setPropertyGroup("MinNSpectraPerPeak", peakValidationGroup);
204 setPropertyGroup("MaxNSpectraPerPeak", peakValidationGroup);
205
206 declareProperty(std::make_unique<WorkspaceProperty<PeaksWorkspace>>("OutputWorkspace", "", Direction::Output),
207 "The name of the PeaksWorkspace in which to store the list "
208 "of peaks found");
209
210 // Create the output peaks workspace
211 m_peaks.reset(new PeaksWorkspace);
212}
213
214/*
215 * Validate the input parameters
216 * @returns map with keys corresponding to properties with errors and values
217 * containing the error messages.
218 */
219std::map<std::string, std::string> FindSXPeaks::validateInputs() {
220 // create the map
221 std::map<std::string, std::string> validationOutput;
222 const std::string resolutionStrategy = getProperty("ResolutionStrategy");
223 auto const *xResolutionProperty = getPointerToProperty("XResolution");
224
225 // Check that the user has set a valid value for the x resolution when
226 // in absolute resolution mode.
227 if (resolutionStrategy == FindSXPeaks::absoluteResolutionPeaksStrategy && xResolutionProperty->isDefault()) {
228 validationOutput["XResolution"] = "XResolution must be set to a value greater than 0";
229 }
230
231 const int minNSpectraPerPeak = getProperty("MinNSpectraPerPeak");
232 const int maxNSpectraPerPeak = getProperty("MaxNSpectraPerPeak");
233 if (!isEmpty(minNSpectraPerPeak) && !isEmpty(maxNSpectraPerPeak)) {
234 if (maxNSpectraPerPeak < minNSpectraPerPeak) {
235 validationOutput["MaxNSpectraPerPeak"] = "MaxNSpectraPerPeak must be greater than MinNSpectraPerPeak";
236 validationOutput["MinNSpectraPerPeak"] = "MinNSpectraPerPeak must be lower than MaxNSpectraPerPeak";
237 }
238 }
239
240 MatrixWorkspace_const_sptr inputWorkspace = getProperty("InputWorkspace");
241 if (inputWorkspace) {
242 const int minWsIndex = getProperty("StartWorkspaceIndex");
243 const int maxWsIndex = getProperty("EndWorkspaceIndex");
244 size_t numberOfSpectraToConsider =
245 !isEmpty(minWsIndex) ? (!isEmpty(maxWsIndex) ? (maxWsIndex - minWsIndex + 1)
246 : (inputWorkspace->getNumberHistograms() - minWsIndex))
247 : (!isEmpty(maxWsIndex) ? (maxWsIndex + 1) : (inputWorkspace->getNumberHistograms()));
248
249 if (!isEmpty(minNSpectraPerPeak)) {
250 if (static_cast<int>(numberOfSpectraToConsider) < minNSpectraPerPeak) {
251 validationOutput["MinNSpectraPerPeak"] =
252 "MinNSpectraPerPeak must be less than the number of spectrums considered in InputWorkspace";
253 }
254 }
255
256 if (!isEmpty(maxNSpectraPerPeak)) {
257 if (static_cast<int>(numberOfSpectraToConsider) < maxNSpectraPerPeak) {
258 validationOutput["MaxNSpectraPerPeak"] =
259 "MaxNSpectraPerPeak must be less than the number of spectrums considered in InputWorkspace";
260 }
261 }
262
263 const int minNBinsPerPeak = getProperty("MinNBinsPerPeak");
264 if (!isEmpty(minNBinsPerPeak)) {
265 if (minNBinsPerPeak > static_cast<int>(inputWorkspace->getMaxNumberBins())) {
266 validationOutput["MinNBinsPerPeak"] =
267 "MinNBinsPerPeak must be less than the number of bins in the InputWorkspace";
268 }
269 }
270 }
271
272 return validationOutput;
273}
274
280 // Try and retrieve the optional properties
281 m_MinRange = getProperty("RangeLower");
282 m_MaxRange = getProperty("RangeUpper");
283
284 // the assignment below is intended and if removed will break the unit tests
285 m_MinWsIndex = static_cast<int>(getProperty("StartWorkspaceIndex"));
286 m_MaxWsIndex = static_cast<int>(getProperty("EndWorkspaceIndex"));
287
288 // Get the input workspace
289 MatrixWorkspace_const_sptr localworkspace = getProperty("InputWorkspace");
290
291 // copy the instrument across. Cannot generate peaks without doing this
292 // first.
293 m_peaks->setInstrument(localworkspace->getInstrument());
294
295 size_t numberOfSpectra = localworkspace->getNumberHistograms();
296
297 // Check 'StartSpectrum' is in range 0-numberOfSpectra
298 if (m_MinWsIndex > numberOfSpectra) {
299 g_log.warning("StartSpectrum out of range! Set to 0.");
300 m_MinWsIndex = 0;
301 }
303 throw std::invalid_argument("Cannot have StartWorkspaceIndex > EndWorkspaceIndex");
304 }
306 m_MaxWsIndex = numberOfSpectra - 1;
307 if (m_MaxWsIndex > numberOfSpectra - 1 || m_MaxWsIndex < m_MinWsIndex) {
308 g_log.warning("EndSpectrum out of range! Set to max detector number");
309 m_MaxWsIndex = numberOfSpectra - 1;
310 }
311 if (m_MinRange > m_MaxRange) {
312 g_log.warning("Range_upper is less than Range_lower. Will integrate up to "
313 "frame maximum.");
314 m_MaxRange = 0.0;
315 }
316
317 Progress progress(this, 0.0, 1.0, m_MaxWsIndex - m_MinWsIndex + 2);
318
319 // Calculate the primary flight path.
320 const auto &spectrumInfo = localworkspace->spectrumInfo();
321
322 // Get the background strategy
323 auto backgroundStrategy = getBackgroundStrategy();
324
325 // Get the peak finding strategy
326 const auto xUnit = getWorkspaceXAxisUnit(localworkspace);
327 auto peakFindingStrategy =
328 getPeakFindingStrategy(backgroundStrategy.get(), spectrumInfo, m_MinRange, m_MaxRange, xUnit);
329
330 const int minNBinsPerPeak = getProperty("MinNBinsPerPeak");
331 if (!isEmpty(minNBinsPerPeak)) {
332 peakFindingStrategy->setMinNBinsPerPeak(minNBinsPerPeak);
333 }
334
335 peakvector entries;
336 entries.reserve(m_MaxWsIndex - m_MinWsIndex);
337 // Count the peaks so that we can resize the peak vector at the end.
338
339 PARALLEL_FOR_IF(Kernel::threadSafe(*localworkspace))
340 for (auto wsIndex = static_cast<int>(m_MinWsIndex); wsIndex <= static_cast<int>(m_MaxWsIndex); ++wsIndex) {
342
343 // If no detector found / monitor, skip onto the next spectrum
344 const auto wsIndexSize_t = static_cast<size_t>(wsIndex);
345 if (!spectrumInfo.hasDetectors(wsIndexSize_t) || spectrumInfo.isMonitor(wsIndexSize_t)) {
346 continue;
347 }
348
349 // Retrieve the spectrum into a vector
350 const auto &x = localworkspace->x(wsIndex);
351 const auto &y = localworkspace->y(wsIndex);
352 const auto &e = localworkspace->e(wsIndex);
353
354 // Run the peak finding strategy
355 auto foundPeaks = peakFindingStrategy->findSXPeaks(x, y, e, wsIndex);
356 if (!foundPeaks) {
357 continue;
358 }
359
360 PARALLEL_CRITICAL(entries) { std::copy(foundPeaks->cbegin(), foundPeaks->cend(), std::back_inserter(entries)); }
361 progress.report();
363 }
365
366 // Now reduce the list with duplicate entries
367 reducePeakList(entries, progress);
368
369 setProperty("OutputWorkspace", m_peaks);
370 progress.report();
371}
372
380 MatrixWorkspace_const_sptr localworkspace = getProperty("InputWorkspace");
381 auto &goniometerMatrix = localworkspace->run().getGoniometer().getR();
382 auto compareStrategy = getCompareStrategy();
383 auto reductionStrategy = getReducePeakListStrategy(compareStrategy.get());
384
385 const int minNSpectraPerPeak = getProperty("MinNSpectraPerPeak");
386 if (!isEmpty(minNSpectraPerPeak)) {
387 reductionStrategy->setMinNSpectraPerPeak(minNSpectraPerPeak);
388 }
389
390 const int maxNSpectraPerPeak = getProperty("MaxNSpectraPerPeak");
391 if (!isEmpty(maxNSpectraPerPeak)) {
392 reductionStrategy->setMaxNSpectraPerPeak(maxNSpectraPerPeak);
393 }
394
395 auto finalv = reductionStrategy->reduce(pcv, progress);
396
397 for (auto &finalPeak : finalv) {
398 finalPeak.reduce();
399 try {
400 IPeak_uptr ipeak = m_peaks->createPeak(finalPeak.getQ());
401 Peak_uptr peak(static_cast<Peak *>(ipeak.release()));
402 if (peak) {
403 peak->setIntensity(finalPeak.getIntensity());
404 peak->setDetectorID(finalPeak.getDetectorId());
405 peak->setGoniometerMatrix(goniometerMatrix);
406 peak->setRunNumber(localworkspace->getRunNumber());
407 m_peaks->addPeak(*peak);
408 }
409 } catch (std::exception &e) {
410 g_log.error() << e.what() << '\n';
411 }
412 }
413}
414
424 const auto xAxis = workspace->getAxis(0);
425 const auto unitID = xAxis->unit()->unitID();
426
427 if (unitID == "TOF") {
428 return XAxisUnit::TOF;
429 } else {
430 return XAxisUnit::DSPACING;
431 }
432}
433
434std::unique_ptr<BackgroundStrategy> FindSXPeaks::getBackgroundStrategy() const {
435 const std::string peakFindingStrategy = getProperty("PeakFindingStrategy");
436 if (peakFindingStrategy == strongestPeakStrategy) {
437 const double signalBackground = getProperty("SignalBackground");
438 return std::make_unique<PerSpectrumBackgroundStrategy>(signalBackground);
439 } else if (peakFindingStrategy == allPeaksStrategy) {
440 const double background = getProperty("AbsoluteBackground");
441 return std::make_unique<AbsoluteBackgroundStrategy>(background);
442 } else if (peakFindingStrategy == allPeaksNSigmaStrategy) {
443 return nullptr; // AllPeaksNSigma stratergy does not require a background stratergy
444 } else {
445 throw std::invalid_argument("The selected background strategy has not been implemented yet.");
446 }
447}
448
449std::unique_ptr<FindSXPeaksHelper::PeakFindingStrategy>
450FindSXPeaks::getPeakFindingStrategy(const BackgroundStrategy *backgroundStrategy, const API::SpectrumInfo &spectrumInfo,
451 const double minValue, const double maxValue, const XAxisUnit tofUnits) const {
452 // Get the peak finding stratgy
453 std::string peakFindingStrategy = getProperty("PeakFindingStrategy");
454 if (peakFindingStrategy == strongestPeakStrategy) {
455 return std::make_unique<StrongestPeaksStrategy>(backgroundStrategy, spectrumInfo, minValue, maxValue, tofUnits);
456 } else if (peakFindingStrategy == allPeaksStrategy) {
457 return std::make_unique<AllPeaksStrategy>(backgroundStrategy, spectrumInfo, minValue, maxValue, tofUnits);
458 } else if (peakFindingStrategy == allPeaksNSigmaStrategy) {
459 const double nsigma = getProperty("NSigma");
460 return std::make_unique<NSigmaPeaksStrategy>(spectrumInfo, nsigma, minValue, maxValue, tofUnits);
461 } else {
462 throw std::invalid_argument("The selected peak finding strategy has not been implemented yet.");
463 }
464}
465
466std::unique_ptr<FindSXPeaksHelper::ReducePeakListStrategy>
468 const std::string peakFindingStrategy = getProperty("PeakFindingStrategy");
469 auto useSimpleReduceStrategy = peakFindingStrategy == strongestPeakStrategy;
470 if (useSimpleReduceStrategy) {
471 return std::make_unique<FindSXPeaksHelper::SimpleReduceStrategy>(compareStrategy);
472 } else {
473 return std::make_unique<FindSXPeaksHelper::FindMaxReduceStrategy>(compareStrategy);
474 }
475}
476
477std::unique_ptr<FindSXPeaksHelper::CompareStrategy> FindSXPeaks::getCompareStrategy() const {
478 const std::string resolutionStrategy = getProperty("ResolutionStrategy");
479 auto useRelativeResolutionStrategy = resolutionStrategy == relativeResolutionStrategy;
480 if (useRelativeResolutionStrategy) {
481 double resolution = getProperty("Resolution");
482 return std::make_unique<FindSXPeaksHelper::RelativeCompareStrategy>(resolution);
483 } else {
484 double xUnitResolution = getProperty("XResolution");
485 double phiResolution = getProperty("PhiResolution");
486 double twoThetaResolution = getProperty("TwoThetaResolution");
487 const auto tofUnits = getWorkspaceXAxisUnit(getProperty("InputWorkspace"));
488 return std::make_unique<FindSXPeaksHelper::AbsoluteCompareStrategy>(xUnitResolution, phiResolution,
489 twoThetaResolution, tofUnits);
490 }
491}
492
493} // namespace Mantid::Crystal
#define DECLARE_ALGORITHM(classname)
Definition Algorithm.h:538
IPeaksWorkspace_sptr workspace
#define PARALLEL_START_INTERRUPT_REGION
Begins a block to skip processing is the algorithm has been interupted Note the end of the block if n...
#define PARALLEL_CRITICAL(name)
#define PARALLEL_END_INTERRUPT_REGION
Ends a block to skip processing is the algorithm has been interupted Note the start of the block if n...
#define PARALLEL_FOR_IF(condition)
Empty definitions - to enable set your complier to enable openMP.
#define PARALLEL_CHECK_INTERRUPT_REGION
Adds a check after a Parallel region to see if it was interupted.
Base class from which all concrete algorithm classes should be derived.
Definition Algorithm.h:76
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
Kernel::Property * getPointerToProperty(const std::string &name) const override
Get a property by name.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
Kernel::Logger & g_log
Definition Algorithm.h:422
void progress(double p, const std::string &msg="", double estimatedTime=0.0, int progressPrecision=0)
Sends ProgressNotification.
static bool isEmpty(const NumT toCheck)
checks that the value was not set by users, uses the value in empty double/int.
A validator which checks that a workspace contains histogram data (the default) or point data as requ...
Helper class for reporting progress from algorithms.
Definition Progress.h:25
API::SpectrumInfo is an intermediate step towards a SpectrumInfo that is part of Instrument-2....
A property class for workspaces.
A validator which checks that the unit of the workspace referred to by a WorkspaceProperty is the exp...
BackgroundStrategy : Abstract class used for identifying elements of a IMDWorkspace that are not cons...
Search detector space for single crystal peaks.
Definition FindSXPeaks.h:38
FindSXPeaksHelper::XAxisUnit getWorkspaceXAxisUnit(const Mantid::API::MatrixWorkspace_const_sptr &workspace) const
Check what x units this workspace has.
static const std::string absoluteResolutionPeaksStrategy
Definition FindSXPeaks.h:61
static const std::string allPeaksNSigmaStrategy
Definition FindSXPeaks.h:59
Mantid::DataObjects::PeaksWorkspace_sptr m_peaks
size_t m_MaxWsIndex
The spectrum to finish the integration at.
Definition FindSXPeaks.h:98
void exec() override
Executes the algorithm.
std::unique_ptr< FindSXPeaksHelper::BackgroundStrategy > getBackgroundStrategy() const
Selects a background strategy.
FindSXPeaks()
Default constructor.
std::unique_ptr< FindSXPeaksHelper::CompareStrategy > getCompareStrategy() const
Selects a comparison strategy.
std::map< std::string, std::string > validateInputs() override
Perform validation of ALL the input properties of the algorithm.
double m_MinRange
The value in X to start the search from.
Definition FindSXPeaks.h:92
double m_MaxRange
The value in X to finish the search at.
Definition FindSXPeaks.h:94
static const std::string strongestPeakStrategy
Definition FindSXPeaks.h:57
static const std::string relativeResolutionStrategy
Definition FindSXPeaks.h:60
static const std::string allPeaksStrategy
Definition FindSXPeaks.h:58
void init() override
Initialisation method.
void reducePeakList(const peakvector &, Mantid::API::Progress &progress)
Reduce the peak list by removing duplicates then convert SXPeaks objects to PeakObjects and add them ...
size_t m_MinWsIndex
The spectrum to start the integration from.
Definition FindSXPeaks.h:96
std::unique_ptr< FindSXPeaksHelper::PeakFindingStrategy > getPeakFindingStrategy(const FindSXPeaksHelper::BackgroundStrategy *backgroundStrategy, const API::SpectrumInfo &spectrumInfo, const double minValue, const double maxValue, const FindSXPeaksHelper::XAxisUnit tofUnits=FindSXPeaksHelper::XAxisUnit::TOF) const
Selects a peak finding strategy.
std::unique_ptr< FindSXPeaksHelper::ReducePeakListStrategy > getReducePeakListStrategy(const FindSXPeaksHelper::CompareStrategy *compareStrategy) const
Selects a peak finding strategy.
Structure describing a single-crystal peak.
Definition Peak.h:34
The class PeaksWorkspace stores information about a set of SCD peaks.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
void setPropertySettings(const std::string &name, std::unique_ptr< IPropertySettings > settings)
void setPropertyGroup(const std::string &name, const std::string &group)
Set the group for a given property.
void error(const std::string &msg)
Logs at error level.
Definition Logger.cpp:108
void warning(const std::string &msg)
Logs at warning level.
Definition Logger.cpp:117
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
XAxisUnit
enum to determine the units of the workspaces X axis we are searching in
std::vector< FindSXPeaksHelper::SXPeak > peakvector
Definition FindSXPeaks.h:23
std::unique_ptr< Peak > Peak_uptr
Definition Peak.h:174
std::unique_ptr< IPeak > IPeak_uptr
Definition IPeak.h:108
std::enable_if< std::is_pointer< Arg >::value, bool >::type threadSafe(Arg workspace)
Thread-safety check Checks the workspace to ensure it is suitable for multithreaded access.
constexpr int EMPTY_INT() noexcept
Returns what we consider an "empty" integer within a property.
Definition EmptyValues.h:24
constexpr double EMPTY_DBL() noexcept
Returns what we consider an "empty" double within a property.
Definition EmptyValues.h:42
@ Input
An input workspace.
Definition Property.h:53
@ Output
An output workspace.
Definition Property.h:54