Mantid
Loading...
Searching...
No Matches
Enumerations | Functions
Mantid::Algorithms::PeakParameterHelper Namespace Reference

Enumerations

enum  EstimatePeakWidth { NoEstimation , Observation , InstrumentResolution }
 
enum  PeakFitResult { NOSIGNAL , LOWPEAK , OUTOFBOUND , GOOD }
 

Functions

int estimatePeakParameters (const Histogram &histogram, const std::pair< size_t, size_t > &peak_window, const API::IPeakFunction_sptr &peakfunction, const API::IBackgroundFunction_sptr &bkgdfunction, bool observe_peak_width, const EstimatePeakWidth peakWidthEstimateApproach, const double peakWidthPercentage, const double minPeakHeight)
 Estimate peak profile's parameters values via observation including (1) peak center (2) peak intensity (3) peak width depending on peak type In order to make the estimation better, a pre-defined background function is used to remove the background from the obervation data. More...
 
MANTID_ALGORITHMS_DLL int estimatePeakParameters (const HistogramData::Histogram &histogram, const std::pair< size_t, size_t > &peak_window, const API::IPeakFunction_sptr &peakfunction, const API::IBackgroundFunction_sptr &bkgdfunction, bool observe_peak_width, const EstimatePeakWidth peakWidthEstimateApproach, const double peakWidthPercentage, const double minPeakHeight)
 Estimate peak parameters by 'observation'. More...
 
template MANTID_ALGORITHMS_DLL size_t findXIndex (const HistogramData::HistogramX &, const double, const size_t)
 
template MANTID_ALGORITHMS_DLL size_t findXIndex (const HistogramData::Points &, const double, const size_t)
 
template MANTID_ALGORITHMS_DLL size_t findXIndex (const std::vector< double > &, const double, const size_t)
 
template<typename vector_like >
size_t findXIndex (const vector_like &vecx, const double x, const size_t startindex)
 Get an index of a value in a sorted vector. More...
 
template<typename vector_like >
MANTID_ALGORITHMS_DLL size_t findXIndex (const vector_like &vecx, const double x, const size_t startindex=0)
 Get an index of a value in a sorted vector. More...
 
int observePeakCenter (const Histogram &histogram, const FunctionValues &bkgd_values, size_t start_index, size_t stop_index, double &peak_center, size_t &peak_center_index, double &peak_height)
 Guess/estimate peak center and thus height by observation. More...
 
MANTID_ALGORITHMS_DLL int observePeakCenter (const HistogramData::Histogram &histogram, const API::FunctionValues &bkgd_values, size_t start_index, size_t stop_index, double &peak_center, size_t &peak_center_index, double &peak_height)
 observe peak center More...
 
double observePeakFwhm (const Histogram &histogram, const FunctionValues &bkgd_values, size_t ipeak, size_t istart, size_t istop, const EstimatePeakWidth peakWidthEstimateApproach, const double peakWidthPercentage)
 estimate peak width from 'observation' More...
 
MANTID_ALGORITHMS_DLL double observePeakFwhm (const HistogramData::Histogram &histogram, const API::FunctionValues &bkgd_values, size_t ipeak, size_t istart, size_t istop, const EstimatePeakWidth peakWidthEstimateApproach, const double peakWidthPercentage)
 Observe peak width. More...
 

Enumeration Type Documentation

◆ EstimatePeakWidth

Enumerator
NoEstimation 
Observation 
InstrumentResolution 

Definition at line 22 of file PeakParameterHelper.h.

◆ PeakFitResult

Enumerator
NOSIGNAL 
LOWPEAK 
OUTOFBOUND 
GOOD 

Definition at line 23 of file PeakParameterHelper.h.

Function Documentation

◆ estimatePeakParameters() [1/2]

int Mantid::Algorithms::PeakParameterHelper::estimatePeakParameters ( const Histogram &  histogram,
const std::pair< size_t, size_t > &  peak_window,
const API::IPeakFunction_sptr peakfunction,
const API::IBackgroundFunction_sptr bkgdfunction,
bool  observe_peak_width,
const EstimatePeakWidth  peakWidthEstimateApproach,
const double  peakWidthPercentage,
const double  minPeakHeight 
)

Estimate peak profile's parameters values via observation including (1) peak center (2) peak intensity (3) peak width depending on peak type In order to make the estimation better, a pre-defined background function is used to remove the background from the obervation data.

Parameters
histogram:: Histogram instance containing experimental data
peak_window:: pair of X-value to specify the peak range
peakfunction:: (in/out) peak function to set observed value to
bkgdfunction:: background function previously defined
observe_peak_width:: flag to estimate peak width from input data
peakWidthEstimateApproach:: whether to guess fwhm from instrument or observation
peakWidthPercentage:: fwhm scaling factor when guessing from instrument
minPeakHeight:: function parameters will only be set if estimated peak height is larger
Returns
:: obervation success or not

Definition at line 156 of file PeakParameterHelper.cpp.

References GOOD, LOWPEAK, NoEstimation, observePeakCenter(), and observePeakFwhm().

◆ estimatePeakParameters() [2/2]

