46 return "Calculates statistics for a PeaksWorkspace based on symmetry and "
47 "counting reflections.";
55 "A workspace with peaks to calculate statistics for. Sample "
56 "with valid UB-matrix is required.");
59 declareProperty(
"LatticeCentering", centeringSymbols[0], std::make_shared<StringListValidator>(centeringSymbols),
60 "Lattice centering of the cell.");
63 declareProperty(
"PointGroup",
"1", std::make_shared<StringListValidator>(pointGroups),
64 "Point group symmetry for completeness and redundancy calculations.");
67 "Minimum d-spacing for completeness calculation.");
70 "Maximum d-spacing for completeness calculation.");
73 "Number of unique reflections in data set.");
76 "Completeness of the data set as a fraction between 0 and 1.");
79 "Average redundancy in data set, depending on point group.");
82 "Fraction of reflections with more than one observation.");
86 "Reflections in specified d-range that are missing in input workspace.");
102 UnitCell cell = inputPeaksWorkspace->sample().getOrientedLattice();
106 auto peaks = inputPeaksWorkspace->getPeaks();
113 auto observedUniqueReflectionsD =
static_cast<double>(observedUniqueReflections);
117 if (peaks.size() > totalReflections) {
119 <<
" peaks in the input workspace that fall outside "
120 "the resolution limit and are not considered for "
127 setProperty(
"UniqueReflections",
static_cast<int>(observedUniqueReflections));
128 setProperty(
"Completeness", observedUniqueReflectionsD / possibleUniqueReflections);
129 setProperty(
"Redundancy",
static_cast<double>(totalReflections) / observedUniqueReflectionsD);
130 setProperty(
"MultiplyObserved", multiplyObservedReflections / observedUniqueReflectionsD);
134 if (outputWorkspace) {
135 setProperty(
"MissingReflectionsWorkspace", outputWorkspace);
158 std::string outputWorkspaceName =
getPropertyValue(
"MissingReflectionsWorkspace");
160 if (outputWorkspaceName.empty()) {
166 PeaksWorkspace_sptr outputPeaksWorkspace = std::dynamic_pointer_cast<PeaksWorkspace>(rawOutputPeaksWorkspace);
168 if (outputPeaksWorkspace != templateWorkspace) {
169 outputPeaksWorkspace = templateWorkspace->clone();
174 std::vector<Peak> peaks;
175 peaks.reserve(missingPeaks.size() * pointGroup->order());
177 for (
const auto &reflection : missingPeaks) {
178 auto hkls = pointGroup->getEquivalents(reflection);
180 for (
const auto &hkl : hkls) {
184 peaks.emplace_back(peak);
188 outputPeaksWorkspace->getPeaks().swap(peaks);
190 return outputPeaksWorkspace;
#define DECLARE_ALGORITHM(classname)
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
std::string getPropertyValue(const std::string &name) const override
Get the value of a property as a string.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
A property class for workspaces.
int version() const override
Algorithm's version for identification.
DataObjects::PeaksWorkspace_sptr getPeaksWorkspace(const DataObjects::PeaksWorkspace_sptr &templateWorkspace, const PeakStatisticsTools::UniqueReflectionCollection &reflections, const Geometry::PointGroup_sptr &pointGroup) const
CountReflections::getPeaksWorkspace.
const std::string summary() const override
Algorithm's summary for use in the GUI and help.
const std::string category() const override
Algorithm's category for identification.
void init() override
Initialize the algorithm's properties.
void exec() override
Execute the algorithm.
void setHKL(double H, double K, double L) override
Set all three H,K,L indices of the peak.
Structure describing a single-crystal peak.
Class to implement unit cell of crystals.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
void information(const std::string &msg)
Logs at information level.
The concrete, templated class for properties.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
std::shared_ptr< PeaksWorkspace > PeaksWorkspace_sptr
Typedef for a shared pointer to a peaks workspace.
std::shared_ptr< ReflectionCondition > ReflectionCondition_sptr
Shared pointer to a ReflectionCondition.
MANTID_GEOMETRY_DLL ReflectionCondition_sptr getReflectionConditionBySymbol(const std::string &symbol)
Returns the ReflectionCondition for the specified centering symbol, see getAllReflectionConditionSymb...
std::shared_ptr< PointGroup > PointGroup_sptr
Shared pointer to a PointGroup.
MANTID_GEOMETRY_DLL std::vector< std::string > getAllReflectionConditionSymbols()
Returns all centering symbols.
Describes the direction (within an algorithm) of a Property.
@ Input
An input workspace.
@ Output
An output workspace.