20#include "MantidCrystal/DllConfig.h"
32namespace HistogramData {
73 bool isEdgePeak(
const double *params,
int nparams);
90 else if (newsize <
EdgeX)
100 else if (newsize <
EdgeY)
105 void CalcVariancesFromData(
double background,
double meanx,
double meany,
double &Varxx,
double &Varxy,
double &Varyy,
106 const std::vector<double> &
StatBase);
134 if (index < 0 || index >= (
int)
StatBase.size())
153 std::vector<double>
InitValues(
double Varx,
double Vary,
double b);
215 const std::string
name()
const override {
return "IntegratePeakTimeSlices"; }
219 return "The algorithm uses CurveFitting::BivariateNormal for fitting a "
225 const std::vector<std::string>
seeAlso()
const override {
return {
"PeakIntegration"}; }
228 const std::string
category()
const override {
return "Crystal\\Integration"; }
231 void init()
override;
232 void exec()
override;
236 std::string m_AttributeNames[20];
238 std::string m_ParameterNames[7];
260 const std::shared_ptr<Geometry::IComponent> &comp,
const int chanMin,
const int chanMax,
double CentX,
263 double &neighborRadius,
264 double Radius, std::string &spec_idList);
266 bool getNeighborPixIDs(
const std::shared_ptr<Geometry::IComponent> &comp,
const Kernel::V3D &Center,
double &Radius,
269 int CalculateTimeChannelSpan(
Geometry::IPeak const &peak,
const double dQ,
const Mantid::HistogramData::HistogramX &X,
270 const int specNum,
int &Centerchan);
279 const int chanMax,
double Radius,
const Kernel::V3D &CentPos, std::string &spec_idList
287 std::vector<double> ¶ms, std::vector<double> &errs,
double lastRow,
double lastCol,
288 double neighborRadius);
291 std::vector<double> ¶ms, std::vector<double> &errs,
double lastRow,
double lastCol,
292 double neighborRadius);
294 std::string CalculateFunctionProperty_Fit();
296 bool isGoodFit(std::vector<double>
const ¶ms, std::vector<double>
const &errs,
297 std::vector<std::string>
const &names,
double chisqOverDOF);
300 std::vector<double>
const ¶ms, std::vector<double>
const &errs,
301 std::vector<std::string>
const &names,
const double Chisq,
const double time,
302 std::string spec_idList);
304 void updatePeakInformation(std::vector<double>
const ¶ms, std::vector<double>
const &errs,
305 std::vector<std::string>
const &names,
double &TotVariance,
double &TotIntensity,
306 double const TotSliceIntensity,
double const TotSliceVariance,
double const chisqdivDOF,
309 void updateStats(
const double intensity,
const double variance,
const double row,
const double col,
310 std::vector<double> &StatBase);
312 int findNameInVector(std::string
const &oneName, std::vector<std::string>
const &nameList);
314 double CalculateIsawIntegrateError(
const double background,
const double backError,
const double ChiSqOverDOF,
315 const double TotVariance,
const int ncells);
318 int &NCOLS,
double &pixWidthx,
double &pixHeighty,
DataObjects::Peak const &peak)
const;
320 int findTimeChannel(
const Mantid::HistogramData::HistogramX &X,
const double time);
323 bool updateNeighbors(
const std::shared_ptr<Geometry::IComponent> &comp,
const Kernel::V3D &CentPos,
324 const Kernel::V3D &oldCenter,
double NewRadius,
double &neighborRadius);
Base class from which all concrete algorithm classes should be derived.
Integrates each time slice using the BivariateNormal formula, adding the results to the peak object.
void setHeightHalfWidthInfo(const MantidVec &xvals, const MantidVec &yvals, const MantidVec &counts)
For edge peaks, the sample standard deviations do not work.
double CalcISAWIntensity(const double *params)
Calculates the Intensity designed for Edge Peaks.
double CalcISAWIntensityVariance(const double *params, const double *errs, double chiSqOvDOF)
Calculates the Error in the Intensity designed for Edge Peaks.
std::vector< double > InitValues(double Varx, double Vary, double b)
Returns init values with background and variances replaced by arguments.
bool isEdgePeak(const double *params, int nparams)
Determines if a Peak is an edge peak.
double getInitBackground()
Kernel::V3D currentPosition
bool CalcVariances()
Determines whether the Variances can be calculated.
double getNewRCRadius()
Calculates the new radius for neighborhoods so as to include almost all of a peak.
void updateEdgeXsize(double newsize)
void CalcVariancesFromData(double background, double meanx, double meany, double &Varxx, double &Varxy, double &Varyy, const std::vector< double > &StatBase)
Utility method to calculate variances from data given background and means.
double HalfWidthAtHalfHeightRadius
double getCurrentRadius()
double getInitIntensity()
void updateEdgeYsize(double newsize)
double CalcSampleIntensityMultiplier(const double *params) const
For Edge Peaks.
std::vector< double > GetParams(double b)
Calculates the initial values of the parameters given background b.
DataModeHandler(double baseRCRadius, double lastRCRadius, double lastRow, double lastCol, double CellWidth, double CellHeight, bool CalcVariance, int MinCol, int MaxCol, int MinRow, int MaxRow)
bool IsEnoughData(const double *ParameterValues, Kernel::Logger &)
Calculates if there is enough data to for there to be a peak.
std::string CalcConstraints(std::vector< std::pair< double, double > > &Bounds, bool CalcVariances)
Calculates the string form of the constraints to be sent to the Fit Algorithm and also saves it in a ...
void setCurrentRadius(double radius)
bool setStatBase(std::vector< double > const &StatBase)
Sets the Accumulated data values into this class, then updates other information like initial values.
std::vector< double > StatBase
void setTime(double time)
double StatBaseVals(int index)
Kernel::V3D getCurrentCenter()
void setCurrentCenter(const Kernel::V3D &newCenter)
double m_COL
for Describing the Column(or 0) describing the center of the
std::array< double, 7 > m_ParameterValues
Mantid::detid2index_map m_wi_to_detid_map
Kernel::V3D m_center
for Describing the Plane at the Peak
Kernel::V3D m_yvec
for Describing the Plane at the Peak
Kernel::V3D m_xvec
for Describing the Plane at the Peak
std::shared_ptr< DataModeHandler > m_AttributeValues
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso (these are not validated) algorithms related to this algorithm....
const std::string category() const override
Algorithm's category for identification overriding a virtual method.
double m_ROW
for Describing the Row(or 0) describing the center of the Peak
double m_cellHeight
for Describing the Plane at the Peak
int version() const override
Algorithm's version for identification overriding a virtual method.
double m_R0
for Weak Peaks, these can be set using info from close
const std::string summary() const override
Summary of algorithms purpose.
const std::string name() const override
Algorithm's name for identification overriding a virtual method.
A generic fitting algorithm.
Structure describing a single-crystal peak.
Structure describing a single-crystal peak.
The Logger class is in charge of the publishing messages from the framework through various channels.
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
std::shared_ptr< TableWorkspace > TableWorkspace_sptr
shared pointer to Mantid::DataObjects::TableWorkspace
Helper class which provides the Collimation Length for SANS instruments.
std::unordered_map< detid_t, size_t > detid2index_map
Map with key = detector ID, value = workspace index.
std::vector< double > MantidVec
typedef for the data storage used in Mantid matrix workspaces
Peak indexing algorithm, which works by assigning multiple possible HKL values to each peak and then ...