From a4b17d4fb32fde876f9a4fdd4fdca923b077f920 Mon Sep 17 00:00:00 2001 From: Anton Piccardo-Selg <anton.piccardo-selg@tessella.com> Date: Fri, 16 Oct 2015 15:16:47 +0100 Subject: [PATCH] Refs #13872 Fix SetSpecialCoordinate algorithm --- Framework/Crystal/src/SetSpecialCoordinates.cpp | 17 ++++++++++++++--- .../Crystal/test/SetSpecialCoordinatesTest.h | 12 ++++++++---- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/Framework/Crystal/src/SetSpecialCoordinates.cpp b/Framework/Crystal/src/SetSpecialCoordinates.cpp index 399520706b6..17969673f43 100644 --- a/Framework/Crystal/src/SetSpecialCoordinates.cpp +++ b/Framework/Crystal/src/SetSpecialCoordinates.cpp @@ -4,10 +4,15 @@ #include "MantidAPI/IMDEventWorkspace.h" #include "MantidAPI/IMDHistoWorkspace.h" #include "MantidKernel/ListValidator.h" +#include "MantidKernel/Logger.h" using namespace Mantid::Kernel; using namespace Mantid::API; +namespace { +Mantid::Kernel::Logger g_log("SetSpecialCoordinates"); +} + namespace Mantid { namespace Crystal { @@ -70,7 +75,9 @@ const std::string SetSpecialCoordinates::category() const { return "Crystal"; } void SetSpecialCoordinates::init() { declareProperty( new WorkspaceProperty<Workspace>("InputWorkspace", "", Direction::InOut), - "An input/output workspace. The new log will be added to it."); + "An input/output workspace. The new log will be added to it. Improtant " + "Note: This has now only an effect on PeaksWorkspaces. MDEvent and " + "MDHisto worksapces are not affaceted by this algorithm"); declareProperty( "SpecialCoordinates", "Q (lab frame)", @@ -86,7 +93,9 @@ bool SetSpecialCoordinates::writeCoordinatesToMDEventWorkspace( Workspace_sptr inWS, SpecialCoordinateSystem coordinateSystem) { bool written = false; if (auto mdEventWS = boost::dynamic_pointer_cast<IMDEventWorkspace>(inWS)) { - mdEventWS->setCoordinateSystem(coordinateSystem); + g_log.warning("SetSpecialCoordinates: This algorithm cannot set the " + "special coordinate system for an MDEvent workspace any " + "longer."); written = true; } return written; @@ -96,7 +105,9 @@ bool SetSpecialCoordinates::writeCoordinatesToMDHistoWorkspace( Workspace_sptr inWS, SpecialCoordinateSystem coordinateSystem) { bool written = false; if (auto mdHistoWS = boost::dynamic_pointer_cast<IMDHistoWorkspace>(inWS)) { - mdHistoWS->setCoordinateSystem(coordinateSystem); + g_log.warning("SetSpecialCoordinates: This algorithm cannot set the " + "special coordinate system for an MDHisto workspace any " + "longer."); written = true; } return written; diff --git a/Framework/Crystal/test/SetSpecialCoordinatesTest.h b/Framework/Crystal/test/SetSpecialCoordinatesTest.h index c7df78605e0..23a0d46695a 100644 --- a/Framework/Crystal/test/SetSpecialCoordinatesTest.h +++ b/Framework/Crystal/test/SetSpecialCoordinatesTest.h @@ -90,8 +90,10 @@ public: auto outWS = AnalysisDataService::Instance().retrieveWS<IMDWorkspace>("inWS"); - TS_ASSERT_EQUALS(Mantid::Kernel::QSample, - outWS->getSpecialCoordinateSystem()); + TSM_ASSERT_EQUALS( + "Should still be still with the same special coordinate system", + inWS->getSpecialCoordinateSystem(), + outWS->getSpecialCoordinateSystem()); AnalysisDataService::Instance().remove("inWS"); } @@ -109,8 +111,10 @@ public: auto outWS = AnalysisDataService::Instance().retrieveWS<IMDWorkspace>("inWS"); - TS_ASSERT_EQUALS(Mantid::Kernel::QSample, - outWS->getSpecialCoordinateSystem()); + TSM_ASSERT_EQUALS( + "Should still be still with the same special coordinate system", + inWS->getSpecialCoordinateSystem(), + outWS->getSpecialCoordinateSystem()); AnalysisDataService::Instance().remove("inWS"); } -- GitLab