diff --git a/Framework/Algorithms/test/RemoveBinsTest.h b/Framework/Algorithms/test/RemoveBinsTest.h index 9f28f11328ef..2703ae10c35b 100644 --- a/Framework/Algorithms/test/RemoveBinsTest.h +++ b/Framework/Algorithms/test/RemoveBinsTest.h @@ -15,7 +15,6 @@ #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/Axis.h" #include "MantidAlgorithms/RemoveBins.h" -#include "MantidDataHandling/LoadMuonNexus2.h" #include "MantidDataObjects/Workspace2D.h" #include "MantidFrameworkTestHelpers/WorkspaceCreationHelper.h" #include "MantidHistogramData/LinearGenerator.h" diff --git a/Framework/DataHandling/CMakeLists.txt b/Framework/DataHandling/CMakeLists.txt index 2e37772e33d2..b99f4b76062a 100644 --- a/Framework/DataHandling/CMakeLists.txt +++ b/Framework/DataHandling/CMakeLists.txt @@ -90,9 +90,6 @@ set(SRC_FILES src/LoadMcStas.cpp src/LoadMcStasNexus.cpp src/LoadMuonLog.cpp - src/LoadMuonNexus.cpp - src/LoadMuonNexus1.cpp - src/LoadMuonNexus2.cpp src/LoadMuonNexusV2.cpp src/LoadMuonNexusV2NexusHelper.cpp src/LoadMuonStrategy.cpp @@ -315,9 +312,6 @@ set(INC_FILES inc/MantidDataHandling/LoadMcStas.h inc/MantidDataHandling/LoadMcStasNexus.h inc/MantidDataHandling/LoadMuonLog.h - inc/MantidDataHandling/LoadMuonNexus.h - inc/MantidDataHandling/LoadMuonNexus1.h - inc/MantidDataHandling/LoadMuonNexus2.h inc/MantidDataHandling/LoadMuonNexusV2.h inc/MantidDataHandling/LoadMuonNexusV2NexusHelper.h inc/MantidDataHandling/LoadMuonStrategy.h @@ -532,8 +526,6 @@ set(TEST_FILES LoadMcStasNexusTest.h LoadMcStasTest.h LoadMuonLogTest.h - LoadMuonNexus1Test.h - LoadMuonNexus2Test.h LoadMuonNexusV2Test.h LoadNGEMTest.h LoadNXSPETest.h diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadMuonStrategy.h b/Framework/DataHandling/inc/MantidDataHandling/LoadMuonStrategy.h index b1541e89bd67..082b4edea014 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadMuonStrategy.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadMuonStrategy.h @@ -19,7 +19,8 @@ namespace DataHandling { class LoadMuonNexusV2NexusHelper; // Create time zero table -DataObjects::TableWorkspace_sptr createTimeZeroTable(const size_t numSpec, const std::vector &timeZeros); +MANTID_DATAHANDLING_DLL DataObjects::TableWorkspace_sptr createTimeZeroTable(const size_t numSpec, + const std::vector &timeZeros); class MANTID_DATAHANDLING_DLL LoadMuonStrategy { public: diff --git a/Framework/DataHandling/src/LoadNexus.cpp b/Framework/DataHandling/src/LoadNexus.cpp index 448b8e85abb0..3c0dcfce6c3b 100644 --- a/Framework/DataHandling/src/LoadNexus.cpp +++ b/Framework/DataHandling/src/LoadNexus.cpp @@ -112,7 +112,9 @@ void LoadNexus::exec() { } void LoadNexus::runLoadMuonNexus() { - auto loadMuonNexus = createChildAlgorithm("LoadMuonNexus", 0., 1.); + // The Load algorithm will choose the correct LoadMuonNexus algorithm + auto loadMuonNexus = createChildAlgorithm("Load", 0., 1.); + // Pass through the same input filename loadMuonNexus->setPropertyValue("Filename", m_filename); // Set the workspace property diff --git a/Framework/DataHandling/test/GroupDetectors2Test.h b/Framework/DataHandling/test/GroupDetectors2Test.h index 9434e495ca89..82f6bcd77afc 100644 --- a/Framework/DataHandling/test/GroupDetectors2Test.h +++ b/Framework/DataHandling/test/GroupDetectors2Test.h @@ -17,7 +17,6 @@ #include "MantidAPI/NumericAxis.h" #include "MantidAPI/SpectraAxis.h" #include "MantidAPI/SpectrumInfo.h" -#include "MantidDataHandling/LoadMuonNexus1.h" #include "MantidDataHandling/MaskDetectors.h" #include "MantidDataObjects/ScanningWorkspaceBuilder.h" #include "MantidDataObjects/WorkspaceCreation.h" @@ -27,6 +26,7 @@ #include "MantidIndexing/IndexInfo.h" #include "MantidKernel/DateAndTime.h" #include "MantidKernel/UnitFactory.h" +#include "MantidMuon/LoadMuonNexus1.h" #include "MantidTypes/SpectrumDefinition.h" #include @@ -405,7 +405,7 @@ class GroupDetectors2Test : public CxxTest::TestSuite { } void testReadingFromXML() { - Mantid::DataHandling::LoadMuonNexus1 nxLoad; + Mantid::Algorithms::LoadMuonNexus1 nxLoad; nxLoad.initialize(); // Now set required filename and output workspace name @@ -444,7 +444,7 @@ class GroupDetectors2Test : public CxxTest::TestSuite { } void testReadingFromXMLCheckDuplicateIndex() { - Mantid::DataHandling::LoadMuonNexus1 nxLoad; + Mantid::Algorithms::LoadMuonNexus1 nxLoad; nxLoad.initialize(); // Now set required filename and output workspace name @@ -483,7 +483,7 @@ class GroupDetectors2Test : public CxxTest::TestSuite { } void testReadingFromXMLCheckDublicateIndex2() { - Mantid::DataHandling::LoadMuonNexus1 nxLoad; + Mantid::Algorithms::LoadMuonNexus1 nxLoad; nxLoad.initialize(); // Now set required filename and output workspace name diff --git a/Framework/DataHandling/test/LoadMuonNexusTest.h b/Framework/DataHandling/test/LoadMuonNexusTest.h deleted file mode 100644 index dc90ab446e6b..000000000000 --- a/Framework/DataHandling/test/LoadMuonNexusTest.h +++ /dev/null @@ -1,18 +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 - -#include "MantidDataHandling/LoadMuonNexus3.h" - -using namespace Mantid::DataHandling; - -class LoadMuonNexusTest : public CxxTest::TestSuite { -public: - void testExec() {} -}; diff --git a/Framework/DataHandling/test/LoadRawSaveNxsLoadNxsTest.h b/Framework/DataHandling/test/LoadRawSaveNxsLoadNxsTest.h index f5cdee8a73ff..77715371b64d 100644 --- a/Framework/DataHandling/test/LoadRawSaveNxsLoadNxsTest.h +++ b/Framework/DataHandling/test/LoadRawSaveNxsLoadNxsTest.h @@ -10,7 +10,6 @@ #include "MantidAPI/Axis.h" #include "MantidAPI/FrameworkManager.h" #include "MantidDataHandling/LoadInstrument.h" -#include "MantidDataHandling/LoadMuonNexus.h" #include "MantidDataHandling/LoadNexus.h" #include "MantidDataHandling/LoadNexusProcessed.h" #include "MantidDataHandling/LoadRaw3.h" diff --git a/Framework/DataHandling/test/SaveNexusProcessedTest.h b/Framework/DataHandling/test/SaveNexusProcessedTest.h index a7fad57a051f..7ebff3d26f0a 100644 --- a/Framework/DataHandling/test/SaveNexusProcessedTest.h +++ b/Framework/DataHandling/test/SaveNexusProcessedTest.h @@ -18,7 +18,6 @@ #include "MantidAPI/WorkspaceGroup.h" #include "MantidDataHandling/LoadEmptyInstrument.h" #include "MantidDataHandling/LoadInstrument.h" -#include "MantidDataHandling/LoadMuonNexus.h" #include "MantidDataHandling/LoadNexus.h" #include "MantidDataHandling/LoadRaw3.h" #include "MantidDataHandling/SaveNexusProcessed.h" diff --git a/Framework/DataHandling/test/SaveNexusTest.h b/Framework/DataHandling/test/SaveNexusTest.h index a3371c2f2abe..f29e9bdeb311 100644 --- a/Framework/DataHandling/test/SaveNexusTest.h +++ b/Framework/DataHandling/test/SaveNexusTest.h @@ -18,7 +18,6 @@ #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/FrameworkManager.h" -#include "MantidDataHandling/LoadMuonNexus.h" #include "MantidDataHandling/LoadNexus.h" #include "MantidDataHandling/SaveNexus.h" #include "MantidFrameworkTestHelpers/WorkspaceCreationHelper.h" diff --git a/Framework/Muon/CMakeLists.txt b/Framework/Muon/CMakeLists.txt index 65d21c4c7428..1553ebd03195 100644 --- a/Framework/Muon/CMakeLists.txt +++ b/Framework/Muon/CMakeLists.txt @@ -8,8 +8,11 @@ set(SRC_FILES src/CalMuonDeadTime.cpp src/CalMuonDetectorPhases.cpp src/ConvertFitFunctionForMuonTFAsymmetry.cpp - src/LoadAndApplyMuonDetectorGrouping.cpp src/EstimateMuonAsymmetryFromCounts.cpp + src/LoadAndApplyMuonDetectorGrouping.cpp + src/LoadMuonNexus.cpp + src/LoadMuonNexus1.cpp + src/LoadMuonNexus2.cpp src/MuonAlgorithmHelper.cpp src/MuonAsymmetryHelper.cpp src/MuonGroupDetectors.cpp @@ -34,8 +37,11 @@ set(INC_FILES inc/MantidMuon/CalMuonDeadTime.h inc/MantidMuon/CalMuonDetectorPhases.h inc/MantidMuon/ConvertFitFunctionForMuonTFAsymmetry.h - inc/MantidMuon/LoadAndApplyMuonDetectorGrouping.h inc/MantidMuon/EstimateMuonAsymmetryFromCounts.h + inc/MantidMuon/LoadAndApplyMuonDetectorGrouping.h + inc/MantidMuon/LoadMuonNexus.h + inc/MantidMuon/LoadMuonNexus1.h + inc/MantidMuon/LoadMuonNexus2.h inc/MantidMuon/MuonAlgorithmHelper.h inc/MantidMuon/MuonAsymmetryHelper.h inc/MantidMuon/MuonGroupDetectors.h @@ -61,6 +67,8 @@ set(TEST_FILES CalMuonDetectorPhasesTest.h ConvertFitFunctionForMuonTFAsymmetryTest.h LoadAndApplyMuonDetectorGroupingTest.h + LoadMuonNexus1Test.h + LoadMuonNexus2Test.h MuonAlgorithmHelperTest.h EstimateMuonAsymmetryFromCountsTest.h MuonGroupDetectorsTest.h @@ -104,7 +112,7 @@ set_property(TARGET Muon PROPERTY FOLDER "MantidFramework") target_link_libraries( Muon PUBLIC Mantid::API Mantid::Kernel Mantid::Geometry - PRIVATE Mantid::DataObjects Mantid::Indexing + PRIVATE Mantid::DataHandling Mantid::DataObjects Mantid::Indexing Mantid::Nexus ) # Add the unit tests directory add_subdirectory(test) diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadMuonNexus.h b/Framework/Muon/inc/MantidMuon/LoadMuonNexus.h similarity index 95% rename from Framework/DataHandling/inc/MantidDataHandling/LoadMuonNexus.h rename to Framework/Muon/inc/MantidMuon/LoadMuonNexus.h index 13d93f2c84d2..ab62f49de841 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadMuonNexus.h +++ b/Framework/Muon/inc/MantidMuon/LoadMuonNexus.h @@ -10,9 +10,9 @@ // Includes //---------------------------------------------------------------------- #include "MantidAPI/IFileLoader.h" -#include "MantidDataHandling/DllConfig.h" #include "MantidDataObjects/Workspace2D.h" #include "MantidKernel/NexusDescriptor.h" +#include "MantidMuon/DllConfig.h" //---------------------------------------------------------------------- // Forward declaration @@ -20,7 +20,7 @@ class MuonNexusReader; namespace Mantid { -namespace DataHandling { +namespace Algorithms { /** @class LoadMuonNexus LoadMuonNexus.h DataHandling/LoadMuonNexus.h It is a base class for loaders for versions 1 and 2 of the muon nexus file @@ -47,7 +47,7 @@ multiperiod file) together based on the groupings in the NeXus file. */ -class MANTID_DATAHANDLING_DLL LoadMuonNexus : public API::IFileLoader { +class MANTID_MUON_DLL LoadMuonNexus : public API::IFileLoader { public: /// Default constructor LoadMuonNexus(); @@ -109,5 +109,5 @@ class MANTID_DATAHANDLING_DLL LoadMuonNexus : public API::IFileLoader */ -class MANTID_DATAHANDLING_DLL LoadMuonNexus1 : public LoadMuonNexus { +class MANTID_MUON_DLL LoadMuonNexus1 : public LoadMuonNexus { public: - /// Default constructor LoadMuonNexus1(); - /// Algorithm's name for identification overriding a virtual method - const std::string name() const override { return "LoadMuonNexus"; } - /// Summary of algorithms purpose - const std::string summary() const override { - return "The LoadMuonNexus algorithm will read the given NeXus Muon data " - "file Version 1 and use the results to populate the named " - "workspace. LoadMuonNexus may be invoked by LoadNexus if it is " - "given a NeXus file of this type."; - } - - /// Algorithm's version for identification overriding a virtual method - int version() const override { return 1; } - /// Algorithm's category for identification overriding a virtual method - const std::string category() const override { return "DataHandling\\Nexus;Muon\\DataHandling"; } /// Returns a confidence value that this algorithm can load a file int confidence(Kernel::NexusDescriptor &descriptor) const override; @@ -79,7 +65,7 @@ class MANTID_DATAHANDLING_DLL LoadMuonNexus1 : public LoadMuonNexus { void exec() override; private: - void loadData(size_t hist, specnum_t &i, specnum_t specNo, MuonNexusReader &nxload, const int64_t lengthIn, + void loadData(size_t hist, specnum_t const &i, specnum_t specNo, MuonNexusReader &nxload, const int64_t lengthIn, const DataObjects::Workspace2D_sptr &localWorkspace); void runLoadMappingTable(DataObjects::Workspace2D_sptr); void runLoadLog(const DataObjects::Workspace2D_sptr &); @@ -91,15 +77,17 @@ class MANTID_DATAHANDLING_DLL LoadMuonNexus1 : public LoadMuonNexus { void loadDeadTimes(Mantid::NeXus::NXRoot &root); /// Creates Dead Time Table using all the data between begin and end - DataObjects::TableWorkspace_sptr createDeadTimeTable(std::vector specToLoad, std::vector deadTimes); + DataObjects::TableWorkspace_sptr createDeadTimeTable(std::vector const &specToLoad, + std::vector const &deadTimes); /// Loads detector grouping information API::Workspace_sptr loadDetectorGrouping(Mantid::NeXus::NXRoot &root, const Mantid::Geometry::Instrument_const_sptr &inst); /// Creates Detector Grouping Table using all the data from the range - DataObjects::TableWorkspace_sptr createDetectorGroupingTable(std::vector specToLoad, std::vector grouping); + DataObjects::TableWorkspace_sptr createDetectorGroupingTable(std::vector const &specToLoad, + std::vector const &grouping); }; -} // namespace DataHandling +} // namespace Algorithms } // namespace Mantid diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadMuonNexus2.h b/Framework/Muon/inc/MantidMuon/LoadMuonNexus2.h similarity index 68% rename from Framework/DataHandling/inc/MantidDataHandling/LoadMuonNexus2.h rename to Framework/Muon/inc/MantidMuon/LoadMuonNexus2.h index 48edcddc4a24..a0d7644f649a 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadMuonNexus2.h +++ b/Framework/Muon/inc/MantidMuon/LoadMuonNexus2.h @@ -9,13 +9,13 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidDataHandling/DllConfig.h" -#include "MantidDataHandling/LoadMuonNexus.h" +#include "MantidMuon/DllConfig.h" +#include "MantidMuon/LoadMuonNexus.h" #include "MantidNexus/NexusClasses.h" namespace Mantid { -namespace DataHandling { +namespace Algorithms { /** Loads an file in NeXus Muon format version 1 and 2 and stores it in a 2D @@ -44,34 +44,18 @@ multiperiod file) together based on the groupings in the NeXus file. */ -class MANTID_DATAHANDLING_DLL LoadMuonNexus2 : public LoadMuonNexus { +class MANTID_MUON_DLL LoadMuonNexus2 : public LoadMuonNexus { public: - /// Default constructor LoadMuonNexus2(); - /// Algorithm's name for identification overriding a virtual method - const std::string name() const override { return "LoadMuonNexus"; } - /// Summary of algorithms purpose - const std::string summary() const override { - return "The LoadMuonNexus algorithm will read the given NeXus Muon data " - "file Version 2 and use the results to populate the named " - "workspace. LoadMuonNexus may be invoked by LoadNexus if it is " - "given a NeXus file of this type."; - } - /// Algorithm's version for identification overriding a virtual method int version() const override { return 2; } const std::vector seeAlso() const override { return {"LoadNexus"}; } - /// Algorithm's category for identification overriding a virtual method - const std::string category() const override { return "DataHandling\\Nexus;Muon\\DataHandling"; } /// Returns a confidence value that this algorithm can load a file int confidence(Kernel::NexusDescriptor &descriptor) const override; private: - /// Overwrites Algorithm method void exec() override; - /// Execute this version of the algorithm - void doExec(); HistogramData::Histogram loadData(const Mantid::HistogramData::BinEdges &edges, const Mantid::NeXus::NXInt &counts, int period, int spec); @@ -80,5 +64,5 @@ class MANTID_DATAHANDLING_DLL LoadMuonNexus2 : public LoadMuonNexus { std::map> loadDetectorMapping(const Mantid::NeXus::NXInt &spectrumIndex); }; -} // namespace DataHandling +} // namespace Algorithms } // namespace Mantid diff --git a/Framework/DataHandling/src/LoadMuonNexus.cpp b/Framework/Muon/src/LoadMuonNexus.cpp similarity index 98% rename from Framework/DataHandling/src/LoadMuonNexus.cpp rename to Framework/Muon/src/LoadMuonNexus.cpp index 46f793f75bb2..04cdc666cb6a 100644 --- a/Framework/DataHandling/src/LoadMuonNexus.cpp +++ b/Framework/Muon/src/LoadMuonNexus.cpp @@ -7,7 +7,7 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidDataHandling/LoadMuonNexus.h" +#include "MantidMuon/LoadMuonNexus.h" #include "MantidAPI/FileProperty.h" #include "MantidAPI/Progress.h" #include "MantidAPI/TableRow.h" @@ -33,7 +33,7 @@ #include // clang-format on -namespace Mantid::DataHandling { +namespace Mantid::Algorithms { using namespace Kernel; using namespace API; @@ -214,4 +214,4 @@ void LoadMuonNexus::addToSampleLog(const std::string &logName, const std::string alg->setProperty("LogText", logString); alg->executeAsChildAlg(); } -} // namespace Mantid::DataHandling +} // namespace Mantid::Algorithms diff --git a/Framework/DataHandling/src/LoadMuonNexus1.cpp b/Framework/Muon/src/LoadMuonNexus1.cpp similarity index 98% rename from Framework/DataHandling/src/LoadMuonNexus1.cpp rename to Framework/Muon/src/LoadMuonNexus1.cpp index 95310b0e4603..8642df7c120d 100644 --- a/Framework/DataHandling/src/LoadMuonNexus1.cpp +++ b/Framework/Muon/src/LoadMuonNexus1.cpp @@ -4,13 +4,14 @@ // 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 "MantidDataHandling/LoadMuonNexus1.h" +#include "MantidMuon/LoadMuonNexus1.h" #include "MantidAPI/Axis.h" #include "MantidAPI/FileProperty.h" #include "MantidAPI/GroupingLoader.h" #include "MantidAPI/Progress.h" #include "MantidAPI/RegisterFileLoader.h" +#include "MantidAPI/Run.h" #include "MantidAPI/SpectrumDetectorMapping.h" #include "MantidAPI/TableRow.h" #include "MantidAPI/WorkspaceFactory.h" @@ -45,7 +46,8 @@ #include #include -namespace Mantid::DataHandling { +namespace Mantid::Algorithms { +using namespace DataHandling; using namespace DataObjects; // Register the algorithm into the algorithm factory @@ -516,7 +518,7 @@ Workspace_sptr LoadMuonNexus1::loadDetectorGrouping(NXRoot &root, const Geometry [&groupingData](const auto spec) { return groupingData[spec - 1]; }); } else { // User selected an entry number - for (auto &spec : specToLoad) { + for (auto const &spec : specToLoad) { int index = spec - 1 + static_cast((m_entrynumber - 1) * m_numberOfSpectra); grouping.emplace_back(groupingData[index]); } @@ -548,7 +550,7 @@ Workspace_sptr LoadMuonNexus1::loadDetectorGrouping(NXRoot &root, const Geometry // Get the grouping grouping.clear(); - for (auto &spec : specToLoad) { + for (auto const &spec : specToLoad) { int index = spec - 1 + i * static_cast(m_numberOfSpectra); grouping.emplace_back(groupingData[index]); } @@ -601,7 +603,8 @@ Workspace_sptr LoadMuonNexus1::loadDetectorGrouping(NXRoot &root, const Geometry * @param deadTimes :: vector containing the corresponding dead times * @return Dead Time Table create using the data */ -TableWorkspace_sptr LoadMuonNexus1::createDeadTimeTable(std::vector specToLoad, std::vector deadTimes) { +TableWorkspace_sptr LoadMuonNexus1::createDeadTimeTable(std::vector const &specToLoad, + std::vector const &deadTimes) { TableWorkspace_sptr deadTimeTable = std::dynamic_pointer_cast(WorkspaceFactory::Instance().createTable("TableWorkspace")); @@ -623,8 +626,8 @@ TableWorkspace_sptr LoadMuonNexus1::createDeadTimeTable(std::vector specToL * @param grouping :: Vector containing corresponding grouping * @return Detector Grouping Table create using the data */ -TableWorkspace_sptr LoadMuonNexus1::createDetectorGroupingTable(std::vector specToLoad, - std::vector grouping) { +TableWorkspace_sptr LoadMuonNexus1::createDetectorGroupingTable(std::vector const &specToLoad, + std::vector const &grouping) { auto detectorGroupingTable = std::dynamic_pointer_cast(WorkspaceFactory::Instance().createTable("TableWorkspace")); @@ -638,7 +641,7 @@ TableWorkspace_sptr LoadMuonNexus1::createDetectorGroupingTable(std::vector groupingMap[grouping[i]].emplace_back(specToLoad[i]); } - for (auto &group : groupingMap) { + for (auto const &group : groupingMap) { if (group.first != 0) // Skip 0 group { TableRow newRow = detectorGroupingTable->appendRow(); @@ -658,7 +661,7 @@ TableWorkspace_sptr LoadMuonNexus1::createDetectorGroupingTable(std::vector * @param localWorkspace :: A pointer to the workspace in which the data will * be stored */ -void LoadMuonNexus1::loadData(size_t hist, specnum_t &i, specnum_t specNo, MuonNexusReader &nxload, +void LoadMuonNexus1::loadData(size_t hist, specnum_t const &i, specnum_t specNo, MuonNexusReader &nxload, const int64_t lengthIn, const DataObjects::Workspace2D_sptr &localWorkspace) { // Read in a spectrum // Put it into a vector, discarding the 1st entry, which is rubbish @@ -917,4 +920,4 @@ int LoadMuonNexus1::confidence(Kernel::NexusDescriptor &descriptor) const { return 0; } -} // namespace Mantid::DataHandling +} // namespace Mantid::Algorithms diff --git a/Framework/DataHandling/src/LoadMuonNexus2.cpp b/Framework/Muon/src/LoadMuonNexus2.cpp similarity index 88% rename from Framework/DataHandling/src/LoadMuonNexus2.cpp rename to Framework/Muon/src/LoadMuonNexus2.cpp index 2f8801ea3a4c..7a886b5826d7 100644 --- a/Framework/DataHandling/src/LoadMuonNexus2.cpp +++ b/Framework/Muon/src/LoadMuonNexus2.cpp @@ -4,7 +4,7 @@ // 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 "MantidDataHandling/LoadMuonNexus2.h" +#include "MantidMuon/LoadMuonNexus2.h" #include "MantidAPI/Axis.h" #include "MantidAPI/FileProperty.h" #include "MantidAPI/Progress.h" @@ -12,8 +12,6 @@ #include "MantidAPI/Run.h" #include "MantidAPI/WorkspaceFactory.h" #include "MantidAPI/WorkspaceGroup.h" -#include "MantidDataHandling/LoadMuonNexus1.h" -#include "MantidDataHandling/LoadMuonNexusV2.h" #include "MantidDataObjects/Workspace2D.h" #include "MantidGeometry/Instrument/Detector.h" #include "MantidKernel/ArrayProperty.h" @@ -23,6 +21,7 @@ #include "MantidKernel/Unit.h" #include "MantidKernel/UnitFactory.h" #include "MantidKernel/UnitLabelTypes.h" +#include "MantidMuon/LoadMuonNexus1.h" #include "MantidNexus/NexusClasses.h" #include #include @@ -36,7 +35,7 @@ using Mantid::Types::Core::DateAndTime; -namespace Mantid::DataHandling { +namespace Mantid::Algorithms { // Register the algorithm into the algorithm factory DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadMuonNexus2) @@ -50,12 +49,6 @@ using Mantid::HistogramData::Histogram; using namespace Mantid::NeXus; using Mantid::Types::Core::DateAndTime; -namespace { -inline std::string getLoadAlgName(int confidence1, int confidenceV2) { - return confidence1 > confidenceV2 ? "LoadMuonNexus" : "LoadMuonNexusV2"; -} -} // namespace - /// Empty default constructor LoadMuonNexus2::LoadMuonNexus2() : LoadMuonNexus() {} @@ -65,50 +58,6 @@ LoadMuonNexus2::LoadMuonNexus2() : LoadMuonNexus() {} *values */ void LoadMuonNexus2::exec() { - LoadMuonNexus1 load1; - LoadMuonNexusV2 loadV2; - load1.initialize(); - loadV2.initialize(); - - std::string filePath = getPropertyValue("Filename"); - Kernel::NexusDescriptor descriptor(filePath); - int confidence1 = load1.confidence(descriptor); - int confidence2 = this->confidence(descriptor); - int confidenceV2 = 0; - // If the file is hdf5 then we can possibly use LoadMuonNexusV2 - // To check this we'll have to create an HDF5 descriptor for the file. - if (Kernel::NexusDescriptor::isReadable(filePath, Kernel::NexusDescriptor::Version5)) { - Kernel::NexusHDF5Descriptor descriptorHDF5(filePath); - confidenceV2 = loadV2.confidence(descriptorHDF5); - }; - - // if none can load the file throw - if (confidence1 < 80 && confidence2 < 80 && confidenceV2 < 80) { - throw Kernel::Exception::FileError("Cannot open the file ", filePath); - } - // Now pick the correct alg - if (confidence2 > std::max(confidence1, confidenceV2)) { - // Use this loader - doExec(); - } else { - // Version 1 or V2 - auto childAlg = createChildAlgorithm(getLoadAlgName(confidence1, confidenceV2), 0, 1, true, 1); - auto loader = std::dynamic_pointer_cast(childAlg); - loader->copyPropertiesFrom(*this); - loader->executeAsChildAlg(); - this->copyPropertiesFrom(*loader); - API::Workspace_sptr outWS = loader->getProperty("OutputWorkspace"); - setProperty("OutputWorkspace", outWS); - } -} - -/** Read in a muon nexus file of the version 2. - * - * @throw Exception::FileError If the Nexus file cannot be found/opened - * @throw std::invalid_argument If the optional properties are set to invalid - *values - */ -void LoadMuonNexus2::doExec() { // Create the root Nexus class NXRoot root(getPropertyValue("Filename")); @@ -145,7 +94,7 @@ void LoadMuonNexus2::doExec() { std::string detectorName; // Only the first NXdata found - for (auto &group : entry.groups()) { + for (auto const &group : entry.groups()) { std::string className = group.nxclass; if (className == "NXdata") { detectorName = group.nxname; @@ -483,7 +432,7 @@ std::map> LoadMuonNexus2::loadDetectorMapping(const Mantid::N NXEntry entry = root.openEntry(m_entry_name); const std::string detectorName = [&entry]() { // Only the first NXdata found - for (auto &group : entry.groups()) { + for (auto const &group : entry.groups()) { std::string className = group.nxclass; if (className == "NXdata") { return group.nxname; @@ -530,4 +479,4 @@ std::map> LoadMuonNexus2::loadDetectorMapping(const Mantid::N return mapping; } -} // namespace Mantid::DataHandling +} // namespace Mantid::Algorithms diff --git a/Framework/Muon/test/AlphaCalcTest.h b/Framework/Muon/test/AlphaCalcTest.h index 80ef047dde98..c03475c92dd7 100644 --- a/Framework/Muon/test/AlphaCalcTest.h +++ b/Framework/Muon/test/AlphaCalcTest.h @@ -12,8 +12,8 @@ #include "MantidAPI/IAlgorithm.h" #include "MantidAPI/Workspace.h" #include "MantidDataHandling/GroupDetectors.h" +#include "MantidDataHandling/Load.h" #include "MantidDataHandling/LoadInstrument.h" -#include "MantidDataHandling/LoadMuonNexus2.h" #include "MantidDataObjects/Workspace2D.h" #include "MantidMuon/AlphaCalc.h" #include @@ -33,15 +33,9 @@ class AlphaCalcTest : public CxxTest::TestSuite { } void testCalAlphaManySpectra() { - // system("pause"); - // Load the muon nexus file - loader.initialize(); - loader.setPropertyValue("Filename", "emu00006473.nxs"); - loader.setPropertyValue("OutputWorkspace", "EMU6473"); - TS_ASSERT_THROWS_NOTHING(loader.execute()); - TS_ASSERT_EQUALS(loader.isExecuted(), true); + auto const workspace = loadFile("emu00006473.nxs"); - alphaCalc.setPropertyValue("InputWorkspace", "EMU6473"); + alphaCalc.setProperty("InputWorkspace", workspace); alphaCalc.setPropertyValue("ForwardSpectra", "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16"); alphaCalc.setPropertyValue("BackwardSpectra", "17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32"); alphaCalc.setPropertyValue("FirstGoodValue", "0.3"); @@ -56,14 +50,9 @@ class AlphaCalcTest : public CxxTest::TestSuite { } void testCalAlphaTwoSpectra() { - // Load the muon nexus file - loader.initialize(); - loader.setPropertyValue("Filename", "emu00006473.nxs"); - loader.setPropertyValue("OutputWorkspace", "EMU6473"); - TS_ASSERT_THROWS_NOTHING(loader.execute()); - TS_ASSERT_EQUALS(loader.isExecuted(), true); + auto const workspace = loadFile("emu00006473.nxs"); - alphaCalc.setPropertyValue("InputWorkspace", "EMU6473"); + alphaCalc.setProperty("InputWorkspace", workspace); alphaCalc.setPropertyValue("ForwardSpectra", "1"); alphaCalc.setPropertyValue("BackwardSpectra", "17"); alphaCalc.setPropertyValue("FirstGoodValue", "0.3"); @@ -92,6 +81,21 @@ class AlphaCalcTest : public CxxTest::TestSuite { void test_incorrect_spectra_numbers() {} private: + MatrixWorkspace_sptr loadFile(std::string const &filename) { + Mantid::DataHandling::Load loader; + loader.initialize(); + loader.setChild(true); + loader.setPropertyValue("Filename", filename); + + TS_ASSERT_THROWS_NOTHING(loader.execute()); + TS_ASSERT_EQUALS(loader.isExecuted(), true); + + TS_ASSERT_EQUALS("LoadMuonNexus", loader.getPropertyValue("LoaderName")); + TS_ASSERT_EQUALS("1", loader.getPropertyValue("LoaderVersion")); + + Workspace_sptr outWS = loader.getProperty("OutputWorkspace"); + return std::dynamic_pointer_cast(outWS); + } + AlphaCalc alphaCalc; - Mantid::DataHandling::LoadMuonNexus2 loader; }; diff --git a/Framework/Muon/test/ApplyDeadTimeCorrTest.h b/Framework/Muon/test/ApplyDeadTimeCorrTest.h index 02bcf0b9e3f2..69018f2ce54c 100644 --- a/Framework/Muon/test/ApplyDeadTimeCorrTest.h +++ b/Framework/Muon/test/ApplyDeadTimeCorrTest.h @@ -12,7 +12,7 @@ #include "MantidAPI/IAlgorithm.h" #include "MantidAPI/TableRow.h" #include "MantidAPI/Workspace.h" -#include "MantidDataHandling/LoadMuonNexus2.h" +#include "MantidDataHandling/Load.h" #include "MantidDataObjects/TableWorkspace.h" #include "MantidDataObjects/Workspace2D.h" #include "MantidFrameworkTestHelpers/WorkspaceCreationHelper.h" @@ -42,7 +42,7 @@ class ApplyDeadTimeCorrTest : public CxxTest::TestSuite { } void testExec() { - MatrixWorkspace_sptr inputWs = loadDataFromFile(); + auto const inputWs = loadFile("emu00006473.nxs"); auto deadTimes = makeDeadTimeTable(32); ApplyDeadTimeCorr applyDeadTime; @@ -80,7 +80,7 @@ class ApplyDeadTimeCorrTest : public CxxTest::TestSuite { } void testDifferentSize() { - MatrixWorkspace_sptr inputWs = loadDataFromFile(); + auto const inputWs = loadFile("emu00006473.nxs"); // Bigger row count than file (expect to fail) auto deadTimes = makeDeadTimeTable(64); @@ -99,7 +99,7 @@ class ApplyDeadTimeCorrTest : public CxxTest::TestSuite { } void testSelectedSpectrum() { - MatrixWorkspace_sptr inputWs = loadDataFromFile(); + auto const inputWs = loadFile("emu00006473.nxs"); std::shared_ptr deadTimes = std::make_shared(); deadTimes->addColumn("int", "Spectrum Number"); @@ -173,7 +173,7 @@ class ApplyDeadTimeCorrTest : public CxxTest::TestSuite { // Test that algorithm throws if input workspace does not contain number of // good frames void testNoGoodfrmPresent() { - MatrixWorkspace_sptr inputWs = loadDataFromFile(); + auto const inputWs = loadFile("emu00006473.nxs"); auto deadTimes = makeDeadTimeTable(32); auto &run = inputWs->mutableRun(); @@ -207,22 +207,20 @@ class ApplyDeadTimeCorrTest : public CxxTest::TestSuite { return deadTimes; } - /** - * Loads data from the test data file - * @returns :: Workspace with loaded data - */ - MatrixWorkspace_sptr loadDataFromFile() { - Mantid::DataHandling::LoadMuonNexus2 loader; + MatrixWorkspace_sptr loadFile(std::string const &filename) { + Mantid::DataHandling::Load loader; loader.initialize(); loader.setChild(true); - loader.setPropertyValue("Filename", "emu00006473.nxs"); - loader.setPropertyValue("OutputWorkspace", "__NotUsed"); + loader.setPropertyValue("Filename", filename); + TS_ASSERT_THROWS_NOTHING(loader.execute()); TS_ASSERT_EQUALS(loader.isExecuted(), true); - Workspace_sptr data = loader.getProperty("OutputWorkspace"); - auto matrixWS = std::dynamic_pointer_cast(data); - TS_ASSERT(data); - return matrixWS; + + TS_ASSERT_EQUALS("LoadMuonNexus", loader.getPropertyValue("LoaderName")); + TS_ASSERT_EQUALS("1", loader.getPropertyValue("LoaderVersion")); + + Workspace_sptr outWS = loader.getProperty("OutputWorkspace"); + return std::dynamic_pointer_cast(outWS); } /// Test dead time value diff --git a/Framework/Muon/test/ApplyMuonDetectorGroupPairingTest.h b/Framework/Muon/test/ApplyMuonDetectorGroupPairingTest.h index 76bf2ce7c594..d00d1378a236 100644 --- a/Framework/Muon/test/ApplyMuonDetectorGroupPairingTest.h +++ b/Framework/Muon/test/ApplyMuonDetectorGroupPairingTest.h @@ -15,7 +15,6 @@ #include "MantidAPI/Workspace.h" #include "MantidAPI/WorkspaceGroup.h" #include "MantidAlgorithms/CompareWorkspaces.h" -#include "MantidDataHandling/LoadMuonNexus2.h" #include "MantidDataObjects/TableWorkspace.h" #include "MantidKernel/PhysicalConstants.h" diff --git a/Framework/Muon/test/AsymmetryCalcTest.h b/Framework/Muon/test/AsymmetryCalcTest.h index bc39a805d56b..5830fa1a2688 100644 --- a/Framework/Muon/test/AsymmetryCalcTest.h +++ b/Framework/Muon/test/AsymmetryCalcTest.h @@ -14,8 +14,8 @@ #include "MantidAPI/Workspace.h" #include "MantidAPI/WorkspaceGroup.h" #include "MantidDataHandling/GroupDetectors.h" +#include "MantidDataHandling/Load.h" #include "MantidDataHandling/LoadInstrument.h" -#include "MantidDataHandling/LoadMuonNexus2.h" #include "MantidDataObjects/Workspace2D.h" #include "MantidMuon/AsymmetryCalc.h" #include @@ -58,15 +58,12 @@ class AsymmetryCalcTest : public CxxTest::TestSuite { } void testExecuteOnDataFile() { - MatrixWorkspace_sptr data; - TS_ASSERT_THROWS_NOTHING(data = loadDataFile()); - TS_ASSERT(data); + auto const workspace = loadFile("emu00006473.nxs"); AsymmetryCalc asymCalc; try { asymCalc.initialize(); asymCalc.setChild(true); - asymCalc.setProperty("InputWorkspace", data); - asymCalc.setPropertyValue("OutputWorkspace", "__Unused"); + asymCalc.setProperty("InputWorkspace", workspace); asymCalc.setPropertyValue("Alpha", "1.0"); asymCalc.setPropertyValue("ForwardSpectra", "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16"); asymCalc.setPropertyValue("BackwardSpectra", "17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32"); @@ -166,24 +163,19 @@ class AsymmetryCalcTest : public CxxTest::TestSuite { } private: - /// Load data from file - MatrixWorkspace_sptr loadDataFile() { - Mantid::DataHandling::LoadMuonNexus2 loader; + MatrixWorkspace_sptr loadFile(std::string const &filename) { + Mantid::DataHandling::Load loader; loader.initialize(); loader.setChild(true); - loader.setPropertyValue("Filename", "emu00006473.nxs"); - loader.setPropertyValue("OutputWorkspace", "__Unused"); - loader.execute(); - if (loader.isExecuted()) { - Workspace_sptr outWS = loader.getProperty("OutputWorkspace"); - auto matrixWS = std::dynamic_pointer_cast(outWS); - if (matrixWS) { - return matrixWS; - } else { - throw std::runtime_error("Failed to cast loaded workspace"); - } - } else { - throw std::runtime_error("Failed to load test data file"); - } + loader.setPropertyValue("Filename", filename); + + TS_ASSERT_THROWS_NOTHING(loader.execute()); + TS_ASSERT_EQUALS(loader.isExecuted(), true); + + TS_ASSERT_EQUALS("LoadMuonNexus", loader.getPropertyValue("LoaderName")); + TS_ASSERT_EQUALS("1", loader.getPropertyValue("LoaderVersion")); + + Workspace_sptr outWS = loader.getProperty("OutputWorkspace"); + return std::dynamic_pointer_cast(outWS); } }; diff --git a/Framework/Muon/test/CalMuonDeadTimeTest.h b/Framework/Muon/test/CalMuonDeadTimeTest.h index f707bf92e143..4940832c277e 100644 --- a/Framework/Muon/test/CalMuonDeadTimeTest.h +++ b/Framework/Muon/test/CalMuonDeadTimeTest.h @@ -13,10 +13,10 @@ #include "MantidAPI/IAlgorithm.h" #include "MantidAPI/Run.h" #include "MantidAPI/Workspace.h" -#include "MantidDataHandling/LoadMuonNexus1.h" #include "MantidDataObjects/TableWorkspace.h" #include "MantidDataObjects/Workspace2D.h" #include "MantidMuon/CalMuonDeadTime.h" +#include "MantidMuon/LoadMuonNexus1.h" #include using namespace Mantid::Algorithms; @@ -93,7 +93,7 @@ class CalMuonDeadTimeTest : public CxxTest::TestSuite { private: // Load the muon nexus file MatrixWorkspace_sptr loadData() { - Mantid::DataHandling::LoadMuonNexus1 loader; + Mantid::Algorithms::LoadMuonNexus1 loader; loader.initialize(); loader.setChild(true); loader.setPropertyValue("Filename", "emu00006473.nxs"); diff --git a/Framework/DataHandling/test/LoadMuonNexus1Test.h b/Framework/Muon/test/LoadMuonNexus1Test.h similarity index 99% rename from Framework/DataHandling/test/LoadMuonNexus1Test.h rename to Framework/Muon/test/LoadMuonNexus1Test.h index 6a360ffa5f7a..32de4f2805e8 100644 --- a/Framework/DataHandling/test/LoadMuonNexus1Test.h +++ b/Framework/Muon/test/LoadMuonNexus1Test.h @@ -9,8 +9,8 @@ // These includes seem to make the difference between initialization of the // workspace names (workspace2D/1D etc), instrument classes and not for this // test case. -#include "MantidDataHandling/LoadInstrument.h" #include "MantidDataObjects/TableWorkspace.h" +#include "MantidDataObjects/Workspace2D.h" #include "MantidDataObjects/WorkspaceSingleValue.h" #include @@ -24,16 +24,16 @@ #include "MantidAPI/Sample.h" #include "MantidAPI/ScopedWorkspace.h" #include "MantidAPI/WorkspaceGroup.h" -#include "MantidDataHandling/LoadMuonNexus1.h" #include "MantidKernel/ConfigService.h" #include "MantidKernel/TimeSeriesProperty.h" #include "MantidKernel/Unit.h" +#include "MantidMuon/LoadMuonNexus1.h" #include using namespace Mantid::API; +using namespace Mantid::Algorithms; using namespace Mantid::Kernel; -using namespace Mantid::DataHandling; using namespace Mantid::DataObjects; class LoadMuonNexus1Test : public CxxTest::TestSuite { diff --git a/Framework/DataHandling/test/LoadMuonNexus2Test.h b/Framework/Muon/test/LoadMuonNexus2Test.h similarity index 99% rename from Framework/DataHandling/test/LoadMuonNexus2Test.h rename to Framework/Muon/test/LoadMuonNexus2Test.h index b7cb15f41c88..b14a26a42b20 100644 --- a/Framework/DataHandling/test/LoadMuonNexus2Test.h +++ b/Framework/Muon/test/LoadMuonNexus2Test.h @@ -9,7 +9,6 @@ // These includes seem to make the difference between initialization of the // workspace names (workspace2D/1D etc), instrument classes and not for this // test case. -#include "MantidDataHandling/LoadInstrument.h" #include "MantidDataObjects/WorkspaceSingleValue.h" #include @@ -19,14 +18,14 @@ #include "MantidAPI/Axis.h" #include "MantidAPI/FrameworkManager.h" #include "MantidAPI/Run.h" -#include "MantidDataHandling/LoadMuonNexus2.h" #include "MantidKernel/ConfigService.h" #include "MantidKernel/TimeSeriesProperty.h" #include "MantidKernel/Unit.h" +#include "MantidMuon/LoadMuonNexus2.h" using namespace Mantid::API; +using namespace Mantid::Algorithms; using namespace Mantid::Kernel; -using namespace Mantid::DataHandling; using namespace Mantid::DataObjects; using Mantid::detid_t; using Mantid::Types::Core::DateAndTime; diff --git a/Framework/Muon/test/PlotAsymmetryByLogValueTest.h b/Framework/Muon/test/PlotAsymmetryByLogValueTest.h index 1cb931066fe3..1f6be1b126c7 100644 --- a/Framework/Muon/test/PlotAsymmetryByLogValueTest.h +++ b/Framework/Muon/test/PlotAsymmetryByLogValueTest.h @@ -13,7 +13,6 @@ #include "MantidAPI/TextAxis.h" #include "MantidAPI/WorkspaceFactory.h" #include "MantidDataHandling/LoadInstrument.h" -#include "MantidDataHandling/LoadMuonNexus.h" #include "MantidDataHandling/SaveNexus.h" #include "MantidDataObjects/Workspace2D.h" #include "MantidMuon/PlotAsymmetryByLogValue.h" diff --git a/Framework/WorkflowAlgorithms/test/MuonProcessTest.h b/Framework/WorkflowAlgorithms/test/MuonProcessTest.h index 072a562a8770..c305d70f6ddb 100644 --- a/Framework/WorkflowAlgorithms/test/MuonProcessTest.h +++ b/Framework/WorkflowAlgorithms/test/MuonProcessTest.h @@ -8,14 +8,14 @@ #include +#include "MantidAPI/MatrixWorkspace.h" #include "MantidAPI/ScopedWorkspace.h" #include "MantidAPI/TableRow.h" -#include "MantidDataHandling/LoadMuonNexus2.h" +#include "MantidDataHandling/Load.h" #include "MantidDataObjects/TableWorkspace.h" #include "MantidWorkflowAlgorithms/MuonProcess.h" -using Mantid::DataHandling::LoadMuonNexus2; using Mantid::WorkflowAlgorithms::MuonProcess; using namespace Mantid::Kernel; @@ -555,11 +555,10 @@ class MuonProcessTest : public CxxTest::TestSuite { */ std::unique_ptr loadData(const std::string &filename) { auto data = std::make_unique(); - LoadMuonNexus2 load; + Mantid::DataHandling::Load load; load.initialize(); load.setChild(true); load.setPropertyValue("Filename", filename); - load.setPropertyValue("OutputWorkspace", "__notused"); load.setPropertyValue("DetectorGroupingTable", "__notused"); load.execute(); data->workspace = load.getProperty("OutputWorkspace"); diff --git a/Testing/SystemTests/tests/framework/ISISMuonAnalysis.py b/Testing/SystemTests/tests/framework/ISISMuonAnalysis.py index ff370ae98f05..d017cba06ea1 100644 --- a/Testing/SystemTests/tests/framework/ISISMuonAnalysis.py +++ b/Testing/SystemTests/tests/framework/ISISMuonAnalysis.py @@ -8,7 +8,7 @@ import math import systemtesting from mantid.api import mtd -from mantid.simpleapi import AsymmetryCalc, CloneWorkspace, CropWorkspace, GroupDetectors, GroupWorkspaces, LoadMuonNexus, Rebin +from mantid.simpleapi import AsymmetryCalc, CloneWorkspace, CropWorkspace, GroupDetectors, GroupWorkspaces, Load, Rebin from abc import ABCMeta, abstractmethod @@ -51,7 +51,7 @@ def runTest(self): outputWS = self.instr_name + str(self.sample_run) # Load - LoadMuonNexus(Filename=self.file_name, OutputWorkspace="MuonAnalysis") + Load(Filename=self.file_name, OutputWorkspace="MuonAnalysis") # Group, Crop, Clone if self.period_data: diff --git a/Testing/SystemTests/tests/framework/ISISMuonAnalysisGrouping.py b/Testing/SystemTests/tests/framework/ISISMuonAnalysisGrouping.py index 3fde45c082e1..7e613c4f2eef 100644 --- a/Testing/SystemTests/tests/framework/ISISMuonAnalysisGrouping.py +++ b/Testing/SystemTests/tests/framework/ISISMuonAnalysisGrouping.py @@ -6,7 +6,7 @@ # SPDX - License - Identifier: GPL - 3.0 + # pylint: disable=no-init,attribute-defined-outside-init,too-many-instance-attributes,too-few-public-methods import systemtesting -from mantid.simpleapi import CloneWorkspace, CropWorkspace, GroupDetectors, GroupWorkspaces, LoadMuonNexus, Logarithm, RemoveExpDecay +from mantid.simpleapi import CloneWorkspace, CropWorkspace, GroupDetectors, GroupWorkspaces, Load, Logarithm, RemoveExpDecay from abc import ABCMeta, abstractmethod @@ -47,7 +47,7 @@ def runTest(self): outputWS = self.instr_name + str(self.sample_run) # Load - LoadMuonNexus(Filename=self.file_name, OutputWorkspace="MuonAnalysis") + Load(Filename=self.file_name, OutputWorkspace="MuonAnalysis") # Group, Crop, Clone if self.period_data: diff --git a/Testing/SystemTests/tests/framework/MuonKerenFittingTest.py b/Testing/SystemTests/tests/framework/MuonKerenFittingTest.py index 7cfac4a6dce0..1ca5500ddece 100644 --- a/Testing/SystemTests/tests/framework/MuonKerenFittingTest.py +++ b/Testing/SystemTests/tests/framework/MuonKerenFittingTest.py @@ -7,7 +7,7 @@ # pylint: disable=no-init,attribute-defined-outside-init,too-few-public-methods import systemtesting from mantid.api import mtd -from mantid.simpleapi import Fit, LoadMuonNexus, MuonProcess +from mantid.simpleapi import Fit, Load, MuonProcess class MuonKerenFittingTest(systemtesting.MantidSystemTest): @@ -15,7 +15,7 @@ class MuonKerenFittingTest(systemtesting.MantidSystemTest): def runTest(self): # Load dataset - LoadMuonNexus(Filename="MUT00053591.nxs", DetectorGroupingTable="gp", OutputWorkspace="MUT53591") + Load(Filename="MUT00053591.nxs", DetectorGroupingTable="gp", OutputWorkspace="MUT53591") # Process like MuonAnalysis interface would MuonProcess( diff --git a/Testing/SystemTests/tests/framework/MuonProcessTest.py b/Testing/SystemTests/tests/framework/MuonProcessTest.py index f11979dd2b3a..8e102716bacb 100644 --- a/Testing/SystemTests/tests/framework/MuonProcessTest.py +++ b/Testing/SystemTests/tests/framework/MuonProcessTest.py @@ -7,7 +7,7 @@ # pylint: disable=no-init import systemtesting from mantid.api import mtd, WorkspaceFactory -from mantid.simpleapi import LoadMuonNexus, MuonProcess +from mantid.simpleapi import Load, MuonProcess class MuonProcessTest(systemtesting.MantidSystemTest): @@ -27,7 +27,7 @@ def runTest(self): deadTimes.addRow([i, i * 0.01]) mtd.addOrReplace("MuonProcess_DeadTimes", deadTimes) - load_result = LoadMuonNexus(Filename="MUSR00015192", OutputWorkspace="MuonProcess_Loaded") + load_result = Load(Filename="MUSR00015192", OutputWorkspace="MuonProcess_Loaded") loaded_time_zero = load_result[2] MuonProcess( diff --git a/buildconfig/CMake/CppCheck_Suppressions.txt.in b/buildconfig/CMake/CppCheck_Suppressions.txt.in index 3f38d84f9316..1469dd5ae370 100644 --- a/buildconfig/CMake/CppCheck_Suppressions.txt.in +++ b/buildconfig/CMake/CppCheck_Suppressions.txt.in @@ -688,20 +688,6 @@ cstyleCast:${CMAKE_SOURCE_DIR}/Framework/Nexus/inc/MantidNexus/NexusFileIO.h:211 cstyleCast:${CMAKE_SOURCE_DIR}/Framework/Nexus/inc/MantidNexus/NexusFileIO.h:273 cstyleCast:${CMAKE_SOURCE_DIR}/Framework/Nexus/inc/MantidNexus/NexusFileIO.h:276 uselessOverride:${CMAKE_SOURCE_DIR}/Framework/DataHandling/inc/MantidDataHandling/LoadNexusProcessed2.h:38 -uselessOverride:${CMAKE_SOURCE_DIR}/Framework/DataHandling/inc/MantidDataHandling/LoadMuonNexus1.h:60 -uselessOverride:${CMAKE_SOURCE_DIR}/Framework/DataHandling/inc/MantidDataHandling/LoadMuonNexus1.h:62 -uselessOverride:${CMAKE_SOURCE_DIR}/Framework/DataHandling/inc/MantidDataHandling/LoadMuonNexus1.h:70 -uselessOverride:${CMAKE_SOURCE_DIR}/Framework/DataHandling/inc/MantidDataHandling/LoadMuonNexus1.h:72 -uselessOverride:${CMAKE_SOURCE_DIR}/Framework/DataHandling/inc/MantidDataHandling/LoadMuonNexus2.h:52 -uselessOverride:${CMAKE_SOURCE_DIR}/Framework/DataHandling/inc/MantidDataHandling/LoadMuonNexus2.h:65 -passedByValue:${CMAKE_SOURCE_DIR}/Framework/DataHandling/src/LoadMuonNexus1.cpp:604 -passedByValue:${CMAKE_SOURCE_DIR}/Framework/DataHandling/src/LoadMuonNexus1.cpp:627 -constVariableReference:${CMAKE_SOURCE_DIR}/Framework/DataHandling/src/LoadMuonNexus1.cpp:519 -constVariableReference:${CMAKE_SOURCE_DIR}/Framework/DataHandling/src/LoadMuonNexus1.cpp:551 -constVariableReference:${CMAKE_SOURCE_DIR}/Framework/DataHandling/src/LoadMuonNexus1.cpp:641 -constParameterReference:${CMAKE_SOURCE_DIR}/Framework/DataHandling/src/LoadMuonNexus1.cpp:661 -constVariableReference:${CMAKE_SOURCE_DIR}/Framework/DataHandling/src/LoadMuonNexus2.cpp:148 -constVariableReference:${CMAKE_SOURCE_DIR}/Framework/DataHandling/src/LoadMuonNexus2.cpp:486 constParameterReference:${CMAKE_SOURCE_DIR}/Framework/DataHandling/src/LoadTBL.cpp:133 unreadVariable:${CMAKE_SOURCE_DIR}/Framework/DataHandling/src/LoadTBL.cpp:162 constVariableReference:${CMAKE_SOURCE_DIR}/Framework/DataHandling/src/LoadPreNexus.cpp:244 diff --git a/docs/source/algorithms/ApplyMuonDetectorGroupPairing-v1.rst b/docs/source/algorithms/ApplyMuonDetectorGroupPairing-v1.rst index e525b5362d54..3b37cd8db32f 100644 --- a/docs/source/algorithms/ApplyMuonDetectorGroupPairing-v1.rst +++ b/docs/source/algorithms/ApplyMuonDetectorGroupPairing-v1.rst @@ -75,8 +75,8 @@ Usage OverwriteExisting=True) # Load the data - LoadMuonNexus( Filename='MUSR00015193.nxs', - OutputWorkspace='MuonAnalysis') + Load(Filename='MUSR00015193.nxs', + OutputWorkspace='MuonAnalysis') # Create two detector groupings ApplyMuonDetectorGrouping( diff --git a/docs/source/algorithms/ApplyMuonDetectorGrouping-v1.rst b/docs/source/algorithms/ApplyMuonDetectorGrouping-v1.rst index a5e37c99eb13..d358ffe0b201 100644 --- a/docs/source/algorithms/ApplyMuonDetectorGrouping-v1.rst +++ b/docs/source/algorithms/ApplyMuonDetectorGrouping-v1.rst @@ -70,8 +70,8 @@ Usage OverwriteExisting=True) # Load the data - LoadMuonNexus( Filename='MUSR00015193.nxs', - OutputWorkspace='MuonAnalysis') + Load(Filename='MUSR00015193.nxs', + OutputWorkspace='MuonAnalysis') ApplyMuonDetectorGrouping( InputWorkspace='MuonAnalysis', diff --git a/docs/source/algorithms/LoadAndApplyMuonDetectorGrouping-v1.rst b/docs/source/algorithms/LoadAndApplyMuonDetectorGrouping-v1.rst index f18a83f33545..fcfbd5eea3b7 100644 --- a/docs/source/algorithms/LoadAndApplyMuonDetectorGrouping-v1.rst +++ b/docs/source/algorithms/LoadAndApplyMuonDetectorGrouping-v1.rst @@ -74,8 +74,8 @@ Usage OverwriteExisting=True) # Load the data - LoadMuonNexus( Filename='MUSR00015189.nxs', - OutputWorkspace='MuonAnalysis') + Load(Filename='MUSR00015189.nxs', + OutputWorkspace='MuonAnalysis') LoadAndApplyMuonDetectorGrouping( Filename='MUSRGrouping.xml', diff --git a/docs/source/algorithms/MuonProcess-v1.rst b/docs/source/algorithms/MuonProcess-v1.rst index f8666232b8c7..8c2e811f46b4 100644 --- a/docs/source/algorithms/MuonProcess-v1.rst +++ b/docs/source/algorithms/MuonProcess-v1.rst @@ -75,9 +75,9 @@ Usage .. testcode:: ExPairAsymmetry # Begin by loading data into a workspace to process - load_result = LoadMuonNexus(Filename = "MUSR0015189.nxs", - DetectorGroupingTable = "grouping", - OutputWorkspace = "loadedWS") + load_result = Load(Filename="MUSR0015189.nxs", + DetectorGroupingTable="grouping", + OutputWorkspace = "loadedWS") loaded_time_zero = load_result[2] # time zero loaded from file grouping = mtd['grouping'] # detector grouping loaded from file grouping = grouping.getItem(0) # grouping here is a WorkspaceGroup - use table for first period diff --git a/qt/python/mantidqtinterfaces/test/Muon/corrections_tab_widget/dead_time_corrections_model_test.py b/qt/python/mantidqtinterfaces/test/Muon/corrections_tab_widget/dead_time_corrections_model_test.py index 9c191445f0fb..52a99cde839d 100644 --- a/qt/python/mantidqtinterfaces/test/Muon/corrections_tab_widget/dead_time_corrections_model_test.py +++ b/qt/python/mantidqtinterfaces/test/Muon/corrections_tab_widget/dead_time_corrections_model_test.py @@ -8,7 +8,7 @@ from unittest import mock from mantid.api import AnalysisDataService, FrameworkManager -from mantid.simpleapi import LoadMuonNexus +from mantid.simpleapi import Load from mantidqtinterfaces.Muon.GUI.Common.corrections_tab_widget.corrections_model import CorrectionsModel from mantidqtinterfaces.Muon.GUI.Common.corrections_tab_widget.dead_time_corrections_model import DeadTimeCorrectionsModel @@ -73,7 +73,7 @@ def test_that_set_dead_time_source_to_none_will_set_the_expected_data_in_the_con def test_that_dead_times_average_will_return_the_expected_dead_time_average_and_range(self): dead_time_table_name = "dead_time_table" - LoadMuonNexus(Filename="MUSR00022725.nxs", OutputWorkspace="output_ws", DeadTimeTable=dead_time_table_name) + Load(Filename="MUSR00022725.nxs", OutputWorkspace="output_ws", DeadTimeTable=dead_time_table_name) self.model.set_dead_time_source_to_from_ads(dead_time_table_name) @@ -87,7 +87,7 @@ def test_that_validate_selected_dead_time_workspace_will_return_an_empty_string_ self.model._data_context.current_workspace.getNumberHistograms = mock.Mock(return_value=64) dead_time_table_name = "dead_time_table" - LoadMuonNexus(Filename="MUSR00022725.nxs", OutputWorkspace="output_ws", DeadTimeTable=dead_time_table_name) + Load(Filename="MUSR00022725.nxs", OutputWorkspace="output_ws", DeadTimeTable=dead_time_table_name) self.assertEqual(self.model.validate_selected_dead_time_workspace(dead_time_table_name), "") @@ -95,7 +95,7 @@ def test_that_validate_selected_dead_time_workspace_returns_an_error_message_whe self.model._data_context.current_workspace.getNumberHistograms = mock.Mock(return_value=62) dead_time_table_name = "dead_time_table" - LoadMuonNexus(Filename="MUSR00022725.nxs", OutputWorkspace="output_ws", DeadTimeTable=dead_time_table_name) + Load(Filename="MUSR00022725.nxs", OutputWorkspace="output_ws", DeadTimeTable=dead_time_table_name) self.assertEqual( self.model.validate_selected_dead_time_workspace(dead_time_table_name),