Skip to content

Commit 381d0ea

Browse files
authored
Remove muon dependency from DataHandling (#39008)
* remove muon dependency from datahandling * move tests to muon * add moved tests to commit * remove unused LoadInstrumentFromNexus import from test * fix tests and doxygen * remove copy and move default constructor to header to try and fix doxygen * fix bug in sphinx directive * convert pureposixpath to str * commit removal of loadmuonlog src
1 parent 9b27089 commit 381d0ea

File tree

11 files changed

+37
-43
lines changed

11 files changed

+37
-43
lines changed

Framework/DataHandling/CMakeLists.txt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ set(SRC_FILES
7878
src/LoadISISNexusHelper.cpp
7979
src/LoadISISPolarizationEfficiencies.cpp
8080
src/LoadInstrument.cpp
81-
src/LoadInstrumentFromNexus.cpp
8281
src/LoadInstrumentFromRaw.cpp
8382
src/LoadIsawDetCal.cpp
8483
src/LoadLog.cpp
@@ -87,7 +86,6 @@ set(SRC_FILES
8786
src/LoadMask.cpp
8887
src/LoadMcStas.cpp
8988
src/LoadMcStasNexus.cpp
90-
src/LoadMuonLog.cpp
9189
src/LoadMuonNexusV2.cpp
9290
src/LoadMuonNexusV2NexusHelper.cpp
9391
src/LoadMuonStrategy.cpp
@@ -299,7 +297,6 @@ set(INC_FILES
299297
inc/MantidDataHandling/LoadISISNexusHelper.h
300298
inc/MantidDataHandling/LoadISISPolarizationEfficiencies.h
301299
inc/MantidDataHandling/LoadInstrument.h
302-
inc/MantidDataHandling/LoadInstrumentFromNexus.h
303300
inc/MantidDataHandling/LoadInstrumentFromRaw.h
304301
inc/MantidDataHandling/LoadIsawDetCal.h
305302
inc/MantidDataHandling/LoadLog.h
@@ -308,7 +305,6 @@ set(INC_FILES
308305
inc/MantidDataHandling/LoadMask.h
309306
inc/MantidDataHandling/LoadMcStas.h
310307
inc/MantidDataHandling/LoadMcStasNexus.h
311-
inc/MantidDataHandling/LoadMuonLog.h
312308
inc/MantidDataHandling/LoadMuonNexusV2.h
313309
inc/MantidDataHandling/LoadMuonNexusV2NexusHelper.h
314310
inc/MantidDataHandling/LoadMuonStrategy.h
@@ -512,7 +508,6 @@ set(TEST_FILES
512508
LoadILLTest.h
513509
LoadISISNexusTest.h
514510
LoadISISPolarizationEfficienciesTest.h
515-
LoadInstrumentFromNexusTest.h
516511
LoadInstrumentFromRawTest.h
517512
LoadInstrumentTest.h
518513
LoadIsawDetCalTest.h
@@ -522,7 +517,6 @@ set(TEST_FILES
522517
LoadMaskTest.h
523518
LoadMcStasNexusTest.h
524519
LoadMcStasTest.h
525-
LoadMuonLogTest.h
526520
LoadMuonNexusV2Test.h
527521
LoadNGEMTest.h
528522
LoadNXSPETest.h
@@ -687,7 +681,6 @@ target_link_libraries(
687681
Mantid::Kernel
688682
Mantid::Indexing
689683
Mantid::Parallel
690-
Mantid::Muon
691684
PRIVATE Mantid::Json Boost::filesystem Mantid::NexusGeometry Mantid::LegacyNexus
692685
)
693686

Framework/DataHandling/inc/MantidDataHandling/LoadIDFFromNexus.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
namespace Mantid {
1616
namespace DataHandling {
17-
/** @class LoadIDFFromNexus LoadInstrumentFromNexus.h
17+
/** @class LoadIDFFromNexus LoadIDFFromNexus.h
1818
DataHandling/LoadIDFFromNexus.h
1919
2020
Load an IDF from a Nexus file, if found there.

Framework/DataHandling/test/UpdateInstrumentFromFileTest.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include "MantidAPI/SpectrumInfo.h"
1616
#include "MantidDataHandling/GroupDetectors2.h"
1717
#include "MantidDataHandling/LoadInstrument.h"
18-
#include "MantidDataHandling/LoadInstrumentFromNexus.h"
1918
#include "MantidDataHandling/UpdateInstrumentFromFile.h"
2019
#include "MantidDataObjects/WorkspaceCreation.h"
2120
#include "MantidGeometry/Instrument.h"

Framework/Muon/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ set(SRC_FILES
1010
src/ConvertFitFunctionForMuonTFAsymmetry.cpp
1111
src/EstimateMuonAsymmetryFromCounts.cpp
1212
src/LoadAndApplyMuonDetectorGrouping.cpp
13+
src/LoadInstrumentFromNexus.cpp
1314
src/LoadMuonNexus.cpp
1415
src/LoadMuonNexus1.cpp
1516
src/LoadMuonNexus2.cpp
1617
src/LoadMuonNexus3.cpp
18+
src/LoadMuonLog.cpp
1719
src/MuonAlgorithmHelper.cpp
1820
src/MuonAsymmetryHelper.cpp
1921
src/MuonGroupDetectors.cpp
@@ -40,10 +42,12 @@ set(INC_FILES
4042
inc/MantidMuon/CalMuonDetectorPhases.h
4143
inc/MantidMuon/ConvertFitFunctionForMuonTFAsymmetry.h
4244
inc/MantidMuon/LoadAndApplyMuonDetectorGrouping.h
45+
inc/MantidMuon/LoadInstrumentFromNexus.h
4346
inc/MantidMuon/LoadMuonNexus.h
4447
inc/MantidMuon/LoadMuonNexus1.h
4548
inc/MantidMuon/LoadMuonNexus2.h
4649
inc/MantidMuon/LoadMuonNexus3.h
50+
inc/MantidMuon/LoadMuonLog.h
4751
inc/MantidMuon/EstimateMuonAsymmetryFromCounts.h
4852
inc/MantidMuon/MuonAlgorithmHelper.h
4953
inc/MantidMuon/MuonAsymmetryHelper.h
@@ -71,9 +75,11 @@ set(TEST_FILES
7175
CalMuonDetectorPhasesTest.h
7276
ConvertFitFunctionForMuonTFAsymmetryTest.h
7377
LoadAndApplyMuonDetectorGroupingTest.h
78+
LoadInstrumentFromNexusTest.h
7479
LoadMuonNexus1Test.h
7580
LoadMuonNexus2Test.h
7681
LoadMuonNexus3Test.h
82+
LoadMuonLogTest.h
7783
MuonAlgorithmHelperTest.h
7884
EstimateMuonAsymmetryFromCountsTest.h
7985
MuonGroupDetectorsTest.h

Framework/DataHandling/inc/MantidDataHandling/LoadInstrumentFromNexus.h renamed to Framework/Muon/inc/MantidMuon/LoadInstrumentFromNexus.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// Includes
1111
//----------------------------------------------------------------------
1212
#include "MantidAPI/Algorithm.h"
13-
#include "MantidDataHandling/DllConfig.h"
13+
#include "MantidMuon/DllConfig.h"
1414

1515
namespace Mantid {
1616

@@ -20,9 +20,9 @@ class Component;
2020
class Instrument;
2121
} // namespace Geometry
2222

23-
namespace DataHandling {
23+
namespace Muon {
2424
/** @class LoadInstrumentFromNexus LoadInstrumentFromNexus.h
25-
DataHandling/LoadInstrumentFromNexus.h
25+
Muon/LoadInstrumentFromNexus.h
2626
2727
Attempts to load information about the instrument from a ISIS NeXus file. In
2828
particular attempt to
@@ -37,7 +37,7 @@ other Loadxxx algorithms, rather than being used directly.
3737
It is used by LoadMuonNexus version 1.
3838
3939
LoadInstrumentFromNexus is an algorithm and as such inherits
40-
from the Algorithm class, via DataHandlingCommand, and overrides
40+
from the Algorithm class, and overrides
4141
the init() & exec() methods.
4242
4343
Required Properties:
@@ -51,7 +51,7 @@ data to be added.</LI>
5151
@date 2/5/2008
5252
@author Ronald Fowler, ISIS, RAL (LoadInstrumentFromNexus)
5353
*/
54-
class MANTID_DATAHANDLING_DLL LoadInstrumentFromNexus final : public API::Algorithm {
54+
class MANTID_MUON_DLL LoadInstrumentFromNexus final : public API::Algorithm {
5555
public:
5656
/// Default constructor
5757
LoadInstrumentFromNexus();
@@ -73,7 +73,7 @@ class MANTID_DATAHANDLING_DLL LoadInstrumentFromNexus final : public API::Algori
7373
const std::vector<std::string> seeAlso() const override { return {"LoadInstrument", "Load"}; }
7474

7575
/// Algorithm's category for identification overriding a virtual method
76-
const std::string category() const override { return "DataHandling\\Instrument"; }
76+
const std::string category() const override { return "Muon\\DataHandling"; }
7777

7878
private:
7979
/// Overwrites Algorithm method. Does nothing at present
@@ -86,5 +86,5 @@ class MANTID_DATAHANDLING_DLL LoadInstrumentFromNexus final : public API::Algori
8686
std::string m_filename;
8787
};
8888

89-
} // namespace DataHandling
89+
} // namespace Muon
9090
} // namespace Mantid

Framework/DataHandling/inc/MantidDataHandling/LoadMuonLog.h renamed to Framework/Muon/inc/MantidMuon/LoadMuonLog.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
//----------------------------------------------------------------------
1212
#include "MantidAPI/Algorithm.h"
1313
#include "MantidAPI/MatrixWorkspace.h"
14-
#include "MantidDataHandling/DllConfig.h"
14+
#include "MantidMuon/DllConfig.h"
1515
#include "MantidMuon/MuonNexusReader.h"
1616

1717
namespace Mantid {
1818

19-
namespace DataHandling {
20-
/** @class LoadMuonLog LoadMuonLog.h DataHandling/LoadMuonLog.h
19+
namespace Muon {
20+
/** @class LoadMuonLog LoadMuonLog.h Muon/LoadMuonLog.h
2121
2222
Load ISIS Muon log data from a NeXus file. Sections of NXlog values within the
2323
first run will be loaded.
@@ -40,10 +40,10 @@ Required Properties:
4040
@author Ronald Fowler, based on LoadLog by Anders Markvardsen, ISIS, RAL
4141
@date 11/08/2008
4242
*/
43-
class MANTID_DATAHANDLING_DLL LoadMuonLog final : public API::Algorithm {
43+
class MANTID_MUON_DLL LoadMuonLog final : public API::Algorithm {
4444
public:
4545
/// Default constructor
46-
LoadMuonLog();
46+
LoadMuonLog() = default;
4747
/// Algorithm's name for identification overriding a virtual method
4848
const std::string name() const override { return "LoadMuonLog"; };
4949
/// Summary of algorithms purpose
@@ -53,7 +53,7 @@ class MANTID_DATAHANDLING_DLL LoadMuonLog final : public API::Algorithm {
5353
int version() const override { return 1; };
5454
const std::vector<std::string> seeAlso() const override { return {"LoadLog", "LoadLogPropertyTable"}; }
5555
/// Algorithm's category for identification overriding a virtual method
56-
const std::string category() const override { return "DataHandling\\Logs;Muon\\DataHandling"; }
56+
const std::string category() const override { return "Muon\\DataHandling"; }
5757

5858
private:
5959
/// Overwrites Algorithm method.
@@ -76,5 +76,5 @@ class MANTID_DATAHANDLING_DLL LoadMuonLog final : public API::Algorithm {
7676
bool isDateTimeString(const std::string &str);
7777
};
7878

79-
} // namespace DataHandling
79+
} // namespace Muon
8080
} // namespace Mantid

Framework/DataHandling/src/LoadInstrumentFromNexus.cpp renamed to Framework/Muon/src/LoadInstrumentFromNexus.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//----------------------------------------------------------------------
88
// Includes
99
//----------------------------------------------------------------------
10-
#include "MantidDataHandling/LoadInstrumentFromNexus.h"
10+
#include "MantidMuon/LoadInstrumentFromNexus.h"
1111
#include "MantidAPI/FileProperty.h"
1212
#include "MantidAPI/MatrixWorkspace.h"
1313
#include "MantidGeometry/Instrument.h"
@@ -19,7 +19,7 @@
1919

2020
#include <fstream>
2121

22-
namespace Mantid::DataHandling {
22+
namespace Mantid::Muon {
2323

2424
DECLARE_ALGORITHM(LoadInstrumentFromNexus)
2525

@@ -86,4 +86,4 @@ void LoadInstrumentFromNexus::exec() {
8686
progress(1.0);
8787
}
8888

89-
} // namespace Mantid::DataHandling
89+
} // namespace Mantid::Muon

Framework/DataHandling/src/LoadMuonLog.cpp renamed to Framework/Muon/src/LoadMuonLog.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// NScD Oak Ridge National Laboratory, European Spallation Source,
55
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
66
// SPDX - License - Identifier: GPL - 3.0 +
7-
#include "MantidDataHandling/LoadMuonLog.h"
7+
#include "MantidMuon/LoadMuonLog.h"
88
#include "MantidAPI/FileProperty.h"
99
#include "MantidAPI/Run.h"
1010
#include "MantidAPI/Sample.h"
@@ -20,7 +20,7 @@ void toLower(std::string &name) {
2020
}
2121
} // namespace
2222

23-
namespace Mantid::DataHandling {
23+
namespace Mantid::Muon {
2424

2525
// Register the algorithm into the algorithm factory
2626
DECLARE_ALGORITHM(LoadMuonLog)
@@ -33,9 +33,6 @@ using API::Progress;
3333
using API::WorkspaceProperty;
3434
using DataObjects::Workspace2D_sptr;
3535

36-
/// Empty default constructor
37-
LoadMuonLog::LoadMuonLog() = default;
38-
3936
/// Initialisation method.
4037
void LoadMuonLog::init() {
4138
// When used as a Child Algorithm the workspace name is not used - hence the
@@ -70,9 +67,9 @@ void LoadMuonLog::exec() {
7067
localWorkspace->mutableSample().setName(nxload.getSampleName());
7168

7269
std::set<std::string> logNames;
73-
auto logs = localWorkspace->mutableRun().getLogData();
70+
const auto &logs = localWorkspace->mutableRun().getLogData();
7471
// need to remove case
75-
for (auto log : logs) {
72+
for (const auto &log : logs) {
7673
std::string logName = log->name();
7774
toLower(logName);
7875
logNames.insert(logName);
@@ -156,4 +153,4 @@ bool LoadMuonLog::isDateTimeString(const std::string &str) {
156153
return false;
157154
}
158155

159-
} // namespace Mantid::DataHandling
156+
} // namespace Mantid::Muon

Framework/DataHandling/test/LoadInstrumentFromNexusTest.h renamed to Framework/Muon/test/LoadInstrumentFromNexusTest.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@
88

99
#include <cxxtest/TestSuite.h>
1010

11-
#include "MantidDataHandling/LoadInstrumentFromNexus.h"
1211
#include "MantidFrameworkTestHelpers/WorkspaceCreationHelper.h"
1312
#include "MantidGeometry/Instrument.h"
13+
#include "MantidMuon/LoadInstrumentFromNexus.h"
1414

1515
using namespace Mantid;
16-
using namespace Mantid::DataHandling;
1716
using namespace Mantid::API;
1817
using namespace Mantid::Geometry;
1918
using Mantid::Kernel::V3D;
@@ -27,7 +26,7 @@ class LoadInstrumentFromNexusTest : public CxxTest::TestSuite {
2726

2827
void testLoadInstrumentFromNexus() {
2928
// setup and run the algorithm (includes basic checks)
30-
LoadInstrumentFromNexus alg;
29+
Muon::LoadInstrumentFromNexus alg;
3130
const MatrixWorkspace_sptr ws = setupAlgorithm(alg, "MUSR00015189.nxs");
3231
runAlgorithm(alg);
3332

@@ -60,7 +59,7 @@ class LoadInstrumentFromNexusTest : public CxxTest::TestSuite {
6059

6160
// Initialise the algorithm and set the properties. Creates a fake
6261
// workspace for the input.
63-
const MatrixWorkspace_sptr setupAlgorithm(LoadInstrumentFromNexus &alg, const std::string &filename) {
62+
const MatrixWorkspace_sptr setupAlgorithm(Muon::LoadInstrumentFromNexus &alg, const std::string &filename) {
6463
// create the workspace
6564
const MatrixWorkspace_sptr inWS = makeFakeWorkspace();
6665

@@ -74,7 +73,7 @@ class LoadInstrumentFromNexusTest : public CxxTest::TestSuite {
7473
}
7574

7675
// Run the algorithm and do some basic checks
77-
void runAlgorithm(LoadInstrumentFromNexus &alg) {
76+
void runAlgorithm(Muon::LoadInstrumentFromNexus &alg) {
7877
// run the algorithm
7978
TS_ASSERT_THROWS_NOTHING(alg.execute());
8079
TS_ASSERT(alg.isExecuted());

Framework/DataHandling/test/LoadMuonLogTest.h renamed to Framework/Muon/test/LoadMuonLogTest.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@
2020
#include "MantidAPI/Run.h"
2121
#include "MantidAPI/Workspace.h"
2222
#include "MantidAPI/WorkspaceFactory.h"
23-
#include "MantidDataHandling/LoadMuonLog.h"
2423
#include "MantidDataObjects/Workspace2D.h"
2524
#include "MantidGeometry/Instrument.h"
2625
#include "MantidKernel/Exception.h"
2726
#include "MantidKernel/TimeSeriesProperty.h"
27+
#include "MantidMuon/LoadMuonLog.h"
2828
#include <Poco/Path.h>
2929
#include <vector>
3030

3131
using namespace Mantid::API;
3232
using namespace Mantid::Kernel;
3333
using namespace Mantid::DataObjects;
34-
using Mantid::DataHandling::LoadMuonLog;
34+
using Mantid::Muon::LoadMuonLog;
3535

3636
class LoadMuonLogTest : public CxxTest::TestSuite {
3737
public:

0 commit comments

Comments
 (0)