MANTID_ALGORITHMS_DLL int Mantid::Algorithms::PeakParameterHelper::estimatePeakParameters ( const HistogramData::Histogram &  histogram,
const std::pair< size_t, size_t > &  peak_window,
const API::IPeakFunction_sptr peakfunction,
const API::IBackgroundFunction_sptr bkgdfunction,
bool  observe_peak_width,
const EstimatePeakWidth  peakWidthEstimateApproach,
const double  peakWidthPercentage,
const double  minPeakHeight 
)

◆ findXIndex() [1/5]

template MANTID_ALGORITHMS_DLL size_t Mantid::Algorithms::PeakParameterHelper::findXIndex ( const HistogramData::HistogramX &  ,
const double  ,
const  size_t 
)

◆ findXIndex() [2/5]

template MANTID_ALGORITHMS_DLL size_t Mantid::Algorithms::PeakParameterHelper::findXIndex ( const HistogramData::Points &  ,
const double  ,
const  size_t 
)

◆ findXIndex() [3/5]

template MANTID_ALGORITHMS_DLL size_t Mantid::Algorithms::PeakParameterHelper::findXIndex ( const std::vector< double > &  ,
const double  ,
const  size_t 
)

◆ findXIndex() [4/5]

template<typename vector_like >
size_t Mantid::Algorithms::PeakParameterHelper::findXIndex ( const vector_like &  vecx,
const double  x,
const size_t  startindex 
)

Get an index of a value in a sorted vector.

The index should be the item with value nearest to X

Definition at line 19 of file PeakParameterHelper.cpp.

References index, and Mantid::Geometry::x.

Referenced by Mantid::Algorithms::FitPeaks::fitBackground(), Mantid::Algorithms::FitPeaks::fitFunctionSD(), Mantid::Algorithms::GetDetectorOffsets::fitSpectra(), and Mantid::Algorithms::FitPeaks::getRangeData().

◆ findXIndex() [5/5]

template<typename vector_like >
MANTID_ALGORITHMS_DLL size_t Mantid::Algorithms::PeakParameterHelper::findXIndex ( const vector_like &  vecx,
const double  x,
const size_t  startindex 
)

Get an index of a value in a sorted vector.

The index should be the item with value nearest to X

Definition at line 19 of file PeakParameterHelper.cpp.

References index, and Mantid::Geometry::x.

Referenced by Mantid::Algorithms::FitPeaks::fitBackground(), Mantid::Algorithms::FitPeaks::fitFunctionSD(), Mantid::Algorithms::GetDetectorOffsets::fitSpectra(), and Mantid::Algorithms::FitPeaks::getRangeData().

◆ observePeakCenter() [1/2]

int Mantid::Algorithms::PeakParameterHelper::observePeakCenter ( const Histogram &  histogram,
const FunctionValues bkgd_values,
size_t  start_index,
size_t  stop_index,
double &  peak_center,
size_t &  peak_center_index,
double &  peak_height 
)

Guess/estimate peak center and thus height by observation.

Parameters
histogram:: Histogram instance
bkgd_values:: calculated background value to removed from observed data
start_index:: X index of the left boundary of observation widow
stop_index:: X index of the right boundary of the observation window
peak_center:: estiamted peak center (output)
peak_center_index:: estimated peak center's index in histogram (output)
peak_height:: estimated peak height (output)
Returns
:: state whether peak center can be found by obervation

Definition at line 51 of file PeakParameterHelper.cpp.

References Mantid::API::FunctionValues::getCalculated(), GOOD, left, OUTOFBOUND, and Mantid::Geometry::y.

◆ observePeakCenter() [2/2]

MANTID_ALGORITHMS_DLL int Mantid::Algorithms::PeakParameterHelper::observePeakCenter ( const HistogramData::Histogram &  histogram,
const API::FunctionValues bkgd_values,
size_t  start_index,
size_t  stop_index,
double &  peak_center,
size_t &  peak_center_index,
double &  peak_height 
)

observe peak center

Referenced by estimatePeakParameters().

◆ observePeakFwhm() [1/2]

double Mantid::Algorithms::PeakParameterHelper::observePeakFwhm ( const Histogram &  histogram,
const FunctionValues bkgd_values,
size_t  ipeak,
size_t  istart,
size_t  istop,
const EstimatePeakWidth  peakWidthEstimateApproach,
const double  peakWidthPercentage 
)

estimate peak width from 'observation'

Parameters
histogram:: Histogram instance
bkgd_values:: background values calculated from X in given histogram
ipeak:: array index for the peak center in histogram
istart:: array index for the left boundary of the peak
istop:: array index for the right boundary of the peak
peakWidthEstimateApproach:: whether to guess fwhm from instrument or observation
peakWidthPercentage:: fwhm scaling factor when guessing from instrument
Returns
peak width as double

Definition at line 101 of file PeakParameterHelper.cpp.

References Mantid::API::FunctionValues::getCalculated(), InstrumentResolution, Observation, and Mantid::API::FunctionValues::size().

◆ observePeakFwhm() [2/2]

MANTID_ALGORITHMS_DLL double Mantid::Algorithms::PeakParameterHelper::observePeakFwhm ( const HistogramData::Histogram &  histogram,
const API::FunctionValues bkgd_values,
size_t  ipeak,
size_t  istart,
size_t  istop,
const EstimatePeakWidth  peakWidthEstimateApproach,
const double  peakWidthPercentage 
)

Observe peak width.

Referenced by estimatePeakParameters().