diff --git a/Framework/API/inc/MantidAPI/IPeaksWorkspace.h b/Framework/API/inc/MantidAPI/IPeaksWorkspace.h index 22923b7dbc557cc6dab6aa24d433473fc434e3ed..e6cc1a5447e695b1854d89c7014b200409167a7a 100644 --- a/Framework/API/inc/MantidAPI/IPeaksWorkspace.h +++ b/Framework/API/inc/MantidAPI/IPeaksWorkspace.h @@ -85,7 +85,8 @@ public: * @param position :: V3D positon of the peak. * @param position :: Coordinate system frame of the peak position. */ - virtual void addPeak(const Kernel::V3D &position, const Kernel::SpecialCoordinateSystem &frame) = 0; + virtual void addPeak(const Kernel::V3D &position, + const Kernel::SpecialCoordinateSystem &frame) = 0; //--------------------------------------------------------------------------------------------- /** Return a reference to the Peak @@ -120,7 +121,7 @@ public: */ virtual Mantid::Geometry::IPeak * createPeak(const Mantid::Kernel::V3D &QLabFrame, - boost::optional<double> detectorDistance= boost::none) const = 0; + boost::optional<double> detectorDistance = boost::none) const = 0; //--------------------------------------------------------------------------------------------- /** Create an instance of a Peak diff --git a/Framework/DataObjects/inc/MantidDataObjects/PeaksWorkspace.h b/Framework/DataObjects/inc/MantidDataObjects/PeaksWorkspace.h index ce4717bd0cf551994ff4343c7cf24501ee011e71..bc2af2cc06c1170d179b4d2329080f1411ac66e2 100644 --- a/Framework/DataObjects/inc/MantidDataObjects/PeaksWorkspace.h +++ b/Framework/DataObjects/inc/MantidDataObjects/PeaksWorkspace.h @@ -102,7 +102,8 @@ public: void addPeak(const Geometry::IPeak &peak) override; /// Move a peak object into this peaks workspace void addPeak(Peak &&peak); - void addPeak(const Kernel::V3D &position, const Kernel::SpecialCoordinateSystem &frame) override; + void addPeak(const Kernel::V3D &position, + const Kernel::SpecialCoordinateSystem &frame) override; Peak &getPeak(int peakNum) override; const Peak &getPeak(int peakNum) const override; @@ -110,9 +111,9 @@ public: const Kernel::V3D &QLabFrame, boost::optional<double> detectorDistance = boost::none) const override; - std::unique_ptr<Geometry::IPeak> createPeak( - const Kernel::V3D &Position, - const Kernel::SpecialCoordinateSystem& frame) const override; + std::unique_ptr<Geometry::IPeak> + createPeak(const Kernel::V3D &Position, + const Kernel::SpecialCoordinateSystem &frame) const override; std::vector<std::pair<std::string, std::string>> peakInfo(const Kernel::V3D &qFrame, bool labCoords) const override; diff --git a/Framework/DataObjects/src/PeaksWorkspace.cpp b/Framework/DataObjects/src/PeaksWorkspace.cpp index 4d07437962052b819b1f12aa1d9baced538e7913..eab92ec1da6acffa556b7c14a23d8dce15c316f5 100644 --- a/Framework/DataObjects/src/PeaksWorkspace.cpp +++ b/Framework/DataObjects/src/PeaksWorkspace.cpp @@ -188,8 +188,8 @@ void PeaksWorkspace::addPeak(const Geometry::IPeak &ipeak) { * @param position :: position on the peak in the specified coordinate frame * @param frame :: the coordinate frame that the position is specified in */ -void PeaksWorkspace::addPeak(const V3D &position, const SpecialCoordinateSystem &frame) -{ +void PeaksWorkspace::addPeak(const V3D &position, + const SpecialCoordinateSystem &frame) { auto peak = createPeak(position, frame); addPeak(*peak); } @@ -260,23 +260,23 @@ PeaksWorkspace::createPeak(const Kernel::V3D &QLabFrame, std::unique_ptr<Geometry::IPeak> PeaksWorkspace::createPeak(const Kernel::V3D &position, const Kernel::SpecialCoordinateSystem &frame) const { - if (frame == Mantid::Kernel::HKL) { - return std::unique_ptr<Geometry::IPeak>(createPeakHKL(position)); - } else if (frame == Mantid::Kernel::QLab) { - return std::unique_ptr<Geometry::IPeak>(createPeak(position)); - } else { - return std::unique_ptr<Geometry::IPeak>(createPeakQSample(position)); - } + if (frame == Mantid::Kernel::HKL) { + return std::unique_ptr<Geometry::IPeak>(createPeakHKL(position)); + } else if (frame == Mantid::Kernel::QLab) { + return std::unique_ptr<Geometry::IPeak>(createPeak(position)); + } else { + return std::unique_ptr<Geometry::IPeak>(createPeakQSample(position)); + } } //--------------------------------------------------------------------------------------------- /** Creates an instance of a Peak BUT DOES NOT ADD IT TO THE WORKSPACE - * @param position :: QSample position of the center of the peak, in reciprocal space + * @param position :: QSample position of the center of the peak, in reciprocal + * space * detector. You do NOT need to explicitly provide this distance. * @return a pointer to a new Peak object. */ -Peak *PeaksWorkspace::createPeakQSample(const V3D &position) const -{ +Peak *PeaksWorkspace::createPeakQSample(const V3D &position) const { // Create a peak from QSampleFrame const auto goniometer = run().getGoniometer(); // create a peak using the qLab frame diff --git a/Framework/DataObjects/test/PeaksWorkspaceTest.h b/Framework/DataObjects/test/PeaksWorkspaceTest.h index 38bca486ec165046c6cf5b45c9b0538e4eda2716..56c690b70c318359938d8797e221adfd822da073 100644 --- a/Framework/DataObjects/test/PeaksWorkspaceTest.h +++ b/Framework/DataObjects/test/PeaksWorkspaceTest.h @@ -370,18 +370,18 @@ public: peak->getHKL()); TSM_ASSERT_EQUALS("New peak should have QLab we expected.", params.qLab, peak->getQLabFrame()); - TSM_ASSERT_EQUALS("New peak should have QSample we expected.", params.qSample, - peak->getQSampleFrame()); + TSM_ASSERT_EQUALS("New peak should have QSample we expected.", + params.qSample, peak->getQSampleFrame()); auto detector = peak->getDetector(); TSM_ASSERT("No detector", detector); TSM_ASSERT_EQUALS("This detector id does not match what we expect from the " "instrument definition", 1, detector->getID()); - TSM_ASSERT_EQUALS("Thie detector position is wrong", params.detectorPosition, - detector->getPos()); - TSM_ASSERT_EQUALS("Goniometer has not been set properly", params.goniometer.getR(), - peak->getGoniometerMatrix()); + TSM_ASSERT_EQUALS("Thie detector position is wrong", + params.detectorPosition, detector->getPos()); + TSM_ASSERT_EQUALS("Goniometer has not been set properly", + params.goniometer.getR(), peak->getGoniometerMatrix()); // Clean up. delete peak; @@ -397,8 +397,8 @@ public: peak->getHKL()); TSM_ASSERT_EQUALS("New peak should have QLab we expected.", params.qLab, peak->getQLabFrame()); - TSM_ASSERT_EQUALS("New peak should have QSample we expected.", params.qSample, - peak->getQSampleFrame()); + TSM_ASSERT_EQUALS("New peak should have QSample we expected.", + params.qSample, peak->getQSampleFrame()); } void test_create_peak_with_position_qsample() { @@ -409,8 +409,8 @@ public: TSM_ASSERT_EQUALS("New peak should have QLab we expected.", params.qLab, peak->getQLabFrame()); - TSM_ASSERT_EQUALS("New peak should have QSample we expected.", params.qSample, - peak->getQSampleFrame()); + TSM_ASSERT_EQUALS("New peak should have QSample we expected.", + params.qSample, peak->getQSampleFrame()); } void test_create_peak_with_position_qlab() { @@ -421,8 +421,8 @@ public: TSM_ASSERT_EQUALS("New peak should have QLab we expected.", params.qLab, peak->getQLabFrame()); - TSM_ASSERT_EQUALS("New peak should have QSample we expected.", params.qSample, - peak->getQSampleFrame()); + TSM_ASSERT_EQUALS("New peak should have QSample we expected.", + params.qSample, peak->getQSampleFrame()); } void test_add_peak_with_position_hkl() { @@ -438,8 +438,8 @@ public: peak.getHKL()); TSM_ASSERT_EQUALS("New peak should have QLab we expected.", params.qLab, peak.getQLabFrame()); - TSM_ASSERT_EQUALS("New peak should have QSample we expected.", params.qSample, - peak.getQSampleFrame()); + TSM_ASSERT_EQUALS("New peak should have QSample we expected.", + params.qSample, peak.getQSampleFrame()); } void test_add_peak_with_position_qlab() { @@ -453,8 +453,8 @@ public: TSM_ASSERT_EQUALS("New peak should have QLab we expected.", params.qLab, peak.getQLabFrame()); - TSM_ASSERT_EQUALS("New peak should have QSample we expected.", params.qSample, - peak.getQSampleFrame()); + TSM_ASSERT_EQUALS("New peak should have QSample we expected.", + params.qSample, peak.getQSampleFrame()); } void test_add_peak_with_position_qsample() { @@ -468,8 +468,8 @@ public: TSM_ASSERT_EQUALS("New peak should have QLab we expected.", params.qLab, peak.getQLabFrame()); - TSM_ASSERT_EQUALS("New peak should have QSample we expected.", params.qSample, - peak.getQSampleFrame()); + TSM_ASSERT_EQUALS("New peak should have QSample we expected.", + params.qSample, peak.getQSampleFrame()); } /** @@ -601,14 +601,13 @@ private: 1, 1, 1, 90, 90, 90); // U is identity, real and reciprocal lattice // vectors are identical. - V3D qSample = Rinv * qLab; V3D hkl = qSample / (2 * M_PI); // Given our settings above, this is the - // simplified relationship between qLab and - // hkl. + // simplified relationship between qLab and + // hkl. - return PeakParameters {minimalInstrument, goniometer, orientedLattice, - hkl, qLab, qSample, detectorPos}; + return PeakParameters{minimalInstrument, goniometer, orientedLattice, hkl, + qLab, qSample, detectorPos}; } PeaksWorkspace_sptr makeWorkspace(const PeakParameters ¶ms) { diff --git a/Framework/PythonInterface/mantid/api/src/Exports/IPeaksWorkspace.cpp b/Framework/PythonInterface/mantid/api/src/Exports/IPeaksWorkspace.cpp index 115732cfb949fd559a147e1aad091f497d12f376..b62e9d191165eff5f547dde00b2bffe9ea729555 100644 --- a/Framework/PythonInterface/mantid/api/src/Exports/IPeaksWorkspace.cpp +++ b/Framework/PythonInterface/mantid/api/src/Exports/IPeaksWorkspace.cpp @@ -38,9 +38,7 @@ IPeak *createPeakQLabWithDistance(IPeaksWorkspace &self, const object &data, detectorDistance); } /// Create a peak via it's QLab value from a list or numpy array -void addPeak(IPeaksWorkspace &self, const IPeak& peak) { - self.addPeak(peak); -} +void addPeak(IPeaksWorkspace &self, const IPeak &peak) { self.addPeak(peak); } } void export_IPeaksWorkspace() { diff --git a/qt/widgets/sliceviewer/src/PeaksWorkspaceWidget.cpp b/qt/widgets/sliceviewer/src/PeaksWorkspaceWidget.cpp index ed3617eef91d88eeaa9d4f674b68815eb5326afd..fabb62036bd5f43efa4926f3160b2057f5b4e14f 100644 --- a/qt/widgets/sliceviewer/src/PeaksWorkspaceWidget.cpp +++ b/qt/widgets/sliceviewer/src/PeaksWorkspaceWidget.cpp @@ -34,8 +34,7 @@ PeaksWorkspaceWidget::PeaksWorkspaceWidget( Mantid::API::IPeaksWorkspace_const_sptr ws, const std::string &coordinateSystem, PeakViewColor defaultForegroundPeakViewColor, - PeakViewColor defaultBackgroundPeakViewColor, - PeaksViewer *parent) + PeakViewColor defaultBackgroundPeakViewColor, PeaksViewer *parent) : QWidget(parent), m_ws(ws), m_coordinateSystem(coordinateSystem), m_foregroundPeakViewColor(defaultForegroundPeakViewColor), m_backgroundPeakViewColor(defaultBackgroundPeakViewColor),