Commit 27e5bd91 authored by Ian Bush's avatar Ian Bush
Browse files

Refs #17065 Renamed LoadILLINX to LoadILLTOF

parent ee119a2e
...@@ -55,7 +55,7 @@ set ( SRC_FILES ...@@ -55,7 +55,7 @@ set ( SRC_FILES
src/LoadIDFFromNexus.cpp src/LoadIDFFromNexus.cpp
src/LoadILL.cpp src/LoadILL.cpp
src/LoadILLIndirect.cpp src/LoadILLIndirect.cpp
src/LoadILLINX.cpp src/LoadILLTOF.cpp
src/LoadILLReflectometry.cpp src/LoadILLReflectometry.cpp
src/LoadILLSANS.cpp src/LoadILLSANS.cpp
src/LoadISISNexus2.cpp src/LoadISISNexus2.cpp
...@@ -233,7 +233,7 @@ set ( INC_FILES ...@@ -233,7 +233,7 @@ set ( INC_FILES
inc/MantidDataHandling/LoadIDFFromNexus.h inc/MantidDataHandling/LoadIDFFromNexus.h
inc/MantidDataHandling/LoadILL.h inc/MantidDataHandling/LoadILL.h
inc/MantidDataHandling/LoadILLIndirect.h inc/MantidDataHandling/LoadILLIndirect.h
inc/MantidDataHandling/LoadILLINX.h inc/MantidDataHandling/LoadILLTOF.h
inc/MantidDataHandling/LoadILLReflectometry.h inc/MantidDataHandling/LoadILLReflectometry.h
inc/MantidDataHandling/LoadILLSANS.h inc/MantidDataHandling/LoadILLSANS.h
inc/MantidDataHandling/LoadISISNexus2.h inc/MantidDataHandling/LoadISISNexus2.h
...@@ -404,7 +404,7 @@ set ( TEST_FILES ...@@ -404,7 +404,7 @@ set ( TEST_FILES
LoadGSSTest.h LoadGSSTest.h
LoadIDFFromNexusTest.h LoadIDFFromNexusTest.h
LoadILLIndirectTest.h LoadILLIndirectTest.h
LoadILLINXTest.h LoadILLTOFTest.h
LoadILLReflectometryTest.h LoadILLReflectometryTest.h
LoadILLSANSTest.h LoadILLSANSTest.h
LoadISISNexusTest.h LoadISISNexusTest.h
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#include "MantidNexus/NexusClasses.h" #include "MantidNexus/NexusClasses.h"
#include "MantidDataHandling/LoadHelper.h" #include "MantidDataHandling/LoadHelper.h"
#include "MantidAPI/DeprecatedAlgorithm.h" #include "MantidAPI/DeprecatedAlgorithm.h"
#include "MantidDataHandling/LoadILLINX.h" #include "MantidDataHandling/LoadILLTOF.h"
namespace Mantid { namespace Mantid {
namespace DataHandling { namespace DataHandling {
...@@ -33,7 +33,7 @@ namespace DataHandling { ...@@ -33,7 +33,7 @@ namespace DataHandling {
File change history is stored at: <https://github.com/mantidproject/mantid> File change history is stored at: <https://github.com/mantidproject/mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org> Code Documentation is available at: <http://doxygen.mantidproject.org>
*/ */
class DLLExport LoadILL : public LoadILLINX, public API::DeprecatedAlgorithm { class DLLExport LoadILL : public LoadILLTOF, public API::DeprecatedAlgorithm {
public: public:
/// Constructor /// Constructor
LoadILL(); LoadILL();
......
#ifndef MANTID_DATAHANDLING_LOADILLINX_H_ #ifndef MANTID_DATAHANDLING_LOADILLTOF_H_
#define MANTID_DATAHANDLING_LOADILLINX_H_ #define MANTID_DATAHANDLING_LOADILLTOF_H_
//--------------------------------------------------- //---------------------------------------------------
// Includes // Includes
...@@ -34,12 +34,12 @@ namespace DataHandling { ...@@ -34,12 +34,12 @@ namespace DataHandling {
File change history is stored at: <https://github.com/mantidproject/mantid> File change history is stored at: <https://github.com/mantidproject/mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org> Code Documentation is available at: <http://doxygen.mantidproject.org>
*/ */
class DLLExport LoadILLINX : public API::IFileLoader<Kernel::NexusDescriptor> { class DLLExport LoadILLTOF : public API::IFileLoader<Kernel::NexusDescriptor> {
public: public:
/// Constructor /// Constructor
LoadILLINX(); LoadILLTOF();
/// Algorithm's name /// Algorithm's name
const std::string name() const override { return "LoadILLINX"; } const std::string name() const override { return "LoadILLTOF"; }
/// Summary of algorithms purpose /// Summary of algorithms purpose
const std::string summary() const override { const std::string summary() const override {
return "Loads an ILL ToF NeXus file."; return "Loads an ILL ToF NeXus file.";
...@@ -111,4 +111,4 @@ private: ...@@ -111,4 +111,4 @@ private:
} // namespace DataHandling } // namespace DataHandling
} // namespace Mantid } // namespace Mantid
#endif /*MANTID_DATAHANDLING_LoadILLINX_H_*/ #endif /*MANTID_DATAHANDLING_LOADILLTOF_H_*/
...@@ -10,7 +10,7 @@ namespace DataHandling { ...@@ -10,7 +10,7 @@ namespace DataHandling {
DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadILL) DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadILL)
/// Constructor /// Constructor
LoadILL::LoadILL() : LoadILLINX() { this->useAlgorithm("LoadILLINX", 1); } LoadILL::LoadILL() : LoadILLTOF() { this->useAlgorithm("LoadILLTOF", 1); }
/** /**
* Return the confidence with with this algorithm can load the file * Return the confidence with with this algorithm can load the file
......
//--------------------------------------------------- //---------------------------------------------------
// Includes // Includes
//--------------------------------------------------- //---------------------------------------------------
#include "MantidDataHandling/LoadILLINX.h" #include "MantidDataHandling/LoadILLTOF.h"
#include "MantidAPI/Axis.h" #include "MantidAPI/Axis.h"
#include "MantidAPI/FileProperty.h" #include "MantidAPI/FileProperty.h"
...@@ -18,7 +18,7 @@ using namespace Kernel; ...@@ -18,7 +18,7 @@ using namespace Kernel;
using namespace API; using namespace API;
using namespace NeXus; using namespace NeXus;
DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadILLINX) DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadILLTOF)
//--------------------------------------------------- //---------------------------------------------------
// Private member functions // Private member functions
...@@ -30,7 +30,7 @@ DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadILLINX) ...@@ -30,7 +30,7 @@ DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadILLINX)
* @returns An integer specifying the confidence level. 0 indicates it will not * @returns An integer specifying the confidence level. 0 indicates it will not
* be used * be used
*/ */
int LoadILLINX::confidence(Kernel::NexusDescriptor &descriptor) const { int LoadILLTOF::confidence(Kernel::NexusDescriptor &descriptor) const {
// fields existent only at the ILL // fields existent only at the ILL
if (descriptor.pathExists("/entry0/wavelength") && if (descriptor.pathExists("/entry0/wavelength") &&
...@@ -49,7 +49,7 @@ int LoadILLINX::confidence(Kernel::NexusDescriptor &descriptor) const { ...@@ -49,7 +49,7 @@ int LoadILLINX::confidence(Kernel::NexusDescriptor &descriptor) const {
} }
} }
LoadILLINX::LoadILLINX() : API::IFileLoader<Kernel::NexusDescriptor>() { LoadILLTOF::LoadILLTOF() : API::IFileLoader<Kernel::NexusDescriptor>() {
m_instrumentName = ""; m_instrumentName = "";
m_wavelength = 0; m_wavelength = 0;
m_channelWidth = 0; m_channelWidth = 0;
...@@ -68,7 +68,7 @@ LoadILLINX::LoadILLINX() : API::IFileLoader<Kernel::NexusDescriptor>() { ...@@ -68,7 +68,7 @@ LoadILLINX::LoadILLINX() : API::IFileLoader<Kernel::NexusDescriptor>() {
/** /**
* Initialise the algorithm * Initialise the algorithm
*/ */
void LoadILLINX::init() { void LoadILLTOF::init() {
declareProperty( declareProperty(
make_unique<FileProperty>("Filename", "", FileProperty::Load, ".nxs"), make_unique<FileProperty>("Filename", "", FileProperty::Load, ".nxs"),
"File path of the Data file to load"); "File path of the Data file to load");
...@@ -90,7 +90,7 @@ void LoadILLINX::init() { ...@@ -90,7 +90,7 @@ void LoadILLINX::init() {
/** /**
* Execute the algorithm * Execute the algorithm
*/ */
void LoadILLINX::exec() { void LoadILLTOF::exec() {
// Retrieve filename // Retrieve filename
std::string filenameData = getPropertyValue("Filename"); std::string filenameData = getPropertyValue("Filename");
std::string filenameVanadium = getPropertyValue("FilenameVanadium"); std::string filenameVanadium = getPropertyValue("FilenameVanadium");
...@@ -132,7 +132,7 @@ void LoadILLINX::exec() { ...@@ -132,7 +132,7 @@ void LoadILLINX::exec() {
* @return : list of monitor data * @return : list of monitor data
*/ */
std::vector<std::vector<int>> std::vector<std::vector<int>>
LoadILLINX::getMonitorInfo(NeXus::NXEntry &firstEntry) { LoadILLTOF::getMonitorInfo(NeXus::NXEntry &firstEntry) {
std::vector<std::vector<int>> monitorList; std::vector<std::vector<int>> monitorList;
...@@ -162,7 +162,7 @@ LoadILLINX::getMonitorInfo(NeXus::NXEntry &firstEntry) { ...@@ -162,7 +162,7 @@ LoadILLINX::getMonitorInfo(NeXus::NXEntry &firstEntry) {
* or filename. * or filename.
* @return the EPP * @return the EPP
*/ */
int LoadILLINX::getEPPFromVanadium(const std::string &filenameVanadium, int LoadILLTOF::getEPPFromVanadium(const std::string &filenameVanadium,
MatrixWorkspace_sptr vanaWS) { MatrixWorkspace_sptr vanaWS) {
int calculatedDetectorElasticPeakPosition = -1; int calculatedDetectorElasticPeakPosition = -1;
...@@ -191,7 +191,7 @@ int LoadILLINX::getEPPFromVanadium(const std::string &filenameVanadium, ...@@ -191,7 +191,7 @@ int LoadILLINX::getEPPFromVanadium(const std::string &filenameVanadium,
/** /**
* Set the instrument name along with its path on the nexus file * Set the instrument name along with its path on the nexus file
*/ */
void LoadILLINX::loadInstrumentDetails(NeXus::NXEntry &firstEntry) { void LoadILLTOF::loadInstrumentDetails(NeXus::NXEntry &firstEntry) {
m_instrumentPath = m_loader.findInstrumentNexusPath(firstEntry); m_instrumentPath = m_loader.findInstrumentNexusPath(firstEntry);
...@@ -221,7 +221,7 @@ void LoadILLINX::loadInstrumentDetails(NeXus::NXEntry &firstEntry) { ...@@ -221,7 +221,7 @@ void LoadILLINX::loadInstrumentDetails(NeXus::NXEntry &firstEntry) {
* @param monitors :: list of monitors content * @param monitors :: list of monitors content
* *
*/ */
void LoadILLINX::initWorkSpace(NeXus::NXEntry &entry, void LoadILLTOF::initWorkSpace(NeXus::NXEntry &entry,
const std::vector<std::vector<int>> &monitors) { const std::vector<std::vector<int>> &monitors) {
// read in the data // read in the data
...@@ -267,7 +267,7 @@ void LoadILLINX::initWorkSpace(NeXus::NXEntry &entry, ...@@ -267,7 +267,7 @@ void LoadILLINX::initWorkSpace(NeXus::NXEntry &entry,
* Function to do specific instrument stuff * Function to do specific instrument stuff
* *
*/ */
void LoadILLINX::initInstrumentSpecific() { void LoadILLTOF::initInstrumentSpecific() {
m_l1 = m_loader.getL1(m_localWorkspace); m_l1 = m_loader.getL1(m_localWorkspace);
// this will be mainly for IN5 (flat PSD detector) // this will be mainly for IN5 (flat PSD detector)
m_l2 = m_loader.getInstrumentProperty(m_localWorkspace, "l2"); m_l2 = m_loader.getInstrumentProperty(m_localWorkspace, "l2");
...@@ -281,7 +281,7 @@ void LoadILLINX::initInstrumentSpecific() { ...@@ -281,7 +281,7 @@ void LoadILLINX::initInstrumentSpecific() {
* Load the time details from the nexus file. * Load the time details from the nexus file.
* @param entry :: The Nexus entry * @param entry :: The Nexus entry
*/ */
void LoadILLINX::loadTimeDetails(NeXus::NXEntry &entry) { void LoadILLTOF::loadTimeDetails(NeXus::NXEntry &entry) {
m_wavelength = entry.getFloat("wavelength"); m_wavelength = entry.getFloat("wavelength");
...@@ -320,7 +320,7 @@ void LoadILLINX::loadTimeDetails(NeXus::NXEntry &entry) { ...@@ -320,7 +320,7 @@ void LoadILLINX::loadTimeDetails(NeXus::NXEntry &entry) {
* as parameters in the workspace * as parameters in the workspace
* @param filename :: NeXus file * @param filename :: NeXus file
*/ */
void LoadILLINX::addAllNexusFieldsAsProperties(std::string filename) { void LoadILLTOF::addAllNexusFieldsAsProperties(std::string filename) {
API::Run &runDetails = m_localWorkspace->mutableRun(); API::Run &runDetails = m_localWorkspace->mutableRun();
...@@ -345,7 +345,7 @@ void LoadILLINX::addAllNexusFieldsAsProperties(std::string filename) { ...@@ -345,7 +345,7 @@ void LoadILLINX::addAllNexusFieldsAsProperties(std::string filename) {
* Calculates the Energy from the wavelength and adds * Calculates the Energy from the wavelength and adds
* it at property Ei * it at property Ei
*/ */
void LoadILLINX::addEnergyToRun() { void LoadILLTOF::addEnergyToRun() {
API::Run &runDetails = m_localWorkspace->mutableRun(); API::Run &runDetails = m_localWorkspace->mutableRun();
double ei = m_loader.calculateEnergy(m_wavelength); double ei = m_loader.calculateEnergy(m_wavelength);
...@@ -362,7 +362,7 @@ void LoadILLINX::addEnergyToRun() { ...@@ -362,7 +362,7 @@ void LoadILLINX::addEnergyToRun() {
* @param data :: spectra data * @param data :: spectra data
* @return detector Elastic Peak Position * @return detector Elastic Peak Position
*/ */
int LoadILLINX::getDetectorElasticPeakPosition(const NeXus::NXInt &data) { int LoadILLTOF::getDetectorElasticPeakPosition(const NeXus::NXInt &data) {
// j = index in the equatorial line (256/2=128) // j = index in the equatorial line (256/2=128)
// both index 127 and 128 are in the equatorial line // both index 127 and 128 are in the equatorial line
...@@ -420,7 +420,7 @@ int LoadILLINX::getDetectorElasticPeakPosition(const NeXus::NXInt &data) { ...@@ -420,7 +420,7 @@ int LoadILLINX::getDetectorElasticPeakPosition(const NeXus::NXInt &data) {
* @param filenameVanadium :: The path for the vanadium nexus file. * @param filenameVanadium :: The path for the vanadium nexus file.
* @return The elastic peak position inside the tof channels. * @return The elastic peak position inside the tof channels.
*/ */
int LoadILLINX::validateVanadium(const std::string &filenameVanadium) { int LoadILLTOF::validateVanadium(const std::string &filenameVanadium) {
NeXus::NXRoot vanaRoot(filenameVanadium); NeXus::NXRoot vanaRoot(filenameVanadium);
NXEntry vanaFirstEntry = vanaRoot.openFirstEntry(); NXEntry vanaFirstEntry = vanaRoot.openFirstEntry();
...@@ -456,7 +456,7 @@ int LoadILLINX::validateVanadium(const std::string &filenameVanadium) { ...@@ -456,7 +456,7 @@ int LoadILLINX::validateVanadium(const std::string &filenameVanadium) {
*the elastic peak position at the detector. *the elastic peak position at the detector.
* *
*/ */
void LoadILLINX::loadDataIntoTheWorkSpace( void LoadILLTOF::loadDataIntoTheWorkSpace(
NeXus::NXEntry &entry, const std::vector<std::vector<int>> &monitors, NeXus::NXEntry &entry, const std::vector<std::vector<int>> &monitors,
int vanaCalculatedDetectorElasticPeakPosition) { int vanaCalculatedDetectorElasticPeakPosition) {
...@@ -517,7 +517,7 @@ void LoadILLINX::loadDataIntoTheWorkSpace( ...@@ -517,7 +517,7 @@ void LoadILLINX::loadDataIntoTheWorkSpace(
// Assign Error // Assign Error
MantidVec &E = m_localWorkspace->dataE(spec); MantidVec &E = m_localWorkspace->dataE(spec);
std::transform(monitor.begin(), monitor.end(), E.begin(), std::transform(monitor.begin(), monitor.end(), E.begin(),
LoadILLINX::calculateError); LoadILLTOF::calculateError);
m_localWorkspace->getSpectrum(spec).setDetectorID(monitorIDs[spec]); m_localWorkspace->getSpectrum(spec).setDetectorID(monitorIDs[spec]);
++spec; ++spec;
} }
...@@ -544,7 +544,7 @@ void LoadILLINX::loadDataIntoTheWorkSpace( ...@@ -544,7 +544,7 @@ void LoadILLINX::loadDataIntoTheWorkSpace(
// Assign Error // Assign Error
MantidVec &E = m_localWorkspace->dataE(spec); MantidVec &E = m_localWorkspace->dataE(spec);
std::transform(data_p, data_p + m_numberOfChannels, E.begin(), std::transform(data_p, data_p + m_numberOfChannels, E.begin(),
LoadILLINX::calculateError); LoadILLTOF::calculateError);
m_localWorkspace->getSpectrum(spec) m_localWorkspace->getSpectrum(spec)
.setDetectorID(detectorIDs[spec - numberOfMonitors]); .setDetectorID(detectorIDs[spec - numberOfMonitors]);
++spec; ++spec;
...@@ -582,7 +582,7 @@ void LoadILLINX::loadDataIntoTheWorkSpace( ...@@ -582,7 +582,7 @@ void LoadILLINX::loadDataIntoTheWorkSpace(
// Assign Error // Assign Error
MantidVec &E = m_localWorkspace->dataE(spec); MantidVec &E = m_localWorkspace->dataE(spec);
std::transform(data_p, data_p + m_numberOfChannels, E.begin(), std::transform(data_p, data_p + m_numberOfChannels, E.begin(),
LoadILLINX::calculateError); LoadILLTOF::calculateError);
++spec; ++spec;
progressRosace.report(); progressRosace.report();
...@@ -594,7 +594,7 @@ void LoadILLINX::loadDataIntoTheWorkSpace( ...@@ -594,7 +594,7 @@ void LoadILLINX::loadDataIntoTheWorkSpace(
/** /**
* Run the Child Algorithm LoadInstrument. * Run the Child Algorithm LoadInstrument.
*/ */
void LoadILLINX::runLoadInstrument() { void LoadILLTOF::runLoadInstrument() {
IAlgorithm_sptr loadInst = createChildAlgorithm("LoadInstrument"); IAlgorithm_sptr loadInst = createChildAlgorithm("LoadInstrument");
......
#ifndef LOADILLINXTEST_H_ #ifndef LOADILLTOFTEST_H_
#define LOADILLINXTEST_H_ #define LOADILLTOFTEST_H_
#include <cxxtest/TestSuite.h> #include <cxxtest/TestSuite.h>
#include "MantidDataHandling/LoadILLINX.h" #include "MantidDataHandling/LoadILLTOF.h"
#include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/AnalysisDataService.h"
#include "MantidAPI/MatrixWorkspace.h" #include "MantidAPI/MatrixWorkspace.h"
using namespace Mantid::API; using namespace Mantid::API;
using Mantid::DataHandling::LoadILLINX; using Mantid::DataHandling::LoadILLTOF;
class LoadILLINXTest : public CxxTest::TestSuite { class LoadILLTOFTest : public CxxTest::TestSuite {
public: public:
// This pair of boilerplate methods prevent the suite being created statically // This pair of boilerplate methods prevent the suite being created statically
// This means the constructor isn't called when running other tests // This means the constructor isn't called when running other tests
static LoadILLINXTest *createSuite() { return new LoadILLINXTest(); } static LoadILLTOFTest *createSuite() { return new LoadILLTOFTest(); }
static void destroySuite(LoadILLINXTest *suite) { delete suite; } static void destroySuite(LoadILLTOFTest *suite) { delete suite; }
void testName() { void testName() {
LoadILLINX loader; LoadILLTOF loader;
TS_ASSERT_EQUALS(loader.name(), "LoadILLINX"); TS_ASSERT_EQUALS(loader.name(), "LoadILLTOF");
} }
void testVersion() { void testVersion() {
LoadILLINX loader; LoadILLTOF loader;
TS_ASSERT_EQUALS(loader.version(), 1); TS_ASSERT_EQUALS(loader.version(), 1);
} }
void testInit() { void testInit() {
LoadILLINX loader; LoadILLTOF loader;
TS_ASSERT_THROWS_NOTHING(loader.initialize()); TS_ASSERT_THROWS_NOTHING(loader.initialize());
TS_ASSERT(loader.isInitialized()); TS_ASSERT(loader.isInitialized());
} }
...@@ -37,11 +37,11 @@ public: ...@@ -37,11 +37,11 @@ public:
* The elastic peak is obtained on the fly from the sample data. * The elastic peak is obtained on the fly from the sample data.
*/ */
void loadDataFile(const std::string dataFile, const int numberOfHistograms) { void loadDataFile(const std::string dataFile, const int numberOfHistograms) {
LoadILLINX loader; LoadILLTOF loader;
loader.initialize(); loader.initialize();
loader.setPropertyValue("Filename", dataFile); loader.setPropertyValue("Filename", dataFile);
std::string outputSpace = "LoadILLINXTest_out"; std::string outputSpace = "LoadILLTOFTest_out";
loader.setPropertyValue("OutputWorkspace", outputSpace); loader.setPropertyValue("OutputWorkspace", outputSpace);
TS_ASSERT_THROWS_NOTHING(loader.execute()); TS_ASSERT_THROWS_NOTHING(loader.execute());
...@@ -65,12 +65,12 @@ public: ...@@ -65,12 +65,12 @@ public:
// Performance test // Performance test
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
class LoadILLINXTestPerformance : public CxxTest::TestSuite { class LoadILLTOFTestPerformance : public CxxTest::TestSuite {
public: public:
LoadILLINXTestPerformance() : m_dataFile("ILL/IN5/104007.nxs") {} LoadILLTOFTestPerformance() : m_dataFile("ILL/IN5/104007.nxs") {}
void testDefaultLoad() { void testDefaultLoad() {
Mantid::DataHandling::LoadILLINX loader; Mantid::DataHandling::LoadILLTOF loader;
loader.initialize(); loader.initialize();
loader.setPropertyValue("Filename", m_dataFile); loader.setPropertyValue("Filename", m_dataFile);
loader.setPropertyValue("OutputWorkspace", "ws"); loader.setPropertyValue("OutputWorkspace", "ws");
...@@ -81,4 +81,4 @@ private: ...@@ -81,4 +81,4 @@ private:
std::string m_dataFile; std::string m_dataFile;
}; };
#endif /*LoadILLINXTEST_H_*/ #endif /*LOADILLTOFTEST_H_*/
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment