From 6bac45366753a869d61fc0c36a00614362d1f91b Mon Sep 17 00:00:00 2001 From: James Clarke Date: Thu, 26 Sep 2024 16:26:12 +0100 Subject: [PATCH 1/2] Revert #37908 That PR causes a dynamic library loading problem in the release. --- Framework/Crystal/CMakeLists.txt | 5 +- .../inc/MantidCrystal/RotateSampleShape.h | 53 ----- Framework/Crystal/src/RotateSampleShape.cpp | 165 -------------- .../Crystal/test/RotateSampleShapeTest.h | 205 ------------------ .../MantidDataHandling/CreateSampleShape.h | 2 +- .../DataHandling/src/CreateSampleShape.cpp | 4 +- .../algorithms/RotateSampleShape-v1.rst | 57 ----- .../Single_Crystal/New_features/37908.rst | 1 - 8 files changed, 4 insertions(+), 488 deletions(-) delete mode 100644 Framework/Crystal/inc/MantidCrystal/RotateSampleShape.h delete mode 100644 Framework/Crystal/src/RotateSampleShape.cpp delete mode 100644 Framework/Crystal/test/RotateSampleShapeTest.h delete mode 100644 docs/source/algorithms/RotateSampleShape-v1.rst delete mode 100644 docs/source/release/v6.11.0/Diffraction/Single_Crystal/New_features/37908.rst diff --git a/Framework/Crystal/CMakeLists.txt b/Framework/Crystal/CMakeLists.txt index a4627f2e7a8f..06a051c7769f 100644 --- a/Framework/Crystal/CMakeLists.txt +++ b/Framework/Crystal/CMakeLists.txt @@ -72,7 +72,6 @@ set(SRC_FILES src/SortPeaksWorkspace.cpp src/StatisticsOfPeaksWorkspace.cpp src/TransformHKL.cpp - src/RotateSampleShape.cpp ) set(INC_FILES @@ -152,7 +151,6 @@ set(INC_FILES inc/MantidCrystal/SortPeaksWorkspace.h inc/MantidCrystal/StatisticsOfPeaksWorkspace.h inc/MantidCrystal/TransformHKL.h - inc/MantidCrystal/RotateSampleShape.h ) set(TEST_FILES @@ -225,7 +223,6 @@ set(TEST_FILES SortPeaksWorkspaceTest.h StatisticsOfPeaksWorkspaceTest.h TransformHKLTest.h - RotateSampleShapeTest.h ) if(COVERAGE) @@ -261,7 +258,7 @@ include_directories(inc) target_link_libraries( Crystal PUBLIC Mantid::API Mantid::Geometry Mantid::Kernel - PRIVATE Mantid::DataObjects Mantid::Indexing Mantid::DataHandling + PRIVATE Mantid::DataObjects Mantid::Indexing ) # Add the unit tests directory diff --git a/Framework/Crystal/inc/MantidCrystal/RotateSampleShape.h b/Framework/Crystal/inc/MantidCrystal/RotateSampleShape.h deleted file mode 100644 index cdd1cb683f8a..000000000000 --- a/Framework/Crystal/inc/MantidCrystal/RotateSampleShape.h +++ /dev/null @@ -1,53 +0,0 @@ -// Mantid Repository : https://github.com/mantidproject/mantid -// -// Copyright © 2024 ISIS Rutherford Appleton Laboratory UKRI, -// NScD Oak Ridge National Laboratory, European Spallation Source, -// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS -// SPDX - License - Identifier: GPL - 3.0 + -#pragma once - -#include "MantidAPI/Algorithm.h" -#include "MantidAPI/MultipleExperimentInfos.h" -#include "MantidCrystal/DllConfig.h" - -namespace Mantid { -namespace Geometry { -class Goniometer; -} -} // namespace Mantid - -namespace Mantid { -namespace Crystal { - -using Mantid::Geometry::Goniometer; - -/** Define the initial orientation of the sample with respect to the beam and instrument by giving the axes and - *directions of rotations. - */ -class MANTID_CRYSTAL_DLL RotateSampleShape final : public API::Algorithm { -public: - /// Algorithm's name for identification - const std::string name() const override { return "RotateSampleShape"; }; - /// Summary of algorithms purpose - const std::string summary() const override { - return "Define the initial orientation of the sample with respect to the beam and instrument " - "by giving the axes, angle and directions of rotations."; - } - - /// Algorithm's version for identification - int version() const override { return 1; }; - const std::vector seeAlso() const override { return {"SetGoniometer"}; } - /// Algorithm's category for identification - const std::string category() const override { return "Crystal\\Goniometer"; } - -private: - /// Initialise the properties - void init() override; - /// Run the algorithm - void exec() override; - void prepareGoniometerAxes(Goniometer &gon); - bool checkIsValidShape(const API::ExperimentInfo_sptr &ei, std::string &shapeXML, bool &isMeshShape); -}; - -} // namespace Crystal -} // namespace Mantid diff --git a/Framework/Crystal/src/RotateSampleShape.cpp b/Framework/Crystal/src/RotateSampleShape.cpp deleted file mode 100644 index 97a3b14536af..000000000000 --- a/Framework/Crystal/src/RotateSampleShape.cpp +++ /dev/null @@ -1,165 +0,0 @@ -// Mantid Repository : https://github.com/mantidproject/mantid -// -// Copyright © 2024 ISIS Rutherford Appleton Laboratory UKRI, -// NScD Oak Ridge National Laboratory, European Spallation Source, -// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS -// SPDX - License - Identifier: GPL - 3.0 + -#include "MantidCrystal/RotateSampleShape.h" -#include "MantidAPI/MatrixWorkspace.h" -#include "MantidAPI/Run.h" -#include "MantidAPI/Sample.h" -#include "MantidDataHandling/CreateSampleShape.h" -#include "MantidGeometry/Instrument/Goniometer.h" -#include "MantidGeometry/Objects/MeshObject.h" -#include "MantidGeometry/Objects/ShapeFactory.h" -#include "MantidKernel/Strings.h" -#include "MantidKernel/TimeSeriesProperty.h" -#include -#include - -namespace Mantid::Crystal { - -// Register the algorithm into the AlgorithmFactory -DECLARE_ALGORITHM(RotateSampleShape) - -using namespace Mantid::Geometry; -using namespace Mantid::Kernel; -using namespace Mantid::API; - -/// How many axes (max) to define -const size_t NUM_AXES = 6; -Mantid::Kernel::Logger g_log("RotateSampleShape"); - -/** Initialize the algorithm's properties. - */ -void RotateSampleShape::init() { - declareProperty(std::make_unique>("Workspace", "", Direction::InOut), - "The workspace containing the sample whose orientation is to be rotated"); - - std::string axisHelp = ": degrees,x,y,z,1/-1 (1 for ccw, -1 for cw rotation)."; - for (size_t i = 0; i < NUM_AXES; i++) { - std::ostringstream propName; - propName << "Axis" << i; - declareProperty(std::make_unique>(propName.str(), "", Direction::Input), - propName.str() + axisHelp); - } -} - -/** Execute the algorithm. - */ -void RotateSampleShape::exec() { - Workspace_sptr ws = getProperty("Workspace"); - auto ei = std::dynamic_pointer_cast(ws); - - if (!ei) { - // We're dealing with an MD workspace which has multiple experiment infos - auto infos = std::dynamic_pointer_cast(ws); - if (!infos) { - throw std::invalid_argument("Input workspace does not support RotateSampleShape"); - } - if (infos->getNumExperimentInfo() < 1) { - ExperimentInfo_sptr info(new ExperimentInfo()); - infos->addExperimentInfo(info); - } - ei = infos->getExperimentInfo(0); - } - - std::string shapeXML; - bool isMeshShape = false; - if (!checkIsValidShape(ei, shapeXML, isMeshShape)) { - throw std::runtime_error("Input sample does not have a valid shape!"); - } - - // Create a goniometer with provided rotations - Goniometer gon; - prepareGoniometerAxes(gon); - if (gon.getNumberAxes() == 0) - g_log.warning() << "Empty goniometer created; will always return an " - "identity rotation matrix.\n"; - - const auto sampleShapeRotation = gon.getR(); - if (sampleShapeRotation == Kernel::Matrix(3, 3, true)) { - // If the resulting rotationMatrix is Identity, ignore the calculatrion - g_log.warning("Rotation matrix set via RotateSampleShape is an Identity matrix. Ignored rotating sample shape"); - return; - } - - const auto oldRotation = ei->run().getGoniometer().getR(); - auto newSampleShapeRot = sampleShapeRotation * oldRotation; - if (isMeshShape) { - auto meshShape = std::dynamic_pointer_cast(ei->sample().getShapePtr()); - meshShape->rotate(newSampleShapeRot); - } else { - shapeXML = Geometry::ShapeFactory().addGoniometerTag(newSampleShapeRot, shapeXML); - Mantid::DataHandling::CreateSampleShape::setSampleShape(*ei, shapeXML, false); - } -} - -bool RotateSampleShape::checkIsValidShape(const API::ExperimentInfo_sptr &ei, std::string &shapeXML, - bool &isMeshShape) { - if (ei->sample().hasShape()) { - const auto csgShape = std::dynamic_pointer_cast(ei->sample().getShapePtr()); - if (csgShape && csgShape->hasValidShape()) { - shapeXML = csgShape->getShapeXML(); - if (!shapeXML.empty()) { - return true; - } - } else { - const auto meshShape = std::dynamic_pointer_cast(ei->sample().getShapePtr()); - if (meshShape && meshShape->hasValidShape()) { - isMeshShape = true; - return true; - } - } - } - return false; -} - -void RotateSampleShape::prepareGoniometerAxes(Goniometer &gon) { - for (size_t i = 0; i < NUM_AXES; i++) { - std::ostringstream propName; - propName << "Axis" << i; - std::string axisDesc = getPropertyValue(propName.str()); - if (!axisDesc.empty()) { - std::vector tokens; - boost::split(tokens, axisDesc, boost::algorithm::detail::is_any_ofF(",")); - if (tokens.size() != 5) - throw std::invalid_argument("Wrong number of arguments to parameter " + propName.str() + - ". Expected 5 comma-separated arguments."); - - std::transform(tokens.begin(), tokens.end(), tokens.begin(), [](std::string str) { return Strings::strip(str); }); - if (!std::all_of(tokens.begin(), tokens.end(), [](std::string tokenStr) { return !tokenStr.empty(); })) { - throw std::invalid_argument("Empty axis parameters found!"); - } - - double angle = 0; - if (!Strings::convert(tokens[0], angle)) { - throw std::invalid_argument("Error converting angle string '" + tokens[0] + "' to a number."); - } - - std::string axisName = "RotateSampleShapeAxis" + Strings::toString(i) + "_FixedValue"; - double x = 0, y = 0, z = 0; - if (!Strings::convert(tokens[1], x)) - throw std::invalid_argument("Error converting x string '" + tokens[1] + "' to a number."); - if (!Strings::convert(tokens[2], y)) - throw std::invalid_argument("Error converting y string '" + tokens[2] + "' to a number."); - if (!Strings::convert(tokens[3], z)) - throw std::invalid_argument("Error converting z string '" + tokens[3] + "' to a number."); - V3D vec(x, y, z); - if (vec.norm() < 1e-4) - throw std::invalid_argument("Rotation axis vector should be non-zero!"); - - int ccw = 0; - if (!Strings::convert(tokens[4], ccw)) { - throw std::invalid_argument("Error converting sense of roation '" + tokens[4] + "' to a number."); - } - if (ccw != 1 && ccw != -1) { - throw std::invalid_argument("The sense of rotation parameter must only be 1 (ccw) or -1 (cw)"); - } - // Default to degrees - gon.pushAxis(axisName, x, y, z, angle, ccw); - } - } -} - -} // namespace Mantid::Crystal diff --git a/Framework/Crystal/test/RotateSampleShapeTest.h b/Framework/Crystal/test/RotateSampleShapeTest.h deleted file mode 100644 index e1706d794002..000000000000 --- a/Framework/Crystal/test/RotateSampleShapeTest.h +++ /dev/null @@ -1,205 +0,0 @@ -// Mantid Repository : https://github.com/mantidproject/mantid -// -// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI, -// NScD Oak Ridge National Laboratory, European Spallation Source, -// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS -// SPDX - License - Identifier: GPL - 3.0 + -#pragma once - -#include "MantidAPI/Sample.h" -#include "MantidCrystal/RotateSampleShape.h" -#include "MantidFrameworkTestHelpers/ComponentCreationHelper.h" -#include "MantidFrameworkTestHelpers/WorkspaceCreationHelper.h" -#include "MantidGeometry/Instrument/Goniometer.h" -#include "MantidGeometry/Objects/MeshObject.h" -#include "MantidGeometry/Objects/ShapeFactory.h" -#include "MantidKernel/Matrix.h" -#include "MantidKernel/V3D.h" -#include - -using namespace Mantid::Crystal; -using namespace Mantid::API; -using namespace Mantid::Geometry; -using Mantid::DataObjects::Workspace2D_sptr; -using Mantid::Kernel::V3D; - -class RotateSampleShapeTest : public CxxTest::TestSuite { -public: - void test_Init() { - RotateSampleShape alg; - TS_ASSERT_THROWS_NOTHING(alg.initialize()) - TS_ASSERT(alg.isInitialized()) - } - - Workspace2D_sptr getWsWithCSGSampleShape(std::string shapeXml, std::string wsName = "RotSampleShapeTest_ws") { - Workspace2D_sptr ws = WorkspaceCreationHelper::create2DWorkspace(10, 10); - AnalysisDataService::Instance().addOrReplace(wsName, ws); - ShapeFactory shapeMaker; - ws->mutableSample().setShape(shapeMaker.createShape(shapeXml)); - return ws; - } - - Workspace2D_sptr getWsWithMeshSampleShape(std::unique_ptr &meshShape, - std::string wsName = "RotSampleShapeTest_ws") { - Workspace2D_sptr ws = WorkspaceCreationHelper::create2DWorkspace(10, 10); - AnalysisDataService::Instance().addOrReplace(wsName, ws); - ws->mutableSample().setShape(std::move(meshShape)); - return ws; - } - - void assert_fail_when_invalid_params(std::string axisName, std::string paramStr) { - RotateSampleShape alg; - alg.setRethrows(true); - auto shapeXML = ComponentCreationHelper::cappedCylinderXML(0.5, 1.5, V3D(0.0, 0.0, 0.0), V3D(0., 1.0, 0.), "tube"); - Workspace2D_sptr ws = getWsWithCSGSampleShape(shapeXML); - - TS_ASSERT_THROWS_NOTHING(alg.initialize()) - TS_ASSERT(alg.isInitialized()) - TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("Workspace", "RotSampleShapeTest_ws")); - TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue(axisName, paramStr)); - TS_ASSERT_THROWS(alg.execute(), const std::invalid_argument &); - TS_ASSERT(!alg.isExecuted()); - } - - void test_exec_failures_when_invalid_params() { - assert_fail_when_invalid_params("Axis1", ",,,,"); - assert_fail_when_invalid_params("Axis2", ", 1.0,2.0,3.0, 1"); - assert_fail_when_invalid_params("Axis3", "10, x,0,0, -1"); - assert_fail_when_invalid_params("Axis4", "10, 1,y,0, -1"); - assert_fail_when_invalid_params("Axis5", "10, 0,0,z, -1"); - assert_fail_when_invalid_params("Axis0", "10, 1.0,2.0,3.0, sense"); - assert_fail_when_invalid_params("Axis1", "30, 1.0,2.0,3.0, 10"); - assert_fail_when_invalid_params("Axis2", "10, 0.00001,0.00001,0.00001, 1"); - } - - Workspace2D_sptr assert_rotatesample_runs_with_given_shape(std::string &shapeXML, - std::map &properties) { - Workspace2D_sptr ws = getWsWithCSGSampleShape(shapeXML, properties["Workspace"]); - RotateSampleShape alg; - TS_ASSERT_THROWS_NOTHING(alg.initialize()) - TS_ASSERT(alg.isInitialized()) - - for (const auto &pair : properties) { - TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue(pair.first, pair.second)); - } - - TS_ASSERT_THROWS_NOTHING(alg.execute();); - TS_ASSERT(alg.isExecuted()); - TS_ASSERT_EQUALS(ws->run().getNumGoniometers(), 1); - auto ei = std::dynamic_pointer_cast(ws); - const auto shape = std::dynamic_pointer_cast(ei->sample().getShapePtr()); - std::string shapeStr = shape->getShapeXML(); - TS_ASSERT(shapeStr.find("run().getGoniometer().getR() == Mantid::Kernel::Matrix(3, 3, true)); - - return ws; - } - - void test_rotate_cylindrical_sample_shape() { - auto shapeXML = ComponentCreationHelper::cappedCylinderXML(0.5, 1.5, V3D(0.0, 0.0, 0.0), V3D(0., 1.0, 0.), "tube"); - std::map algProperties = { - {"Workspace", "RotSampleShapeTest_ws"}, {"Axis0", "10,1.0,2.0,3.0,1"}, {"Axis3", "50,4.0,5.0,6.0,-1"}}; - assert_rotatesample_runs_with_given_shape(shapeXML, algProperties); - } - - void test_rotate_hollow_cylindrical_sample_shape() { - auto shapeXML = ComponentCreationHelper::hollowCylinderXML(0.3, 0.5, 0.5, V3D(0.0, 0.0, 0.0), V3D(0., 1.0, 0.), - "hollow_cylinder"); - std::map algProperties = {{"Workspace", "RotSampleShapeTest_ws"}, - {"Axis2", " 45 , 1.0 , 0.0 , 1.0 , 1 "}, - {"Axis4", " 90 , 0.0 , 1.0 , 1.0 , -1 "}}; - assert_rotatesample_runs_with_given_shape(shapeXML, algProperties); - } - - void test_rotate_spherical_sample_shape() { - auto shapeXML = ComponentCreationHelper::sphereXML(0.02, V3D(0, 0, 0), "sphere"); - std::map algProperties = {{"Workspace", "RotSampleShapeTest_ws"}, - {"Axis0", "60, 1.0,2.0,3.0, 1"}, - {"Axis3", "30 , 4.0, 5.0,6.0, -1"}, - {"Axis2", "10 , 1.0, 0.0 , 0.0, 1 "}}; - assert_rotatesample_runs_with_given_shape(shapeXML, algProperties); - } - - void test_rotate_cuboid_sample_shape() { - auto shapeXML = ComponentCreationHelper::cuboidXML(0.005, 0.005, 0.0025, {0., 0., 0.}, "cuboid"); - std::map algProperties = {{"Workspace", "RotSampleShapeTest_ws"}, - {"Axis2", "60, 1.0,2.0,3.0, 1"}, - {"Axis3", "30 , 4.0, 5.0,6.0, -1"}, - {"Axis5", "10 , 1.0, 0.0 , 0.0, 1 "}}; - assert_rotatesample_runs_with_given_shape(shapeXML, algProperties); - } - - Workspace2D_sptr assert_rotatesample_runs_with_mesh_shape(std::unique_ptr &meshShape, - std::map &properties) { - Workspace2D_sptr ws = getWsWithMeshSampleShape(meshShape, properties["Workspace"]); - RotateSampleShape alg; - TS_ASSERT_THROWS_NOTHING(alg.initialize()) - TS_ASSERT(alg.isInitialized()) - - for (const auto &pair : properties) { - TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue(pair.first, pair.second)); - } - - TS_ASSERT_THROWS_NOTHING(alg.execute();); - TS_ASSERT(alg.isExecuted()); - TS_ASSERT_EQUALS(ws->run().getNumGoniometers(), 1); - auto ei = std::dynamic_pointer_cast(ws); - const auto shape = std::dynamic_pointer_cast(ei->sample().getShapePtr()); - TS_ASSERT(shape != nullptr); - TS_ASSERT(ei->run().getGoniometer().getR() == Mantid::Kernel::Matrix(3, 3, true)); - - return ws; - } - - std::unique_ptr createCube(const double size, const V3D ¢re) { - /** - * Create cube of side length size with specified centre, - * parellel to axes and non-negative vertex coordinates. - */ - double min = 0.0 - 0.5 * size; - double max = 0.5 * size; - std::vector vertices; - vertices.emplace_back(centre + V3D(max, max, max)); - vertices.emplace_back(centre + V3D(min, max, max)); - vertices.emplace_back(centre + V3D(max, min, max)); - vertices.emplace_back(centre + V3D(min, min, max)); - vertices.emplace_back(centre + V3D(max, max, min)); - vertices.emplace_back(centre + V3D(min, max, min)); - vertices.emplace_back(centre + V3D(max, min, min)); - vertices.emplace_back(centre + V3D(min, min, min)); - - std::vector triangles; - // top face of cube - z max - triangles.insert(triangles.end(), {0, 1, 2}); - triangles.insert(triangles.end(), {2, 1, 3}); - // right face of cube - x max - triangles.insert(triangles.end(), {0, 2, 4}); - triangles.insert(triangles.end(), {4, 2, 6}); - // back face of cube - y max - triangles.insert(triangles.end(), {0, 4, 1}); - triangles.insert(triangles.end(), {1, 4, 5}); - // bottom face of cube - z min - triangles.insert(triangles.end(), {7, 5, 6}); - triangles.insert(triangles.end(), {6, 5, 4}); - // left face of cube - x min - triangles.insert(triangles.end(), {7, 3, 5}); - triangles.insert(triangles.end(), {5, 3, 1}); - // front fact of cube - y min - triangles.insert(triangles.end(), {7, 6, 3}); - triangles.insert(triangles.end(), {3, 6, 2}); - - // Use efficient constructor - std::unique_ptr retVal = - std::make_unique(std::move(triangles), std::move(vertices), Mantid::Kernel::Material()); - return retVal; - } - - void test_rotate_mesh_cuboid_sample_shape() { - auto cuboidMeshShape = createCube(2, V3D(0, 0, 0)); - std::map algProperties = {{"Workspace", "RotSampleShapeTest_ws"}, - {"Axis2", "60, 1.0,2.0,3.0, 1"}, - {"Axis3", "30 , 4.0, 5.0,6.0, -1"}, - {"Axis5", "10 , 1.0, 0.0 , 0.0, 1 "}}; - assert_rotatesample_runs_with_mesh_shape(cuboidMeshShape, algProperties); - } -}; diff --git a/Framework/DataHandling/inc/MantidDataHandling/CreateSampleShape.h b/Framework/DataHandling/inc/MantidDataHandling/CreateSampleShape.h index 6ba0d73ad934..3522e9dd1ef1 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/CreateSampleShape.h +++ b/Framework/DataHandling/inc/MantidDataHandling/CreateSampleShape.h @@ -27,7 +27,7 @@ namespace DataHandling { */ class MANTID_DATAHANDLING_DLL CreateSampleShape final : public API::Algorithm { public: - static void setSampleShape(API::ExperimentInfo &expt, const std::string &shapeXML, bool addTypeTag = true); + static void setSampleShape(API::ExperimentInfo &expt, const std::string &shapeXML); public: const std::string name() const override { return "CreateSampleShape"; } diff --git a/Framework/DataHandling/src/CreateSampleShape.cpp b/Framework/DataHandling/src/CreateSampleShape.cpp index a99141c7ec9e..8f70f9a59679 100644 --- a/Framework/DataHandling/src/CreateSampleShape.cpp +++ b/Framework/DataHandling/src/CreateSampleShape.cpp @@ -28,10 +28,10 @@ using namespace Mantid::API; * @param shapeXML XML defining the object's shape * @param addTypeTag true to wrap a \ tag around the XML supplied(default) */ -void CreateSampleShape::setSampleShape(API::ExperimentInfo &expt, const std::string &shapeXML, bool addTypeTag) { +void CreateSampleShape::setSampleShape(API::ExperimentInfo &expt, const std::string &shapeXML) { Geometry::ShapeFactory sFactory; // Create the object - auto shape = sFactory.createShape(shapeXML, addTypeTag); + auto shape = sFactory.createShape(shapeXML); // Check it's valid and attach it to the workspace sample but preserve any // material if (shape->hasValidShape()) { diff --git a/docs/source/algorithms/RotateSampleShape-v1.rst b/docs/source/algorithms/RotateSampleShape-v1.rst deleted file mode 100644 index 794c94984bea..000000000000 --- a/docs/source/algorithms/RotateSampleShape-v1.rst +++ /dev/null @@ -1,57 +0,0 @@ - -.. algorithm:: - -.. summary:: - -.. relatedalgorithms:: - -.. properties:: - -Description ------------ - -Use this algorithm to define the initial orientation of the sample with respect -to the beam and instrument by giving the axes, angle and directions of rotations. -Enter each axis in the order of rotation, starting with the one farthest from the -sample similar to :ref:`algm-SetGoniometer` - -You may enter up to 6 axes, for each of which you must define 5 values as below separated by -commas: - -- The angle of rotation in degrees. -- The X, Y, Z components of the vector of the axis of rotation. - Right-handed coordinates with +Z=beam direction; +Y=Vertically up - (against gravity); +X to the left. -- The sense of rotation as 1 or -1: 1 for counter-clockwise, -1 for - clockwise rotation. - -The sample shape would then be rotated by the goniometer before being used in the -calculation of various attenuation corrections. This algorithm work for both CSG shapes -(e.g. cylinders, flat plates etc.) and Mesh files. - - -Usage ------ -**Example - RotateSampleShape for sample with a CSG shape** - -.. code-block:: python - - from mantid.simpleapi import * - import xml.dom.minidom as md - - ws = CreateSampleWorkspace() - SetSample(ws, - Geometry={'Shape': 'Cylinder', 'Height': 4.0, - 'Radius': 1.0, - 'Center': [0.,0.,0.]}, - Material={'ChemicalFormula': '(Li7)2-C-H4-N-Cl6', - 'NumberDensity': 0.1}) - - RotateSampleShape(Workspace=ws, Axis0="45,1,1,0,1", Axis1="15,0,0,1,-1") - - print(md.parseString(ws.sample().getShape().getShapeXML()).toprettyxml()) - -.. categories:: - -.. sourcelink:: - diff --git a/docs/source/release/v6.11.0/Diffraction/Single_Crystal/New_features/37908.rst b/docs/source/release/v6.11.0/Diffraction/Single_Crystal/New_features/37908.rst deleted file mode 100644 index 3163e2125123..000000000000 --- a/docs/source/release/v6.11.0/Diffraction/Single_Crystal/New_features/37908.rst +++ /dev/null @@ -1 +0,0 @@ -- New algorithm :ref:`RotateSampleShape ` that defines the initial orientation of a sample with respect to the beam and instrument. \ No newline at end of file From f4da56b742068259bdaa5b93aa5af79f995bf871 Mon Sep 17 00:00:00 2001 From: James Clarke <139879523+jclarkeSTFC@users.noreply.github.com> Date: Tue, 1 Oct 2024 09:43:24 +0100 Subject: [PATCH 2/2] Fix doc string Co-authored-by: thomashampson --- Framework/DataHandling/src/CreateSampleShape.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Framework/DataHandling/src/CreateSampleShape.cpp b/Framework/DataHandling/src/CreateSampleShape.cpp index 8f70f9a59679..6b575867d74c 100644 --- a/Framework/DataHandling/src/CreateSampleShape.cpp +++ b/Framework/DataHandling/src/CreateSampleShape.cpp @@ -26,7 +26,6 @@ using namespace Mantid::API; * @brief Set the shape via an XML string on the given experiment * @param expt A reference to the experiment holding the sample object * @param shapeXML XML defining the object's shape - * @param addTypeTag true to wrap a \ tag around the XML supplied(default) */ void CreateSampleShape::setSampleShape(API::ExperimentInfo &expt, const std::string &shapeXML) { Geometry::ShapeFactory sFactory;