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
27e5bd91
Commit
27e5bd91
authored
Sep 14, 2016
by
Ian Bush
Browse files
Refs #17065 Renamed LoadILLINX to LoadILLTOF
parent
ee119a2e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Framework/DataHandling/CMakeLists.txt
View file @
27e5bd91
...
...
@@ -55,7 +55,7 @@ set ( SRC_FILES
src/LoadIDFFromNexus.cpp
src/LoadILL.cpp
src/LoadILLIndirect.cpp
src/LoadILL
INX
.cpp
src/LoadILL
TOF
.cpp
src/LoadILLReflectometry.cpp
src/LoadILLSANS.cpp
src/LoadISISNexus2.cpp
...
...
@@ -233,7 +233,7 @@ set ( INC_FILES
inc/MantidDataHandling/LoadIDFFromNexus.h
inc/MantidDataHandling/LoadILL.h
inc/MantidDataHandling/LoadILLIndirect.h
inc/MantidDataHandling/LoadILL
INX
.h
inc/MantidDataHandling/LoadILL
TOF
.h
inc/MantidDataHandling/LoadILLReflectometry.h
inc/MantidDataHandling/LoadILLSANS.h
inc/MantidDataHandling/LoadISISNexus2.h
...
...
@@ -404,7 +404,7 @@ set ( TEST_FILES
LoadGSSTest.h
LoadIDFFromNexusTest.h
LoadILLIndirectTest.h
LoadILL
INX
Test.h
LoadILL
TOF
Test.h
LoadILLReflectometryTest.h
LoadILLSANSTest.h
LoadISISNexusTest.h
...
...
Framework/DataHandling/inc/MantidDataHandling/LoadILL.h
View file @
27e5bd91
...
...
@@ -5,7 +5,7 @@
#include
"MantidNexus/NexusClasses.h"
#include
"MantidDataHandling/LoadHelper.h"
#include
"MantidAPI/DeprecatedAlgorithm.h"
#include
"MantidDataHandling/LoadILL
INX
.h"
#include
"MantidDataHandling/LoadILL
TOF
.h"
namespace
Mantid
{
namespace
DataHandling
{
...
...
@@ -33,7 +33,7 @@ namespace DataHandling {
File change history is stored at: <https://github.com/mantidproject/mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class
DLLExport
LoadILL
:
public
LoadILL
INX
,
public
API
::
DeprecatedAlgorithm
{
class
DLLExport
LoadILL
:
public
LoadILL
TOF
,
public
API
::
DeprecatedAlgorithm
{
public:
/// Constructor
LoadILL
();
...
...
Framework/DataHandling/inc/MantidDataHandling/LoadILL
INX
.h
→
Framework/DataHandling/inc/MantidDataHandling/LoadILL
TOF
.h
View file @
27e5bd91
#ifndef MANTID_DATAHANDLING_LOADILL
INX
_H_
#define MANTID_DATAHANDLING_LOADILL
INX
_H_
#ifndef MANTID_DATAHANDLING_LOADILL
TOF
_H_
#define MANTID_DATAHANDLING_LOADILL
TOF
_H_
//---------------------------------------------------
// Includes
...
...
@@ -34,12 +34,12 @@ namespace DataHandling {
File change history is stored at: <https://github.com/mantidproject/mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class
DLLExport
LoadILL
INX
:
public
API
::
IFileLoader
<
Kernel
::
NexusDescriptor
>
{
class
DLLExport
LoadILL
TOF
:
public
API
::
IFileLoader
<
Kernel
::
NexusDescriptor
>
{
public:
/// Constructor
LoadILL
INX
();
LoadILL
TOF
();
/// Algorithm's name
const
std
::
string
name
()
const
override
{
return
"LoadILL
INX
"
;
}
const
std
::
string
name
()
const
override
{
return
"LoadILL
TOF
"
;
}
/// Summary of algorithms purpose
const
std
::
string
summary
()
const
override
{
return
"Loads an ILL ToF NeXus file."
;
...
...
@@ -111,4 +111,4 @@ private:
}
// namespace DataHandling
}
// namespace Mantid
#endif
/*MANTID_DATAHANDLING_L
oadILLINX
_H_*/
#endif
/*MANTID_DATAHANDLING_L
OADILLTOF
_H_*/
Framework/DataHandling/src/LoadILL.cpp
View file @
27e5bd91
...
...
@@ -10,7 +10,7 @@ namespace DataHandling {
DECLARE_NEXUS_FILELOADER_ALGORITHM
(
LoadILL
)
/// Constructor
LoadILL
::
LoadILL
()
:
LoadILL
INX
()
{
this
->
useAlgorithm
(
"LoadILL
INX
"
,
1
);
}
LoadILL
::
LoadILL
()
:
LoadILL
TOF
()
{
this
->
useAlgorithm
(
"LoadILL
TOF
"
,
1
);
}
/**
* Return the confidence with with this algorithm can load the file
...
...
Framework/DataHandling/src/LoadILL
INX
.cpp
→
Framework/DataHandling/src/LoadILL
TOF
.cpp
View file @
27e5bd91
//---------------------------------------------------
// Includes
//---------------------------------------------------
#include
"MantidDataHandling/LoadILL
INX
.h"
#include
"MantidDataHandling/LoadILL
TOF
.h"
#include
"MantidAPI/Axis.h"
#include
"MantidAPI/FileProperty.h"
...
...
@@ -18,7 +18,7 @@ using namespace Kernel;
using
namespace
API
;
using
namespace
NeXus
;
DECLARE_NEXUS_FILELOADER_ALGORITHM
(
LoadILL
INX
)
DECLARE_NEXUS_FILELOADER_ALGORITHM
(
LoadILL
TOF
)
//---------------------------------------------------
// Private member functions
...
...
@@ -30,7 +30,7 @@ DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadILLINX)
* @returns An integer specifying the confidence level. 0 indicates it will not
* be used
*/
int
LoadILL
INX
::
confidence
(
Kernel
::
NexusDescriptor
&
descriptor
)
const
{
int
LoadILL
TOF
::
confidence
(
Kernel
::
NexusDescriptor
&
descriptor
)
const
{
// fields existent only at the ILL
if
(
descriptor
.
pathExists
(
"/entry0/wavelength"
)
&&
...
...
@@ -49,7 +49,7 @@ int LoadILLINX::confidence(Kernel::NexusDescriptor &descriptor) const {
}
}
LoadILL
INX
::
LoadILL
INX
()
:
API
::
IFileLoader
<
Kernel
::
NexusDescriptor
>
()
{
LoadILL
TOF
::
LoadILL
TOF
()
:
API
::
IFileLoader
<
Kernel
::
NexusDescriptor
>
()
{
m_instrumentName
=
""
;
m_wavelength
=
0
;
m_channelWidth
=
0
;
...
...
@@ -68,7 +68,7 @@ LoadILLINX::LoadILLINX() : API::IFileLoader<Kernel::NexusDescriptor>() {
/**
* Initialise the algorithm
*/
void
LoadILL
INX
::
init
()
{
void
LoadILL
TOF
::
init
()
{
declareProperty
(
make_unique
<
FileProperty
>
(
"Filename"
,
""
,
FileProperty
::
Load
,
".nxs"
),
"File path of the Data file to load"
);
...
...
@@ -90,7 +90,7 @@ void LoadILLINX::init() {
/**
* Execute the algorithm
*/
void
LoadILL
INX
::
exec
()
{
void
LoadILL
TOF
::
exec
()
{
// Retrieve filename
std
::
string
filenameData
=
getPropertyValue
(
"Filename"
);
std
::
string
filenameVanadium
=
getPropertyValue
(
"FilenameVanadium"
);
...
...
@@ -132,7 +132,7 @@ void LoadILLINX::exec() {
* @return : list of monitor data
*/
std
::
vector
<
std
::
vector
<
int
>>
LoadILL
INX
::
getMonitorInfo
(
NeXus
::
NXEntry
&
firstEntry
)
{
LoadILL
TOF
::
getMonitorInfo
(
NeXus
::
NXEntry
&
firstEntry
)
{
std
::
vector
<
std
::
vector
<
int
>>
monitorList
;
...
...
@@ -162,7 +162,7 @@ LoadILLINX::getMonitorInfo(NeXus::NXEntry &firstEntry) {
* or filename.
* @return the EPP
*/
int
LoadILL
INX
::
getEPPFromVanadium
(
const
std
::
string
&
filenameVanadium
,
int
LoadILL
TOF
::
getEPPFromVanadium
(
const
std
::
string
&
filenameVanadium
,
MatrixWorkspace_sptr
vanaWS
)
{
int
calculatedDetectorElasticPeakPosition
=
-
1
;
...
...
@@ -191,7 +191,7 @@ int LoadILLINX::getEPPFromVanadium(const std::string &filenameVanadium,
/**
* Set the instrument name along with its path on the nexus file
*/
void
LoadILL
INX
::
loadInstrumentDetails
(
NeXus
::
NXEntry
&
firstEntry
)
{
void
LoadILL
TOF
::
loadInstrumentDetails
(
NeXus
::
NXEntry
&
firstEntry
)
{
m_instrumentPath
=
m_loader
.
findInstrumentNexusPath
(
firstEntry
);
...
...
@@ -221,7 +221,7 @@ void LoadILLINX::loadInstrumentDetails(NeXus::NXEntry &firstEntry) {
* @param monitors :: list of monitors content
*
*/
void
LoadILL
INX
::
initWorkSpace
(
NeXus
::
NXEntry
&
entry
,
void
LoadILL
TOF
::
initWorkSpace
(
NeXus
::
NXEntry
&
entry
,
const
std
::
vector
<
std
::
vector
<
int
>>
&
monitors
)
{
// read in the data
...
...
@@ -267,7 +267,7 @@ void LoadILLINX::initWorkSpace(NeXus::NXEntry &entry,
* Function to do specific instrument stuff
*
*/
void
LoadILL
INX
::
initInstrumentSpecific
()
{
void
LoadILL
TOF
::
initInstrumentSpecific
()
{
m_l1
=
m_loader
.
getL1
(
m_localWorkspace
);
// this will be mainly for IN5 (flat PSD detector)
m_l2
=
m_loader
.
getInstrumentProperty
(
m_localWorkspace
,
"l2"
);
...
...
@@ -281,7 +281,7 @@ void LoadILLINX::initInstrumentSpecific() {
* Load the time details from the nexus file.
* @param entry :: The Nexus entry
*/
void
LoadILL
INX
::
loadTimeDetails
(
NeXus
::
NXEntry
&
entry
)
{
void
LoadILL
TOF
::
loadTimeDetails
(
NeXus
::
NXEntry
&
entry
)
{
m_wavelength
=
entry
.
getFloat
(
"wavelength"
);
...
...
@@ -320,7 +320,7 @@ void LoadILLINX::loadTimeDetails(NeXus::NXEntry &entry) {
* as parameters in the workspace
* @param filename :: NeXus file
*/
void
LoadILL
INX
::
addAllNexusFieldsAsProperties
(
std
::
string
filename
)
{
void
LoadILL
TOF
::
addAllNexusFieldsAsProperties
(
std
::
string
filename
)
{
API
::
Run
&
runDetails
=
m_localWorkspace
->
mutableRun
();
...
...
@@ -345,7 +345,7 @@ void LoadILLINX::addAllNexusFieldsAsProperties(std::string filename) {
* Calculates the Energy from the wavelength and adds
* it at property Ei
*/
void
LoadILL
INX
::
addEnergyToRun
()
{
void
LoadILL
TOF
::
addEnergyToRun
()
{
API
::
Run
&
runDetails
=
m_localWorkspace
->
mutableRun
();
double
ei
=
m_loader
.
calculateEnergy
(
m_wavelength
);
...
...
@@ -362,7 +362,7 @@ void LoadILLINX::addEnergyToRun() {
* @param data :: spectra data
* @return detector Elastic Peak Position
*/
int
LoadILL
INX
::
getDetectorElasticPeakPosition
(
const
NeXus
::
NXInt
&
data
)
{
int
LoadILL
TOF
::
getDetectorElasticPeakPosition
(
const
NeXus
::
NXInt
&
data
)
{
// j = index in the equatorial line (256/2=128)
// both index 127 and 128 are in the equatorial line
...
...
@@ -420,7 +420,7 @@ int LoadILLINX::getDetectorElasticPeakPosition(const NeXus::NXInt &data) {
* @param filenameVanadium :: The path for the vanadium nexus file.
* @return The elastic peak position inside the tof channels.
*/
int
LoadILL
INX
::
validateVanadium
(
const
std
::
string
&
filenameVanadium
)
{
int
LoadILL
TOF
::
validateVanadium
(
const
std
::
string
&
filenameVanadium
)
{
NeXus
::
NXRoot
vanaRoot
(
filenameVanadium
);
NXEntry
vanaFirstEntry
=
vanaRoot
.
openFirstEntry
();
...
...
@@ -456,7 +456,7 @@ int LoadILLINX::validateVanadium(const std::string &filenameVanadium) {
*the elastic peak position at the detector.
*
*/
void
LoadILL
INX
::
loadDataIntoTheWorkSpace
(
void
LoadILL
TOF
::
loadDataIntoTheWorkSpace
(
NeXus
::
NXEntry
&
entry
,
const
std
::
vector
<
std
::
vector
<
int
>>
&
monitors
,
int
vanaCalculatedDetectorElasticPeakPosition
)
{
...
...
@@ -517,7 +517,7 @@ void LoadILLINX::loadDataIntoTheWorkSpace(
// Assign Error
MantidVec
&
E
=
m_localWorkspace
->
dataE
(
spec
);
std
::
transform
(
monitor
.
begin
(),
monitor
.
end
(),
E
.
begin
(),
LoadILL
INX
::
calculateError
);
LoadILL
TOF
::
calculateError
);
m_localWorkspace
->
getSpectrum
(
spec
).
setDetectorID
(
monitorIDs
[
spec
]);
++
spec
;
}
...
...
@@ -544,7 +544,7 @@ void LoadILLINX::loadDataIntoTheWorkSpace(
// Assign Error
MantidVec
&
E
=
m_localWorkspace
->
dataE
(
spec
);
std
::
transform
(
data_p
,
data_p
+
m_numberOfChannels
,
E
.
begin
(),
LoadILL
INX
::
calculateError
);
LoadILL
TOF
::
calculateError
);
m_localWorkspace
->
getSpectrum
(
spec
)
.
setDetectorID
(
detectorIDs
[
spec
-
numberOfMonitors
]);
++
spec
;
...
...
@@ -582,7 +582,7 @@ void LoadILLINX::loadDataIntoTheWorkSpace(
// Assign Error
MantidVec
&
E
=
m_localWorkspace
->
dataE
(
spec
);
std
::
transform
(
data_p
,
data_p
+
m_numberOfChannels
,
E
.
begin
(),
LoadILL
INX
::
calculateError
);
LoadILL
TOF
::
calculateError
);
++
spec
;
progressRosace
.
report
();
...
...
@@ -594,7 +594,7 @@ void LoadILLINX::loadDataIntoTheWorkSpace(
/**
* Run the Child Algorithm LoadInstrument.
*/
void
LoadILL
INX
::
runLoadInstrument
()
{
void
LoadILL
TOF
::
runLoadInstrument
()
{
IAlgorithm_sptr
loadInst
=
createChildAlgorithm
(
"LoadInstrument"
);
...
...
Framework/DataHandling/test/LoadILL
INX
Test.h
→
Framework/DataHandling/test/LoadILL
TOF
Test.h
View file @
27e5bd91
#ifndef LOADILL
INX
TEST_H_
#define LOADILL
INX
TEST_H_
#ifndef LOADILL
TOF
TEST_H_
#define LOADILL
TOF
TEST_H_
#include
<cxxtest/TestSuite.h>
#include
"MantidDataHandling/LoadILL
INX
.h"
#include
"MantidDataHandling/LoadILL
TOF
.h"
#include
"MantidAPI/AnalysisDataService.h"
#include
"MantidAPI/MatrixWorkspace.h"
using
namespace
Mantid
::
API
;
using
Mantid
::
DataHandling
::
LoadILL
INX
;
using
Mantid
::
DataHandling
::
LoadILL
TOF
;
class
LoadILL
INX
Test
:
public
CxxTest
::
TestSuite
{
class
LoadILL
TOF
Test
:
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
LoadILL
INX
Test
*
createSuite
()
{
return
new
LoadILL
INX
Test
();
}
static
void
destroySuite
(
LoadILL
INX
Test
*
suite
)
{
delete
suite
;
}
static
LoadILL
TOF
Test
*
createSuite
()
{
return
new
LoadILL
TOF
Test
();
}
static
void
destroySuite
(
LoadILL
TOF
Test
*
suite
)
{
delete
suite
;
}
void
testName
()
{
LoadILL
INX
loader
;
TS_ASSERT_EQUALS
(
loader
.
name
(),
"LoadILL
INX
"
);
LoadILL
TOF
loader
;
TS_ASSERT_EQUALS
(
loader
.
name
(),
"LoadILL
TOF
"
);
}
void
testVersion
()
{
LoadILL
INX
loader
;
LoadILL
TOF
loader
;
TS_ASSERT_EQUALS
(
loader
.
version
(),
1
);
}
void
testInit
()
{
LoadILL
INX
loader
;
LoadILL
TOF
loader
;
TS_ASSERT_THROWS_NOTHING
(
loader
.
initialize
());
TS_ASSERT
(
loader
.
isInitialized
());
}
...
...
@@ -37,11 +37,11 @@ public:
* The elastic peak is obtained on the fly from the sample data.
*/
void
loadDataFile
(
const
std
::
string
dataFile
,
const
int
numberOfHistograms
)
{
LoadILL
INX
loader
;
LoadILL
TOF
loader
;
loader
.
initialize
();
loader
.
setPropertyValue
(
"Filename"
,
dataFile
);
std
::
string
outputSpace
=
"LoadILL
INX
Test_out"
;
std
::
string
outputSpace
=
"LoadILL
TOF
Test_out"
;
loader
.
setPropertyValue
(
"OutputWorkspace"
,
outputSpace
);
TS_ASSERT_THROWS_NOTHING
(
loader
.
execute
());
...
...
@@ -65,12 +65,12 @@ public:
// Performance test
//------------------------------------------------------------------------------
class
LoadILL
INX
TestPerformance
:
public
CxxTest
::
TestSuite
{
class
LoadILL
TOF
TestPerformance
:
public
CxxTest
::
TestSuite
{
public:
LoadILL
INX
TestPerformance
()
:
m_dataFile
(
"ILL/IN5/104007.nxs"
)
{}
LoadILL
TOF
TestPerformance
()
:
m_dataFile
(
"ILL/IN5/104007.nxs"
)
{}
void
testDefaultLoad
()
{
Mantid
::
DataHandling
::
LoadILL
INX
loader
;
Mantid
::
DataHandling
::
LoadILL
TOF
loader
;
loader
.
initialize
();
loader
.
setPropertyValue
(
"Filename"
,
m_dataFile
);
loader
.
setPropertyValue
(
"OutputWorkspace"
,
"ws"
);
...
...
@@ -81,4 +81,4 @@ private:
std
::
string
m_dataFile
;
};
#endif
/*L
oadILLINX
TEST_H_*/
#endif
/*L
OADILLTOF
TEST_H_*/
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