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"
11#include "MantidDataObjects/DllConfig.h"
15#include "MantidKernel/Logger.h"
17#include "MantidNexus/NexusFile.h"
18
19#include <cmath>
20
21using namespace Mantid::API;
22using namespace Mantid::Kernel;
23using namespace Mantid::Geometry;
24
25namespace Mantid::DataObjects {
28
29//---------------------------------------------------------------------------------------------
33 : IPeaksWorkspace(), m_peaks(), m_columns(), m_columnNames(), m_coordSystem(None) {
34 initColumns();
35 // LeanElasticPeaksWorkspace does not use the grouping mechanism of
36 // ExperimentInfo.
37 setNumberOfDetectorGroups(0);
38}
39
40//---------------------------------------------------------------------------------------------
46 : IPeaksWorkspace(other), m_peaks(other.m_peaks), m_columns(), m_columnNames(), m_coordSystem(other.m_coordSystem) {
48 // LeanElasticPeaksWorkspace does not use the grouping mechanism of
49 // ExperimentInfo.
51}
52
56public:
58 std::vector<ColumnAndDirection> &criteria;
59
64 explicit PeakComparator(std::vector<ColumnAndDirection> &criteria) : criteria(criteria) {}
65
67 inline bool operator()(const LeanElasticPeak &a, const LeanElasticPeak &b) {
68 for (const auto &name : criteria) {
69 const auto &col = name.first;
70 const bool ascending = name.second;
71 bool lessThan = false;
72 // General double comparison
73 const double valA = a.getValueByColName(col);
74 const double valB = b.getValueByColName(col);
75 // Move on to lesser criterion if equal
76 if (valA == valB)
77 continue;
78 lessThan = (valA < valB);
79 // Flip the sign of comparison if descending.
80 if (ascending)
81 return lessThan;
82 else
83 return !lessThan;
84 }
85 // If you reach here, all criteria were ==; so not <, so return false
86 return false;
87 }
88};
89
90//---------------------------------------------------------------------------------------------
98void LeanElasticPeaksWorkspace::sort(std::vector<ColumnAndDirection> &criteria) {
99 PeakComparator comparator(criteria);
100 std::stable_sort(m_peaks.begin(), m_peaks.end(), comparator);
101}
102
103//---------------------------------------------------------------------------------------------
106int LeanElasticPeaksWorkspace::getNumberPeaks() const { return int(m_peaks.size()); }
107
108//---------------------------------------------------------------------------------------------
112
113//---------------------------------------------------------------------------------------------
118 if (peakNum >= static_cast<int>(m_peaks.size()) || peakNum < 0) {
119 throw std::invalid_argument("LeanElasticPeaksWorkspace::removePeak(): peakNum is out of range.");
120 }
121 m_peaks.erase(m_peaks.begin() + peakNum);
122}
123
127void LeanElasticPeaksWorkspace::removePeaks(std::vector<int> badPeaks) {
128 if (badPeaks.empty())
129 return;
130 // if index of peak is in badPeaks remove
131 int ip = -1;
132 auto it = std::remove_if(m_peaks.begin(), m_peaks.end(), [&ip, badPeaks](const LeanElasticPeak &pk) {
133 (void)pk;
134 ip++;
135 return std::any_of(badPeaks.cbegin(), badPeaks.cend(), [ip](int badPeak) { return badPeak == ip; });
136 });
137 m_peaks.erase(it, m_peaks.end());
138}
139
140//---------------------------------------------------------------------------------------------
145 if (dynamic_cast<const LeanElasticPeak *>(&ipeak)) {
146 m_peaks.emplace_back(static_cast<const LeanElasticPeak &>(ipeak));
147 } else {
148 m_peaks.emplace_back(LeanElasticPeak(ipeak));
149 }
150}
151
152//---------------------------------------------------------------------------------------------
158 auto peak = createPeak(position, frame);
159 addPeak(*peak);
160}
161
162//---------------------------------------------------------------------------------------------
167
168//---------------------------------------------------------------------------------------------
174 if (peakNum >= m_peaks.size()) {
175 throw std::invalid_argument("LeanElasticPeaksWorkspace::getPeak(): peakNum is out of range.");
176 }
177 return m_peaks[peakNum];
178}
179
180//---------------------------------------------------------------------------------------------
185const LeanElasticPeak &LeanElasticPeaksWorkspace::getPeak(size_t const peakNum) const {
186 if (peakNum >= m_peaks.size()) {
187 throw std::invalid_argument("LeanElasticPeaksWorkspace::getPeak(): peakNum is out of range.");
188 }
189 return m_peaks[peakNum];
190}
191
192//---------------------------------------------------------------------------------------------
199std::unique_ptr<Geometry::IPeak> LeanElasticPeaksWorkspace::createPeak(const Kernel::V3D &,
200 std::optional<double>) const {
201 throw Exception::NotImplementedError("LeanElasticPeak should be create in q sample frame");
202}
203
204//---------------------------------------------------------------------------------------------
211std::unique_ptr<Geometry::IPeak>
213 if (frame == Mantid::Kernel::HKL) {
214 return createPeakHKL(position);
215 } else if (frame == Mantid::Kernel::QLab) {
216 return createPeak(position);
217 } else {
219 }
220}
221
222//---------------------------------------------------------------------------------------------
229std::unique_ptr<IPeak> LeanElasticPeaksWorkspace::createPeakQSample(const V3D &position) const {
230 // Create a peak from QSampleFrame
231 std::unique_ptr<IPeak> peak = std::make_unique<LeanElasticPeak>(position, run().getGoniometer().getR());
232 // Take the run number from this
233 peak->setRunNumber(getRunNumber());
234 return peak;
235}
236
252std::vector<std::pair<std::string, std::string>> LeanElasticPeaksWorkspace::peakInfo(const Kernel::V3D &, bool) const {
254}
255
263std::unique_ptr<IPeak> LeanElasticPeaksWorkspace::createPeakHKL(const V3D &HKL) const {
264 /*
265 The following allows us to add peaks where we have a single UB to work from.
266 */
267 const auto &lattice = this->sample().getOrientedLattice();
268 const auto &goniometer = this->run().getGoniometer();
269
270 // Calculate qSample from q HKL. As per Busing and Levy 1967, q_sample_frame =
271 // 2pi * UB * HKL
272 const V3D qSampleFrame = lattice.getUB() * HKL * 2 * M_PI;
273
274 // create a peak using the qSample frame
275 std::unique_ptr<IPeak> peak = std::make_unique<LeanElasticPeak>(qSampleFrame, goniometer.getR());
276 // We need to set HKL separately to keep things consistent.
277 peak->setHKL(HKL[0], HKL[1], HKL[2]);
278 peak->setIntHKL(peak->getHKL());
279 // Take the run number from this
280 peak->setRunNumber(this->getRunNumber());
281
282 return peak;
283}
284
290std::unique_ptr<IPeak> LeanElasticPeaksWorkspace::createPeak() const { return std::make_unique<LeanElasticPeak>(); }
291
310
311//---------------------------------------------------------------------------------------------
313std::vector<LeanElasticPeak> &LeanElasticPeaksWorkspace::getPeaks() { return m_peaks; }
314
316const std::vector<LeanElasticPeak> &LeanElasticPeaksWorkspace::getPeaks() const { return m_peaks; }
317
322 bool ret = false;
323 const std::string peaksIntegrated = "PeaksIntegrated";
324 if (this->run().hasProperty(peaksIntegrated)) {
325 const auto value = boost::lexical_cast<int>(this->run().getProperty(peaksIntegrated)->value());
326 ret = (value != 0);
327 }
328 return ret;
329}
330
331//---------------------------------------------------------------------------------------------
334
335//---------------------------------------------------------------------------------------------
346
347//---------------------------------------------------------------------------------------------
350 // Note: The column types are controlled in PeakColumn.cpp
351 addPeakColumn("RunNumber");
352 addPeakColumn("h");
353 addPeakColumn("k");
354 addPeakColumn("l");
355 addPeakColumn("Wavelength");
356 addPeakColumn("Energy");
357 addPeakColumn("DSpacing");
358 addPeakColumn("Intens");
359 addPeakColumn("SigInt");
360 addPeakColumn("Intens/SigInt");
361 addPeakColumn("BinCount");
362 addPeakColumn("QLab");
363 addPeakColumn("QSample");
364 addPeakColumn("PeakNumber");
365 addPeakColumn("IntHKL");
366 addPeakColumn("IntMNP");
367}
368
369//---------------------------------------------------------------------------------------------
375 // Create the PeakColumn.
376 m_columns.emplace_back(std::make_shared<DataObjects::PeakColumn<LeanElasticPeak>>(this->m_peaks, name));
377 // Cache the names
378 m_columnNames.emplace_back(name);
379}
380
381//---------------------------------------------------------------------------------------------
383size_t LeanElasticPeaksWorkspace::getColumnIndex(const std::string &name) const {
384 const auto it = std::find(m_columnNames.cbegin(), m_columnNames.cend(), name);
385 if (it != m_columnNames.cend()) {
386 return std::distance(m_columnNames.cbegin(), it);
387 }
388 throw std::invalid_argument("Column named " + name + " was not found in the LeanElasticPeaksWorkspace.");
389}
390
391//---------------------------------------------------------------------------------------------
393std::shared_ptr<Mantid::API::Column> LeanElasticPeaksWorkspace::getColumn(size_t index) {
394 if (index >= m_columns.size())
395 throw std::invalid_argument("LeanElasticPeaksWorkspace::getColumn() called with invalid index.");
396 return m_columns[index];
397}
398
399//---------------------------------------------------------------------------------------------
401std::shared_ptr<const Mantid::API::Column> LeanElasticPeaksWorkspace::getColumn(size_t index) const {
402 if (index >= m_columns.size())
403 throw std::invalid_argument("LeanElasticPeaksWorkspace::getColumn() called with invalid index.");
404 return m_columns[index];
405}
406
407void LeanElasticPeaksWorkspace::saveNexus(Nexus::File *file) const {
408
409 // Number of Peaks
410 const size_t np(m_peaks.size());
411
412 // Column vectors for peaks table
413 std::vector<double> H(np);
414 std::vector<double> K(np);
415 std::vector<double> L(np);
416 std::vector<double> intensity(np);
417 std::vector<double> sigmaIntensity(np);
418 std::vector<double> binCount(np);
419 std::vector<double> waveLength(np);
420 std::vector<double> scattering(np);
421 std::vector<double> dSpacing(np);
422 std::vector<int> runNumber(np);
423 std::vector<int> peakNumber(np);
424 std::vector<double> tbar(np);
425 std::vector<double> intHKL(3 * np);
426 std::vector<double> intMNP(3 * np);
427 std::vector<double> goniometerMatrix(9 * np);
428 std::vector<std::string> shapes(np);
429 std::vector<double> qlabs(3 * np);
430 std::vector<double> monitorCount(np);
431
432 // Populate column vectors
433 size_t maxShapeJSONLength = 0;
434 for (size_t i = 0; i < np; i++) {
436 H[i] = p.getH();
437 K[i] = p.getK();
438 L[i] = p.getL();
439 intensity[i] = p.getIntensity();
440 sigmaIntensity[i] = p.getSigmaIntensity();
441 binCount[i] = p.getBinCount();
442 waveLength[i] = p.getWavelength();
443 scattering[i] = p.getScattering();
444 dSpacing[i] = p.getDSpacing();
445 runNumber[i] = p.getRunNumber();
446 peakNumber[i] = p.getPeakNumber();
448 {
449 V3D hkl = p.getIntHKL();
450 intHKL[3 * i + 0] = hkl[0];
451 intHKL[3 * i + 1] = hkl[1];
452 intHKL[3 * i + 2] = hkl[2];
453 V3D mnp = p.getIntMNP();
454 intMNP[3 * i + 0] = mnp[0];
455 intMNP[3 * i + 1] = mnp[1];
456 intMNP[3 * i + 2] = mnp[2];
458 goniometerMatrix[9 * i + 0] = gm[0][0];
459 goniometerMatrix[9 * i + 1] = gm[1][0];
460 goniometerMatrix[9 * i + 2] = gm[2][0];
461 goniometerMatrix[9 * i + 3] = gm[0][1];
462 goniometerMatrix[9 * i + 4] = gm[1][1];
463 goniometerMatrix[9 * i + 5] = gm[2][1];
464 goniometerMatrix[9 * i + 6] = gm[0][2];
465 goniometerMatrix[9 * i + 7] = gm[1][2];
466 goniometerMatrix[9 * i + 8] = gm[2][2];
467 }
468 const std::string shapeJSON = p.getPeakShape().toJSON();
469 shapes[i] = shapeJSON;
470 if (shapeJSON.size() > maxShapeJSONLength) {
471 maxShapeJSONLength = shapeJSON.size();
472 }
473 {
474 qlabs[3 * i + 0] = p.getQLabFrame().X();
475 qlabs[3 * i + 1] = p.getQLabFrame().Y();
476 qlabs[3 * i + 2] = p.getQLabFrame().Z();
477 }
478 monitorCount[i] = p.getMonitorCount();
479 }
480
481 // Start Peaks Workspace in Nexus File
482 const std::string specifyInteger = "An integer";
483 const std::string specifyDouble = "A double";
484 const std::string specifyString = "A string";
485 file->makeGroup("peaks_workspace", "NXentry",
486 true); // For when peaksWorkspace can be loaded
487
488 // Coordinate system
489 file->writeData("coordinate_system", static_cast<uint32_t>(m_coordSystem));
490
491 // Write out the Qconvention
492 // ki-kf for Inelastic convention; kf-ki for Crystallography convention
493 std::string m_QConvention = this->getConvention();
494 file->putAttr("QConvention", m_QConvention);
495
496 // H column
497 file->writeData("column_1", H);
498 file->openData("column_1");
499 file->putAttr("name", "H");
500 file->putAttr("interpret_as", specifyDouble);
501 file->putAttr("units", "Not known"); // Units may need changing when known
502 file->closeData();
503
504 // K column
505 file->writeData("column_2", K);
506 file->openData("column_2");
507 file->putAttr("name", "K");
508 file->putAttr("interpret_as", specifyDouble);
509 file->putAttr("units", "Not known"); // Units may need changing when known
510 file->closeData();
511
512 // L column
513 file->writeData("column_3", L);
514 file->openData("column_3");
515 file->putAttr("name", "L");
516 file->putAttr("interpret_as", specifyDouble);
517 file->putAttr("units", "Not known"); // Units may need changing when known
518 file->closeData();
519
520 // Intensity column
521 file->writeData("column_4", intensity);
522 file->openData("column_4");
523 file->putAttr("name", "Intensity");
524 file->putAttr("interpret_as", specifyDouble);
525 file->putAttr("units", "Not known"); // Units may need changing when known
526 file->closeData();
527
528 // Sigma Intensity column
529 file->writeData("column_5", sigmaIntensity);
530 file->openData("column_5");
531 file->putAttr("name", "Sigma Intensity");
532 file->putAttr("interpret_as", specifyDouble);
533 file->putAttr("units", "Not known"); // Units may need changing when known
534 file->closeData();
535
536 // Bin Count column
537 file->writeData("column_6", binCount);
538 file->openData("column_6");
539 file->putAttr("name", "Bin Count");
540 file->putAttr("interpret_as", specifyDouble);
541 file->putAttr("units", "Not known"); // Units may need changing when known
542 file->closeData();
543
544 // Wave Length Column
545 file->writeData("column_7", waveLength);
546 file->openData("column_7");
547 file->putAttr("name", "Wave Length");
548 file->putAttr("interpret_as", specifyDouble);
549 file->putAttr("units", "Not known"); // Units may need changing when known
550 file->closeData();
551
552 // Scattering Column
553 file->writeData("column_8", scattering);
554 file->openData("column_8");
555 file->putAttr("name", "Scattering");
556 file->putAttr("interpret_as", specifyDouble);
557 file->putAttr("units", "Not known"); // Units may need changing when known
558 file->closeData();
559
560 // D Spacing Column
561 file->writeData("column_9", dSpacing);
562 file->openData("column_9");
563 file->putAttr("name", "D Spacing");
564 file->putAttr("interpret_as", specifyDouble);
565 file->putAttr("units", "Not known"); // Units may need changing when known
566 file->closeData();
567
568 // Run Number column
569 file->writeData("column_10", runNumber);
570 file->openData("column_10");
571 file->putAttr("name", "Run Number");
572 file->putAttr("interpret_as", specifyInteger);
573 file->putAttr("units", "Not known"); // Units may need changing when known
574 file->closeData();
575
576 // Peak Number column
577 file->writeData("column_11", peakNumber);
578 file->openData("column_11");
579 file->putAttr("name", "Peak Number");
580 file->putAttr("interpret_as", specifyInteger);
581 file->putAttr("units", "Not known"); // Units may need changing when known
582 file->closeData();
583
584 // TBar column
585 file->writeData("column_12", tbar);
586 file->openData("column_12");
587 file->putAttr("name", "TBar");
588 file->putAttr("interpret_as", specifyDouble);
589 file->putAttr("units", "Not known"); // Units may need changing when known
590 file->closeData();
591
592 // Goniometer Matrix Column
593 const Nexus::DimVector array_dims{m_peaks.size(), 9};
594 file->writeData("column_13", goniometerMatrix, array_dims);
595 file->openData("column_13");
596 file->putAttr("name", "Goniometer Matrix");
597 file->putAttr("interpret_as", "A matrix of 3x3 doubles");
598 file->putAttr("units", "Not known"); // Units may need changing when known
599 file->closeData();
600
601 // Shape
602 Nexus::DimVector dims;
603 dims.emplace_back(np);
604 dims.emplace_back(static_cast<int>(maxShapeJSONLength));
605 const std::string name = "column_14";
606 file->makeData(name, NXnumtype::CHAR, dims, false);
607 file->openData(name);
608
609 auto toNexus = new char[maxShapeJSONLength * np];
610 for (size_t ii = 0; ii < np; ii++) {
611 std::string rowStr = shapes[ii];
612 for (size_t ic = 0; ic < rowStr.size(); ic++)
613 toNexus[ii * maxShapeJSONLength + ic] = rowStr[ic];
614 for (size_t ic = rowStr.size(); ic < static_cast<size_t>(maxShapeJSONLength); ic++)
615 toNexus[ii * maxShapeJSONLength + ic] = ' ';
616 }
617
618 file->putData(toNexus);
619
620 delete[] toNexus;
621 file->putAttr("units", "Not known"); // Units may need changing when known
622 file->putAttr("name", "Shape");
623 file->putAttr("interpret_as", specifyString);
624 file->closeData();
625
626 // Qlab
627 const Nexus::DimVector qlab_dims{m_peaks.size(), 3};
628 file->writeData("column_15", qlabs, qlab_dims);
629 file->openData("column_15");
630 file->putAttr("name", "Q LabFrame");
631 file->putAttr("interpret_as", "A vector of 3 doubles");
632 file->putAttr("units", "angstrom^-1");
633 file->closeData();
634
635 // Integer HKL column
636 file->writeData("column_16", intHKL, qlab_dims);
637 file->openData("column_16");
638 file->putAttr("name", "IntHKL");
639 file->putAttr("interpret_as", "A vector of 3 doubles");
640 file->putAttr("units", "r.l.u.");
641 file->closeData();
642
643 // Integer HKL column
644 file->writeData("column_17", intMNP, qlab_dims);
645 file->openData("column_17");
646 file->putAttr("name", "IntMNP");
647 file->putAttr("interpret_as", "A vector of 3 doubles");
648 file->putAttr("units", "r.l.u.");
649 file->closeData();
650
651 // Monitor Count column
652 file->writeData("column_18", monitorCount);
653 file->openData("column_18");
654 file->putAttr("name", "Monitor Count");
655 file->putAttr("interpret_as", specifyDouble);
656 file->putAttr("units", "Not known");
657 file->closeData();
658
659 file->closeGroup(); // end of peaks workpace
660}
661
667 m_coordSystem = coordinateSystem;
668}
669
674
675// prevent shared pointer from deleting this
677 template <typename T> void operator()(T * /*unused*/) {}
678};
683
690
691ITableWorkspace *LeanElasticPeaksWorkspace::doCloneColumns(const std::vector<std::string> & /*colNames*/) const {
692 throw Kernel::Exception::NotImplementedError("LeanElasticPeaksWorkspace cannot clone columns.");
693}
694} // namespace Mantid::DataObjects
695
697
698namespace Mantid::Kernel {
699
700template <>
702IPropertyManager::getValue<Mantid::DataObjects::LeanElasticPeaksWorkspace_sptr>(const std::string &name) const {
704 getPointerToProperty(name));
705 if (prop) {
706 return *prop;
707 } else {
708 std::string message =
709 "Attempt to assign property " + name + " to incorrect type. Expected shared_ptr<LeanElasticPeaksWorkspace>.";
710 throw std::runtime_error(message);
711 }
712}
713
714template <>
716IPropertyManager::getValue<Mantid::DataObjects::LeanElasticPeaksWorkspace_const_sptr>(const std::string &name) const {
718 getPointerToProperty(name))) {
719 return prop->operator()();
720 } else {
721 std::string message = "Attempt to assign property " + name +
722 " to incorrect type. Expected const "
723 "shared_ptr<LeanElasticPeaksWorkspace>.";
724 throw std::runtime_error(message);
725 }
726}
727
728} // namespace Mantid::Kernel
729
std::string name
Definition Run.cpp:60
double intensity
double value
The value of the point.
Definition FitMW.cpp:51
double position
Definition GetAllEi.cpp:154
std::map< DeltaEMode::Type, std::string > index
#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:43
const Geometry::Goniometer & getGoniometer() const
Return reference to the first const Goniometer object for this run.
Definition Run.cpp:525
const Geometry::OrientedLattice & getOrientedLattice() const
Get a reference to the sample's OrientedLattice.
Definition Sample.cpp:198
Mantid::Kernel::V3D getIntMNP() const override
Return the int MNP vector.
Definition BasePeak.cpp:116
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:348
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:298
double getMonitorCount() const override
Return the monitor count stored in this peak.
Definition BasePeak.cpp:86
Mantid::Kernel::V3D getIntHKL() const override
Return the int HKL vector.
Definition BasePeak.cpp:113
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)
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
Mantid::Kernel::V3D getQLabFrame() const final
Return the Q change (of the lattice, k_i - k_f) for this peak.
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.
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...
LeanElasticPeak & getPeak(size_t const peakNum) override
Return a reference to the Peak.
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:20
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:41
The concrete, templated class for properties.
Class for 3D vectors.
Definition V3D.h:35
constexpr double X() const noexcept
Get x.
Definition V3D.h:239
constexpr double Y() const noexcept
Get y.
Definition V3D.h:240
constexpr double Z() const noexcept
Get z.
Definition V3D.h:241
static unsigned short constexpr CHAR
std::shared_ptr< const LogManager > LogManager_const_sptr
shared pointer to the logManager base class (const version)
Definition LogManager.h:228
std::shared_ptr< LogManager > LogManager_sptr
shared pointer to the logManager base class
Definition LogManager.h:226
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.
std::vector< dimsize_t > DimVector