Mantid
Loading...
Searching...
No Matches
LeanElasticPeaksWorkspace.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/Run.h"
9#include "MantidAPI/Sample.h"
14#include "MantidKernel/Logger.h"
16
17// clang-format off
18#include <nexus/NeXusFile.hpp>
19#include <nexus/NeXusException.hpp>
20// clang-format on
21
22#include <cmath>
23
24using namespace Mantid::API;
25using namespace Mantid::Kernel;
26using namespace Mantid::Geometry;
27
28namespace Mantid::DataObjects {
31
32//---------------------------------------------------------------------------------------------
38 : IPeaksWorkspace(), m_peaks(), m_columns(), m_columnNames(), m_coordSystem(None) {
39 initColumns();
40 // LeanElasticPeaksWorkspace does not use the grouping mechanism of
41 // ExperimentInfo.
42 setNumberOfDetectorGroups(0);
43}
44
45//---------------------------------------------------------------------------------------------
51 : IPeaksWorkspace(other), m_peaks(other.m_peaks), m_columns(), m_columnNames(), m_coordSystem(other.m_coordSystem) {
53 // LeanElasticPeaksWorkspace does not use the grouping mechanism of
54 // ExperimentInfo.
56}
57
61public:
63 std::vector<ColumnAndDirection> &criteria;
64
69 explicit PeakComparator(std::vector<ColumnAndDirection> &criteria) : criteria(criteria) {}
70
72 inline bool operator()(const LeanElasticPeak &a, const LeanElasticPeak &b) {
73 for (const auto &name : criteria) {
74 const auto &col = name.first;
75 const bool ascending = name.second;
76 bool lessThan = false;
77 // General double comparison
78 const double valA = a.getValueByColName(col);
79 const double valB = b.getValueByColName(col);
80 // Move on to lesser criterion if equal
81 if (valA == valB)
82 continue;
83 lessThan = (valA < valB);
84 // Flip the sign of comparison if descending.
85 if (ascending)
86 return lessThan;
87 else
88 return !lessThan;
89 }
90 // If you reach here, all criteria were ==; so not <, so return false
91 return false;
92 }
93};
94
95//---------------------------------------------------------------------------------------------
103void LeanElasticPeaksWorkspace::sort(std::vector<ColumnAndDirection> &criteria) {
104 PeakComparator comparator(criteria);
105 std::stable_sort(m_peaks.begin(), m_peaks.end(), comparator);
106}
107
108//---------------------------------------------------------------------------------------------
111int LeanElasticPeaksWorkspace::getNumberPeaks() const { return int(m_peaks.size()); }
112
113//---------------------------------------------------------------------------------------------
117
118//---------------------------------------------------------------------------------------------
123 if (peakNum >= static_cast<int>(m_peaks.size()) || peakNum < 0) {
124 throw std::invalid_argument("LeanElasticPeaksWorkspace::removePeak(): peakNum is out of range.");
125 }
126 m_peaks.erase(m_peaks.begin() + peakNum);
127}
128
132void LeanElasticPeaksWorkspace::removePeaks(std::vector<int> badPeaks) {
133 if (badPeaks.empty())
134 return;
135 // if index of peak is in badPeaks remove
136 int ip = -1;
137 auto it = std::remove_if(m_peaks.begin(), m_peaks.end(), [&ip, badPeaks](LeanElasticPeak &pk) {
138 (void)pk;
139 ip++;
140 return std::any_of(badPeaks.cbegin(), badPeaks.cend(), [ip](int badPeak) { return badPeak == ip; });
141 });
142 m_peaks.erase(it, m_peaks.end());
143}
144
145//---------------------------------------------------------------------------------------------
150 if (dynamic_cast<const LeanElasticPeak *>(&ipeak)) {
151 m_peaks.emplace_back((const LeanElasticPeak &)ipeak);
152 } else {
153 m_peaks.emplace_back(LeanElasticPeak(ipeak));
154 }
155}
156
157//---------------------------------------------------------------------------------------------
163 auto peak = createPeak(position, frame);
164 addPeak(*peak);
165}
166
167//---------------------------------------------------------------------------------------------
172
173//---------------------------------------------------------------------------------------------
179 if (peakNum >= static_cast<int>(m_peaks.size()) || peakNum < 0) {
180 throw std::invalid_argument("LeanElasticPeaksWorkspace::getPeak(): peakNum is out of range.");
181 }
182 return m_peaks[peakNum];
183}
184
185//---------------------------------------------------------------------------------------------
191 if (peakNum >= static_cast<int>(m_peaks.size()) || peakNum < 0) {
192 throw std::invalid_argument("LeanElasticPeaksWorkspace::getPeak(): peakNum is out of range.");
193 }
194 return m_peaks[peakNum];
195}
196
197//---------------------------------------------------------------------------------------------
204std::unique_ptr<Geometry::IPeak> LeanElasticPeaksWorkspace::createPeak(const Kernel::V3D &,
205 boost::optional<double>) const {
206 throw Exception::NotImplementedError("LeanElasticPeak should be create in q sample frame");
207}
208
209//---------------------------------------------------------------------------------------------
216std::unique_ptr<Geometry::IPeak>
218 if (frame == Mantid::Kernel::HKL) {
219 return createPeakHKL(position);
220 } else if (frame == Mantid::Kernel::QLab) {
221 return createPeak(position);
222 } else {
224 }
225}
226
227//---------------------------------------------------------------------------------------------
234std::unique_ptr<IPeak> LeanElasticPeaksWorkspace::createPeakQSample(const V3D &position) const {
235 // Create a peak from QSampleFrame
236 std::unique_ptr<IPeak> peak = std::make_unique<LeanElasticPeak>(position, run().getGoniometer().getR());
237 // Take the run number from this
238 peak->setRunNumber(getRunNumber());
239 return peak;
240}
241
257std::vector<std::pair<std::string, std::string>> LeanElasticPeaksWorkspace::peakInfo(const Kernel::V3D &, bool) const {
259}
260
268std::unique_ptr<IPeak> LeanElasticPeaksWorkspace::createPeakHKL(const V3D &HKL) const {
269 /*
270 The following allows us to add peaks where we have a single UB to work from.
271 */
272 const auto &lattice = this->sample().getOrientedLattice();
273 const auto &goniometer = this->run().getGoniometer();
274
275 // Calculate qSample from q HKL. As per Busing and Levy 1967, q_sample_frame =
276 // 2pi * UB * HKL
277 const V3D qSampleFrame = lattice.getUB() * HKL * 2 * M_PI;
278
279 // create a peak using the qSample frame
280 std::unique_ptr<IPeak> peak = std::make_unique<LeanElasticPeak>(qSampleFrame, goniometer.getR());
281 // We need to set HKL separately to keep things consistent.
282 peak->setHKL(HKL[0], HKL[1], HKL[2]);
283 peak->setIntHKL(peak->getHKL());
284 // Take the run number from this
285 peak->setRunNumber(this->getRunNumber());
286
287 return peak;
288}
289
295std::unique_ptr<IPeak> LeanElasticPeaksWorkspace::createPeak() const { return std::make_unique<LeanElasticPeak>(); }
296
314}
315
316//---------------------------------------------------------------------------------------------
318std::vector<LeanElasticPeak> &LeanElasticPeaksWorkspace::getPeaks() { return m_peaks; }
319
321const std::vector<LeanElasticPeak> &LeanElasticPeaksWorkspace::getPeaks() const { return m_peaks; }
322
327 bool ret = false;
328 const std::string peaksIntegrated = "PeaksIntegrated";
329 if (this->run().hasProperty(peaksIntegrated)) {
330 const auto value = boost::lexical_cast<int>(this->run().getProperty(peaksIntegrated)->value());
331 ret = (value != 0);
332 }
333 return ret;
334}
335
336//---------------------------------------------------------------------------------------------
339
340//---------------------------------------------------------------------------------------------
350}
351
352//---------------------------------------------------------------------------------------------
355 // Note: The column types are controlled in PeakColumn.cpp
356 addPeakColumn("RunNumber");
357 addPeakColumn("h");
358 addPeakColumn("k");
359 addPeakColumn("l");
360 addPeakColumn("Wavelength");
361 addPeakColumn("Energy");
362 addPeakColumn("DSpacing");
363 addPeakColumn("Intens");
364 addPeakColumn("SigInt");
365 addPeakColumn("Intens/SigInt");
366 addPeakColumn("BinCount");
367 addPeakColumn("QLab");
368 addPeakColumn("QSample");
369 addPeakColumn("PeakNumber");
370}
371
372//---------------------------------------------------------------------------------------------
377void LeanElasticPeaksWorkspace::addPeakColumn(const std::string &name) {
378 // Create the PeakColumn.
379 m_columns.emplace_back(std::make_shared<DataObjects::PeakColumn<LeanElasticPeak>>(this->m_peaks, name));
380 // Cache the names
381 m_columnNames.emplace_back(name);
382}
383
384//---------------------------------------------------------------------------------------------
386size_t LeanElasticPeaksWorkspace::getColumnIndex(const std::string &name) const {
387 for (size_t i = 0; i < m_columns.size(); i++)
388 if (m_columns[i]->name() == name)
389 return i;
390 throw std::invalid_argument("Column named " + name + " was not found in the LeanElasticPeaksWorkspace.");
391}
392
393//---------------------------------------------------------------------------------------------
395std::shared_ptr<Mantid::API::Column> LeanElasticPeaksWorkspace::getColumn(size_t index) {
396 if (index >= m_columns.size())
397 throw std::invalid_argument("LeanElasticPeaksWorkspace::getColumn() called with invalid index.");
398 return m_columns[index];
399}
400
401//---------------------------------------------------------------------------------------------
403std::shared_ptr<const Mantid::API::Column> LeanElasticPeaksWorkspace::getColumn(size_t index) const {
404 if (index >= m_columns.size())
405 throw std::invalid_argument("LeanElasticPeaksWorkspace::getColumn() called with invalid index.");
406 return m_columns[index];
407}
408
409void LeanElasticPeaksWorkspace::saveNexus(::NeXus::File *file) const {
410
411 // Number of Peaks
412 const size_t np(m_peaks.size());
413
414 // Column vectors for peaks table
415 std::vector<double> H(np);
416 std::vector<double> K(np);
417 std::vector<double> L(np);
418 std::vector<double> intensity(np);
419 std::vector<double> sigmaIntensity(np);
420 std::vector<double> binCount(np);
421 std::vector<double> waveLength(np);
422 std::vector<double> scattering(np);
423 std::vector<double> dSpacing(np);
424 std::vector<int> runNumber(np);
425 std::vector<int> peakNumber(np);
426 std::vector<double> tbar(np);
427 std::vector<double> goniometerMatrix(9 * np);
428 std::vector<std::string> shapes(np);
429 std::vector<double> qlabs(3 * np);
430
431 // Populate column vectors
432 size_t maxShapeJSONLength = 0;
433 for (size_t i = 0; i < np; i++) {
435 H[i] = p.getH();
436 K[i] = p.getK();
437 L[i] = p.getL();
438 intensity[i] = p.getIntensity();
439 sigmaIntensity[i] = p.getSigmaIntensity();
440 binCount[i] = p.getBinCount();
441 waveLength[i] = p.getWavelength();
442 scattering[i] = p.getScattering();
443 dSpacing[i] = p.getDSpacing();
444 runNumber[i] = p.getRunNumber();
445 peakNumber[i] = p.getPeakNumber();
447 {
449 goniometerMatrix[9 * i] = gm[0][0];
450 goniometerMatrix[9 * i + 1] = gm[1][0];
451 goniometerMatrix[9 * i + 2] = gm[2][0];
452 goniometerMatrix[9 * i + 3] = gm[0][1];
453 goniometerMatrix[9 * i + 4] = gm[1][1];
454 goniometerMatrix[9 * i + 5] = gm[2][1];
455 goniometerMatrix[9 * i + 6] = gm[0][2];
456 goniometerMatrix[9 * i + 7] = gm[1][2];
457 goniometerMatrix[9 * i + 8] = gm[2][2];
458 }
459 const std::string shapeJSON = p.getPeakShape().toJSON();
460 shapes[i] = shapeJSON;
461 if (shapeJSON.size() > maxShapeJSONLength) {
462 maxShapeJSONLength = shapeJSON.size();
463 }
464 {
465 qlabs[3 * i + 0] = p.getQLabFrame().X();
466 qlabs[3 * i + 1] = p.getQLabFrame().Y();
467 qlabs[3 * i + 2] = p.getQLabFrame().Z();
468 }
469 }
470
471 // Start Peaks Workspace in Nexus File
472 const std::string specifyInteger = "An integer";
473 const std::string specifyDouble = "A double";
474 const std::string specifyString = "A string";
475 file->makeGroup("peaks_workspace", "NXentry",
476 true); // For when peaksWorkspace can be loaded
477
478 // Coordinate system
479 file->writeData("coordinate_system", static_cast<uint32_t>(m_coordSystem));
480
481 // Write out the Qconvention
482 // ki-kf for Inelastic convention; kf-ki for Crystallography convention
483 std::string m_QConvention = this->getConvention();
484 file->putAttr("QConvention", m_QConvention);
485
486 // H column
487 file->writeData("column_1", H);
488 file->openData("column_1");
489 file->putAttr("name", "H");
490 file->putAttr("interpret_as", specifyDouble);
491 file->putAttr("units", "Not known"); // Units may need changing when known
492 file->closeData();
493
494 // K column
495 file->writeData("column_2", K);
496 file->openData("column_2");
497 file->putAttr("name", "K");
498 file->putAttr("interpret_as", specifyDouble);
499 file->putAttr("units", "Not known"); // Units may need changing when known
500 file->closeData();
501
502 // L column
503 file->writeData("column_3", L);
504 file->openData("column_3");
505 file->putAttr("name", "L");
506 file->putAttr("interpret_as", specifyDouble);
507 file->putAttr("units", "Not known"); // Units may need changing when known
508 file->closeData();
509
510 // Intensity column
511 file->writeData("column_4", intensity);
512 file->openData("column_4");
513 file->putAttr("name", "Intensity");
514 file->putAttr("interpret_as", specifyDouble);
515 file->putAttr("units", "Not known"); // Units may need changing when known
516 file->closeData();
517
518 // Sigma Intensity column
519 file->writeData("column_5", sigmaIntensity);
520 file->openData("column_5");
521 file->putAttr("name", "Sigma Intensity");
522 file->putAttr("interpret_as", specifyDouble);
523 file->putAttr("units", "Not known"); // Units may need changing when known
524 file->closeData();
525
526 // Bin Count column
527 file->writeData("column_6", binCount);
528 file->openData("column_6");
529 file->putAttr("name", "Bin Count");
530 file->putAttr("interpret_as", specifyDouble);
531 file->putAttr("units", "Not known"); // Units may need changing when known
532 file->closeData();
533
534 // Wave Length Column
535 file->writeData("column_7", waveLength);
536 file->openData("column_7");
537 file->putAttr("name", "Wave Length");
538 file->putAttr("interpret_as", specifyDouble);
539 file->putAttr("units", "Not known"); // Units may need changing when known
540 file->closeData();
541
542 // Scattering Column
543 file->writeData("column_8", scattering);
544 file->openData("column_8");
545 file->putAttr("name", "Scattering");
546 file->putAttr("interpret_as", specifyDouble);
547 file->putAttr("units", "Not known"); // Units may need changing when known
548 file->closeData();
549
550 // D Spacing Column
551 file->writeData("column_9", dSpacing);
552 file->openData("column_9");
553 file->putAttr("name", "D Spacing");
554 file->putAttr("interpret_as", specifyDouble);
555 file->putAttr("units", "Not known"); // Units may need changing when known
556 file->closeData();
557
558 // Run Number column
559 file->writeData("column_10", runNumber);
560 file->openData("column_10");
561 file->putAttr("name", "Run Number");
562 file->putAttr("interpret_as", specifyInteger);
563 file->putAttr("units", "Not known"); // Units may need changing when known
564 file->closeData();
565
566 // Peak Number column
567 file->writeData("column_11", peakNumber);
568 file->openData("column_11");
569 file->putAttr("name", "Peak Number");
570 file->putAttr("interpret_as", specifyInteger);
571 file->putAttr("units", "Not known"); // Units may need changing when known
572 file->closeData();
573
574 // TBar column
575 file->writeData("column_12", tbar);
576 file->openData("column_12");
577 file->putAttr("name", "TBar");
578 file->putAttr("interpret_as", specifyDouble);
579 file->putAttr("units", "Not known"); // Units may need changing when known
580 file->closeData();
581
582 // Goniometer Matrix Column
583 std::vector<int> array_dims;
584 array_dims.emplace_back(static_cast<int>(m_peaks.size()));
585 array_dims.emplace_back(9);
586 file->writeData("column_13", goniometerMatrix, array_dims);
587 file->openData("column_13");
588 file->putAttr("name", "Goniometer Matrix");
589 file->putAttr("interpret_as", "A matrix of 3x3 doubles");
590 file->putAttr("units", "Not known"); // Units may need changing when known
591 file->closeData();
592
593 // Shape
594 std::vector<int64_t> dims;
595 dims.emplace_back(np);
596 dims.emplace_back(static_cast<int>(maxShapeJSONLength));
597 const std::string name = "column_14";
598 file->makeData(name, NeXus::CHAR, dims, false);
599 file->openData(name);
600
601 auto toNexus = new char[maxShapeJSONLength * np];
602 for (size_t ii = 0; ii < np; ii++) {
603 std::string rowStr = shapes[ii];
604 for (size_t ic = 0; ic < rowStr.size(); ic++)
605 toNexus[ii * maxShapeJSONLength + ic] = rowStr[ic];
606 for (size_t ic = rowStr.size(); ic < static_cast<size_t>(maxShapeJSONLength); ic++)
607 toNexus[ii * maxShapeJSONLength + ic] = ' ';
608 }
609
610 file->putData((void *)(toNexus));
611
612 delete[] toNexus;
613 file->putAttr("units", "Not known"); // Units may need changing when known
614 file->putAttr("name", "Shape");
615 file->putAttr("interpret_as", specifyString);
616 file->closeData();
617
618 // Qlab
619 std::vector<int> qlab_dims;
620 qlab_dims.emplace_back(static_cast<int>(m_peaks.size()));
621 qlab_dims.emplace_back(9);
622 file->writeData("column_15", qlabs, qlab_dims);
623 file->openData("column_15");
624 file->putAttr("name", "Q LabFrame");
625 file->putAttr("interpret_as", "A vector of 3 doubles");
626 file->putAttr("units", "angstrom^-1");
627 file->closeData();
628
629 file->closeGroup(); // end of peaks workpace
630}
631
637 m_coordSystem = coordinateSystem;
638}
639
644
645// prevent shared pointer from deleting this
647 template <typename T> void operator()(T * /*unused*/) {}
648};
651 return API::LogManager_sptr(&(this->mutableRun()), NullDeleter());
652}
653
659}
660
661ITableWorkspace *LeanElasticPeaksWorkspace::doCloneColumns(const std::vector<std::string> & /*colNames*/) const {
662 throw Kernel::Exception::NotImplementedError("LeanElasticPeaksWorkspace cannot clone columns.");
663}
664} // namespace Mantid::DataObjects
665
667
668namespace Mantid::Kernel {
669
670template <>
672IPropertyManager::getValue<Mantid::DataObjects::LeanElasticPeaksWorkspace_sptr>(const std::string &name) const {
674 getPointerToProperty(name));
675 if (prop) {
676 return *prop;
677 } else {
678 std::string message =
679 "Attempt to assign property " + name + " to incorrect type. Expected shared_ptr<LeanElasticPeaksWorkspace>.";
680 throw std::runtime_error(message);
681 }
682}
683
684template <>
686IPropertyManager::getValue<Mantid::DataObjects::LeanElasticPeaksWorkspace_const_sptr>(const std::string &name) const {
688 getPointerToProperty(name));
689 if (prop) {
690 return prop->operator()();
691 } else {
692 std::string message = "Attempt to assign property " + name +
693 " to incorrect type. Expected const "
694 "shared_ptr<LeanElasticPeaksWorkspace>.";
695 throw std::runtime_error(message);
696 }
697}
698
699} // namespace Mantid::Kernel
700
double value
The value of the point.
Definition: FitMW.cpp:51
double position
Definition: GetAllEi.cpp:154
std::map< DeltaEMode::Type, std::string > index
Definition: DeltaEMode.cpp:19
#define DLLExport
Definitions of the DLLImport compiler directives for MSVC.
Definition: System.h:53
#define DECLARE_WORKSPACE(classname)
Run & mutableRun()
Writable version of the run object.
const Run & run() const
Run details object access.
const Sample & sample() const
Sample accessors.
int getRunNumber() const
Utility method to get the run number.
void setNumberOfDetectorGroups(const size_t count) const
Sets the number of detector groups.
Interface to the class Mantid::DataObjects::PeaksWorkspace.
ITableWorkspace is an implementation of Workspace in which the data are organised in columns of same ...
This class contains the information about the log entries.
Definition: LogManager.h:44
const Geometry::Goniometer & getGoniometer() const
Return reference to the first const Goniometer object for this run.
Definition: Run.cpp:324
const Geometry::OrientedLattice & getOrientedLattice() const
Get a reference to the sample's OrientedLattice.
Definition: Sample.cpp:154
double getL() const override
Get the L index of the peak.
Definition: BasePeak.cpp:100
double getIntensity() const override
Return the integrated peak intensity.
Definition: BasePeak.cpp:185
double getAbsorptionWeightedPathLength() const override
Gets the absorption weighted path length.
Definition: BasePeak.cpp:340
double getSigmaIntensity() const override
Return the error on the integrated peak intensity.
Definition: BasePeak.cpp:188
double getK() const override
Get the K index of the peak.
Definition: BasePeak.cpp:97
int getPeakNumber() const override
Returns the unique peak number Returns -1 if it could not find it.
Definition: BasePeak.cpp:234
int getRunNumber() const override
Return the run number this peak was measured at.
Definition: BasePeak.cpp:78
double getH() const override
Get the H index of the peak.
Definition: BasePeak.cpp:94
double getBinCount() const override
Return the # of counts in the bin at its peak.
Definition: BasePeak.cpp:182
Mantid::Kernel::Matrix< double > getGoniometerMatrix() const override
Get the goniometer rotation matrix at which this peak was measured.
Definition: BasePeak.cpp:210
const Mantid::Geometry::PeakShape & getPeakShape() const override
Get the peak shape.
Definition: BasePeak.cpp:290
virtual double getValueByColName(std::string colName) const
Helper function for displaying/sorting peaks.
Definition: BasePeak.cpp:250
Structure describing a single-crystal peak.
double getWavelength() const override
Return the neutron wavelength (in angstroms)
Mantid::Kernel::V3D getQLabFrame() const override
Return the Q change (of the lattice, k_i - k_f) for this peak.
double getScattering() const override
Calculate the scattering angle of the peak
double getDSpacing() const override
Calculate the d-spacing of the peak, in 1/Angstroms
The class LeanElasticPeaksWorkspace stores information about a set of SCD lean peaks.
int peakInfoNumber(const Kernel::V3D &qFrame, bool labCoords) const override
Returns selected information for a "peak" at QLabFrame.
std::unique_ptr< Geometry::IPeak > createPeakQSample(const Kernel::V3D &position) const override
Creates an instance of a Peak BUT DOES NOT ADD IT TO THE WORKSPACE.
bool hasIntegratedPeaks() const override
Getter for the integration status.
API::ITableWorkspace_sptr createDetectorTable() const override
Creates a new TableWorkspace giving the IDs of the detectors that contribute to the peaks within the ...
std::unique_ptr< Geometry::IPeak > createPeak() const override
Create a Peak using default values.
std::vector< std::pair< std::string, std::string > > peakInfo(const Kernel::V3D &qFrame, bool labCoords) const override
Returns selected information for a "peak" at QLabFrame.
std::shared_ptr< Mantid::API::Column > getColumn(const std::string &name) override
Gets the shared pointer to a column by name.
API::LogManager_sptr logs() override
Get access to shared pointer containing workspace porperties.
void setCoordinateSystem(const Kernel::SpecialCoordinateSystem coordinateSystem) override
Set the special coordinate system.
Kernel::SpecialCoordinateSystem m_coordSystem
Coordinates.
void sort(std::vector< ColumnAndDirection > &criteria) override
Sort the peaks by one or more criteria.
std::vector< std::string > m_columnNames
Column names.
void removePeak(int peakNum) override
Removes the indicated peak.
void removePeaks(std::vector< int > badPeaks) override
Removes multiple peaks.
void saveNexus(::NeXus::File *file) const override
LeanElasticPeak & getPeak(int peakNum) override
Return a reference to the Peak.
size_t getMemorySize() const override
Return the memory used in bytes.
std::vector< std::shared_ptr< Mantid::DataObjects::PeakColumn< LeanElasticPeak > > > m_columns
Column shared pointers.
void addPeak(const Geometry::IPeak &peak) override
Add a peak to the list.
std::vector< LeanElasticPeak > m_peaks
Vector of Peak contained within.
std::unique_ptr< Geometry::IPeak > createPeakHKL(const Kernel::V3D &HKL) const override
Create a Peak from a HKL value provided by the client.
LeanElasticPeaksWorkspace()
Register the workspace as a type.
API::LogManager_const_sptr getLogs() const override
Get constant access to shared pointer containing workspace porperties; Copies logs into new LogManage...
std::vector< LeanElasticPeak > & getPeaks()
Return a reference to the Peaks vector.
ITableWorkspace * doCloneColumns(const std::vector< std::string > &colNames) const override
Kernel::SpecialCoordinateSystem getSpecialCoordinateSystem() const override
Get the special coordinate system.
virtual size_t getColumnIndex(const std::string &name) const
void addPeakColumn(const std::string &name)
Adds a new PeakColumn of the given type.
PeakColumn : a Column sub-class used to display peak information as a TableWorkspace.
Definition: PeakColumn.h:28
Comparator class for sorting peaks by one or more criteria.
PeakComparator(std::vector< ColumnAndDirection > &criteria)
Constructor for the comparator for sorting peaks.
LeanElasticPeaksWorkspace::ColumnAndDirection ColumnAndDirection
bool operator()(const LeanElasticPeak &a, const LeanElasticPeak &b)
Compare two peaks using the stored criteria.
std::vector< ColumnAndDirection > & criteria
HKL : HKL MDFrame.
Definition: HKL.h:21
Structure describing a single-crystal peak.
Definition: IPeak.h:26
virtual std::string toJSON() const =0
Serialize.
Marks code as not implemented yet.
Definition: Exception.h:138
Numerical Matrix class.
Definition: Matrix.h:42
The concrete, templated class for properties.
Class for 3D vectors.
Definition: V3D.h:34
constexpr double X() const noexcept
Get x.
Definition: V3D.h:232
constexpr double Y() const noexcept
Get y.
Definition: V3D.h:233
constexpr double Z() const noexcept
Get z.
Definition: V3D.h:234
std::shared_ptr< const LogManager > LogManager_const_sptr
shared pointer to the logManager base class (const version)
Definition: LogManager.h:210
std::shared_ptr< LogManager > LogManager_sptr
shared pointer to the logManager base class
Definition: LogManager.h:208
std::shared_ptr< ITableWorkspace > ITableWorkspace_sptr
shared pointer to Mantid::API::ITableWorkspace
std::shared_ptr< LeanElasticPeaksWorkspace > LeanElasticPeaksWorkspace_sptr
Typedef for a shared pointer to a peaks workspace.
std::shared_ptr< const LeanElasticPeaksWorkspace > LeanElasticPeaksWorkspace_const_sptr
Typedef for a shared pointer to a const peaks workspace.
SpecialCoordinateSystem
Special coordinate systems for Q3D.