Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
mantidproject
mantid
Commits
5c1be9a2
Commit
5c1be9a2
authored
Sep 14, 2021
by
Zhang, Chen
Browse files
demo of rename with deprecated alias for c++ alg
parent
b4f8cc31
Changes
5
Hide whitespace changes
Inline
Side-by-side
Framework/DataHandling/CMakeLists.txt
View file @
5c1be9a2
set
(
SRC_FILES
src/AppendGeometryToSNSNexus.cpp
src/ApplyDiffCal.cpp
src/BankPulseTimes.cpp
src/CheckMantidVersion.cpp
...
...
@@ -206,13 +205,13 @@ set(SRC_FILES
src/SetSample.cpp
src/SetSampleMaterial.cpp
src/SetScalingPSD.cpp
src/SNSAppendGeometryToNexus.cpp
src/SortTableWorkspace.cpp
src/StartAndEndTimeFromNexusFileExtractor.cpp
src/UpdateInstrumentFromFile.cpp
src/XmlHandler.cpp
)
set
(
INC_FILES
inc/MantidDataHandling/AppendGeometryToSNSNexus.h
inc/MantidDataHandling/ApplyDiffCal.h
inc/MantidDataHandling/BankPulseTimes.h
inc/MantidDataHandling/CheckMantidVersion.h
...
...
@@ -417,6 +416,7 @@ set(INC_FILES
inc/MantidDataHandling/SetSample.h
inc/MantidDataHandling/SetSampleMaterial.h
inc/MantidDataHandling/SetScalingPSD.h
inc/MantidDataHandling/SNSAppendGeometryToNexus.h
inc/MantidDataHandling/SortTableWorkspace.h
inc/MantidDataHandling/StartAndEndTimeFromNexusFileExtractor.h
inc/MantidDataHandling/UpdateInstrumentFromFile.h
...
...
@@ -428,7 +428,6 @@ set(INC_FILES
src/LoadRaw/vms_convert.h
)
set
(
TEST_FILES
AppendGeometryToSNSNexusTest.h
ApplyDiffCalTest.h
CheckMantidVersionTest.h
CompressEventsTest.h
...
...
@@ -610,6 +609,7 @@ set(TEST_FILES
SetSampleMaterialTest.h
SetSampleTest.h
SetScalingPSDTest.h
SNSAppendGeometryToNexusTest.h
SortTableWorkspaceTest.h
StartAndEndTimeFromNexusFileExtractorTest.h
UpdateInstrumentFromFileTest.h
...
...
Framework/DataHandling/inc/MantidDataHandling/AppendGeometryTo
SNS
Nexus.h
→
Framework/DataHandling/inc/MantidDataHandling/
SNS
AppendGeometryToNexus.h
View file @
5c1be9a2
...
...
@@ -7,19 +7,20 @@
#pragma once
#include
"MantidAPI/Algorithm.h"
#include
"MantidAPI/DeprecatedAlias.h"
#include
"MantidKernel/System.h"
namespace
Mantid
{
namespace
DataHandling
{
/** AppendGeometryTo
SNS
Nexus : Appends geometry information to a NeXus file.
/**
SNS
AppendGeometryToNexus : Appends geometry information to a NeXus file.
@date 2012-06-01
*/
class
DLLExport
AppendGeometryTo
SNS
Nexus
:
public
API
::
Algorithm
{
class
DLLExport
SNS
AppendGeometryToNexus
:
public
API
::
Algorithm
,
public
API
::
DeprecatedAlias
{
public:
AppendGeometryTo
SNS
Nexus
();
~
AppendGeometryTo
SNS
Nexus
()
override
;
SNS
AppendGeometryToNexus
();
~
SNS
AppendGeometryToNexus
()
override
;
const
std
::
string
name
()
const
override
;
/// Summary of algorithms purpose
...
...
@@ -30,6 +31,7 @@ public:
int
version
()
const
override
;
const
std
::
string
category
()
const
override
;
const
std
::
string
alias
()
const
override
{
return
"AppendGeometryToSNSNexus"
;
};
private:
void
init
()
override
;
...
...
Framework/DataHandling/src/AppendGeometryTo
SNS
Nexus.cpp
→
Framework/DataHandling/src/
SNS
AppendGeometryToNexus.cpp
View file @
5c1be9a2
...
...
@@ -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/AppendGeometryTo
SNS
Nexus.h"
#include
"MantidDataHandling/
SNS
AppendGeometryToNexus.h"
#include
"MantidAPI/FileProperty.h"
#include
"MantidAPI/InstrumentFileFinder.h"
#include
"MantidAPI/WorkspaceFactory.h"
...
...
@@ -30,37 +30,40 @@ namespace Mantid {
namespace
DataHandling
{
// Register the algorithm into the AlgorithmFactory
DECLARE_ALGORITHM
(
AppendGeometryTo
SNS
Nexus
)
DECLARE_ALGORITHM
(
SNS
AppendGeometryToNexus
)
//----------------------------------------------------------------------------------------------
/** Constructor
*/
AppendGeometryToSNSNexus
::
AppendGeometryToSNSNexus
()
:
m_makeNexusCopy
(
false
),
m_instrumentLoadedCorrectly
(
false
),
m_logsLoadedCorrectly
(
false
)
{}
SNSAppendGeometryToNexus
::
SNSAppendGeometryToNexus
()
:
m_makeNexusCopy
(
false
),
m_instrumentLoadedCorrectly
(
false
),
m_logsLoadedCorrectly
(
false
)
{
// inform deprecation alias status
setDeprecationDate
(
"2021-09-14"
);
}
//----------------------------------------------------------------------------------------------
/** Destructor
*/
AppendGeometryTo
SNS
Nexus
::~
AppendGeometryTo
SNS
Nexus
()
{
SNS
AppendGeometryToNexus
::~
SNS
AppendGeometryToNexus
()
{
// delete workspace
}
//----------------------------------------------------------------------------------------------
/// Algorithm's name for identification. @see Algorithm::name
const
std
::
string
AppendGeometryTo
SNS
Nexus
::
name
()
const
{
return
"AppendGeometryTo
SNS
Nexus"
;
}
const
std
::
string
SNS
AppendGeometryToNexus
::
name
()
const
{
return
"
SNS
AppendGeometryToNexus"
;
}
/// Algorithm's version for identification. @see Algorithm::version
int
AppendGeometryTo
SNS
Nexus
::
version
()
const
{
return
1
;
}
int
SNS
AppendGeometryToNexus
::
version
()
const
{
return
1
;
}
/// Algorithm's category for identification. @see Algorithm::category
const
std
::
string
AppendGeometryTo
SNS
Nexus
::
category
()
const
{
return
"DataHandling
\\
DataAcquisition"
;
}
const
std
::
string
SNS
AppendGeometryToNexus
::
category
()
const
{
return
"DataHandling
\\
DataAcquisition"
;
}
//----------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------
/** Initialize the algorithm's properties.
*/
void
AppendGeometryTo
SNS
Nexus
::
init
()
{
void
SNS
AppendGeometryToNexus
::
init
()
{
// Declare potential extensions for input NeXus file
std
::
vector
<
std
::
string
>
extensions
{
".nxs"
,
".h5"
};
...
...
@@ -76,7 +79,7 @@ void AppendGeometryToSNSNexus::init() {
//----------------------------------------------------------------------------------------------
/** Execute the algorithm.
*/
void
AppendGeometryTo
SNS
Nexus
::
exec
()
{
void
SNS
AppendGeometryToNexus
::
exec
()
{
// TODO: rename the created arrays before moving to production
g_log
.
warning
()
<<
"This is intended as a proof of principle and not a long "
"term implementation.
\n
"
;
...
...
@@ -293,7 +296,7 @@ void AppendGeometryToSNSNexus::exec() {
* @param nxfilename :: Input NeXus file.
* @return the instrument name, empty string if failed.
*/
std
::
string
AppendGeometryTo
SNS
Nexus
::
getInstrumentName
(
const
std
::
string
&
nxfilename
)
{
std
::
string
SNS
AppendGeometryToNexus
::
getInstrumentName
(
const
std
::
string
&
nxfilename
)
{
std
::
string
instrument
;
// Open the NeXus file
...
...
@@ -331,7 +334,7 @@ std::string AppendGeometryToSNSNexus::getInstrumentName(const std::string &nxfil
* @return true if successful
*/
bool
AppendGeometryTo
SNS
Nexus
::
runLoadInstrument
(
const
std
::
string
&
idf_filename
,
bool
SNS
AppendGeometryToNexus
::
runLoadInstrument
(
const
std
::
string
&
idf_filename
,
const
API
::
MatrixWorkspace_sptr
&
localWorkspace
,
Algorithm
*
alg
)
{
IAlgorithm_sptr
loadInst
=
createChildAlgorithm
(
"LoadInstrument"
,
0
,
1
,
true
);
...
...
@@ -367,7 +370,7 @@ bool AppendGeometryToSNSNexus::runLoadInstrument(const std::string &idf_filename
* @param alg :: Handle of an algorithm for logging access.
* @return true if successful.
*/
bool
AppendGeometryTo
SNS
Nexus
::
runLoadNexusLogs
(
const
std
::
string
&
nexusFileName
,
bool
SNS
AppendGeometryToNexus
::
runLoadNexusLogs
(
const
std
::
string
&
nexusFileName
,
const
API
::
MatrixWorkspace_sptr
&
localWorkspace
,
Algorithm
*
alg
)
{
IAlgorithm_sptr
loadLogs
=
alg
->
createChildAlgorithm
(
"LoadNexusLogs"
,
0
,
1
,
true
);
...
...
Framework/DataHandling/test/AppendGeometryTo
SNS
NexusTest.h
→
Framework/DataHandling/test/
SNS
AppendGeometryToNexusTest.h
View file @
5c1be9a2
...
...
@@ -12,7 +12,7 @@
#include
<Poco/Path.h>
#include
<cxxtest/TestSuite.h>
#include
"MantidDataHandling/AppendGeometryTo
SNS
Nexus.h"
#include
"MantidDataHandling/
SNS
AppendGeometryToNexus.h"
using
namespace
Mantid
;
using
namespace
Mantid
::
DataHandling
;
...
...
@@ -22,24 +22,24 @@ namespace {
constexpr
auto
NXS_FILENAME
=
"HYS_11092_event.nxs"
;
}
class
AppendGeometryTo
SNS
NexusTest
:
public
CxxTest
::
TestSuite
{
class
SNS
AppendGeometryToNexusTest
:
public
CxxTest
::
TestSuite
{
public:
// This pair of boilerplate methods prevent the suite being created statically
// This means the constructor isn't called when running other tests
static
AppendGeometryTo
SNS
NexusTest
*
createSuite
()
{
return
new
AppendGeometryTo
SNS
NexusTest
();
}
static
void
destroySuite
(
AppendGeometryTo
SNS
NexusTest
*
suite
)
{
delete
suite
;
}
static
SNS
AppendGeometryToNexusTest
*
createSuite
()
{
return
new
SNS
AppendGeometryToNexusTest
();
}
static
void
destroySuite
(
SNS
AppendGeometryToNexusTest
*
suite
)
{
delete
suite
;
}
void
test_Init
()
{
AppendGeometryTo
SNS
Nexus
alg
;
SNS
AppendGeometryToNexus
alg
;
TS_ASSERT_THROWS_NOTHING
(
alg
.
initialize
())
TS_ASSERT
(
alg
.
isInitialized
())
}
void
test_exec
()
{
// // Name of the output workspace.
// std::string outWSName("AppendGeometryTo
SNS
NexusTest_OutputWS");
// std::string outWSName("
SNS
AppendGeometryToNexusTest_OutputWS");
AppendGeometryTo
SNS
Nexus
alg
;
SNS
AppendGeometryToNexus
alg
;
TS_ASSERT_THROWS_NOTHING
(
alg
.
initialize
())
TS_ASSERT
(
alg
.
isInitialized
())
// TODO: Get a better test file.
...
...
docs/source/algorithms/AppendGeometryTo
SNS
Nexus-v1.rst
→
docs/source/algorithms/
SNS
AppendGeometryToNexus-v1.rst
View file @
5c1be9a2
...
...
@@ -10,9 +10,10 @@ Description
-----------
This algorithm is intended to append the geometry information into a raw
NeXus file. It is initially for use only at the SNS, as it is needed for
the currently upgrade program. But there is nothing preventing it being
used elsewhere.
NeXus file.
It is initially for use only at the SNS, as it is needed for
the currently upgrade program.
But there is nothing preventing it being used elsewhere.
The algorithm takes the geometry information in the IDF together with the
log values in a given NeXus file and calculates the resolved positions
...
...
@@ -21,7 +22,8 @@ of all the detectors and then writes this into the NeXus file specified.
Usage
-----
This a currently a Proof of Concept algorithm. If it matures into normal use a usage example must be added.
This a currently a Proof of Concept algorithm.
If it matures into normal use a usage example must be added.
.. categories::
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment