Commit a3824d25 authored by Owen Arnold's avatar Owen Arnold
Browse files

refs #14124. Start fixing up DataHandling.

parent 5d01e8de
...@@ -62,7 +62,8 @@ public: ...@@ -62,7 +62,8 @@ public:
"HET_Definition.xml"; "HET_Definition.xml";
loader.setPropertyValue("Filename", inputFile); loader.setPropertyValue("Filename", inputFile);
loader.setPropertyValue("Workspace", this->inputSpace); loader.setPropertyValue("Workspace", this->inputSpace);
loader.setProperty("RewriteSpectraMap", false); loader.setProperty("OverwriteSpectraMap",
Mantid::Kernel::OptionalBool(false));
loader.execute(); loader.execute();
} }
......
...@@ -298,7 +298,8 @@ LoadIsawSpectrum::getInstrument3Ways(Algorithm *alg) { ...@@ -298,7 +298,8 @@ LoadIsawSpectrum::getInstrument3Ways(Algorithm *alg) {
childAlg->setProperty<MatrixWorkspace_sptr>("Workspace", tempWS); childAlg->setProperty<MatrixWorkspace_sptr>("Workspace", tempWS);
childAlg->setPropertyValue("Filename", InstrumentFilename); childAlg->setPropertyValue("Filename", InstrumentFilename);
childAlg->setPropertyValue("InstrumentName", InstrumentName); childAlg->setPropertyValue("InstrumentName", InstrumentName);
childAlg->setProperty("RewriteSpectraMap", false); childAlg->setProperty("OverwriteSpectraMap",
Mantid::Kernel::OptionalBool(false));
childAlg->executeAsChildAlg(); childAlg->executeAsChildAlg();
inst = tempWS->getInstrument(); inst = tempWS->getInstrument();
} }
......
...@@ -378,7 +378,8 @@ bool LoadEventNexus::runLoadInstrument(const std::string &nexusfilename, ...@@ -378,7 +378,8 @@ bool LoadEventNexus::runLoadInstrument(const std::string &nexusfilename,
loadInst->setPropertyValue("InstrumentName", instrument); loadInst->setPropertyValue("InstrumentName", instrument);
loadInst->setProperty<Mantid::API::MatrixWorkspace_sptr>("Workspace", loadInst->setProperty<Mantid::API::MatrixWorkspace_sptr>("Workspace",
localWorkspace); localWorkspace);
loadInst->setProperty("RewriteSpectraMap", false); loadInst->setProperty("OverwriteSpectraMap",
Mantid::Kernel::OptionalBool(false));
loadInst->execute(); loadInst->execute();
// Populate the instrument parameters in this workspace - this works around // Populate the instrument parameters in this workspace - this works around
......
...@@ -360,7 +360,7 @@ bool AppendGeometryToSNSNexus::runLoadInstrument( ...@@ -360,7 +360,7 @@ bool AppendGeometryToSNSNexus::runLoadInstrument(
try { try {
loadInst->setPropertyValue("Filename", idf_filename); loadInst->setPropertyValue("Filename", idf_filename);
loadInst->setProperty<MatrixWorkspace_sptr>("Workspace", localWorkspace); loadInst->setProperty<MatrixWorkspace_sptr>("Workspace", localWorkspace);
loadInst->setProperty("RewriteSpectraMap", false); loadInst->setProperty("OverwriteSpectraMap", OptionalBool(false));
loadInst->execute(); loadInst->execute();
} catch (std::invalid_argument &e) { } catch (std::invalid_argument &e) {
alg->getLogger().information( alg->getLogger().information(
......
#include "MantidKernel/OptionalBool.h"
#include "MantidAPI/FileProperty.h" #include "MantidAPI/FileProperty.h"
#include "MantidAPI/MatrixWorkspace.h" #include "MantidAPI/MatrixWorkspace.h"
#include "MantidAPI/ITableWorkspace.h" #include "MantidAPI/ITableWorkspace.h"
...@@ -375,6 +376,8 @@ Instrument_const_sptr CreateChunkingFromInstrument::getInstrument() { ...@@ -375,6 +376,8 @@ Instrument_const_sptr CreateChunkingFromInstrument::getInstrument() {
childAlg->setProperty<MatrixWorkspace_sptr>("Workspace", tempWS); childAlg->setProperty<MatrixWorkspace_sptr>("Workspace", tempWS);
childAlg->setPropertyValue("Filename", instFilename); childAlg->setPropertyValue("Filename", instFilename);
childAlg->setPropertyValue("InstrumentName", instName); childAlg->setPropertyValue("InstrumentName", instName);
childAlg->setProperty("OverwriteSpectraMap",
Mantid::Kernel::OptionalBool(true));
childAlg->executeAsChildAlg(); childAlg->executeAsChildAlg();
return tempWS->getInstrument(); return tempWS->getInstrument();
} }
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "MantidKernel/ArrayProperty.h" #include "MantidKernel/ArrayProperty.h"
#include "MantidKernel/ListValidator.h" #include "MantidKernel/ListValidator.h"
#include "MantidKernel/MandatoryValidator.h" #include "MantidKernel/MandatoryValidator.h"
#include "MantidKernel/OptionalBool.h"
#include "MantidKernel/RebinParamsValidator.h" #include "MantidKernel/RebinParamsValidator.h"
#include "MantidKernel/UnitFactory.h" #include "MantidKernel/UnitFactory.h"
#include "MantidKernel/VectorHelper.h" #include "MantidKernel/VectorHelper.h"
...@@ -103,6 +104,8 @@ void CreateSimulationWorkspace::createInstrument() { ...@@ -103,6 +104,8 @@ void CreateSimulationWorkspace::createInstrument() {
} else { } else {
loadInstrument->setPropertyValue("InstrumentName", instrProp); loadInstrument->setPropertyValue("InstrumentName", instrProp);
} }
loadInstrument->setProperty("OverwriteSpectraMap",
Kernel::OptionalBool(true));
loadInstrument->executeAsChildAlg(); loadInstrument->executeAsChildAlg();
tempWS = loadInstrument->getProperty("Workspace"); tempWS = loadInstrument->getProperty("Workspace");
......
...@@ -803,7 +803,8 @@ void FilterEventsByLogValuePreNexus::runLoadInstrument( ...@@ -803,7 +803,8 @@ void FilterEventsByLogValuePreNexus::runLoadInstrument(
// Now execute the Child Algorithm. Catch and log any error, but don't stop. // Now execute the Child Algorithm. Catch and log any error, but don't stop.
loadInst->setPropertyValue("InstrumentName", instrument); loadInst->setPropertyValue("InstrumentName", instrument);
loadInst->setProperty<MatrixWorkspace_sptr>("Workspace", localWorkspace); loadInst->setProperty<MatrixWorkspace_sptr>("Workspace", localWorkspace);
loadInst->setProperty("RewriteSpectraMap", false); loadInst->setProperty("OverwriteSpectraMap",
Mantid::Kernel::OptionalBool(false));
loadInst->executeAsChildAlg(); loadInst->executeAsChildAlg();
// Populate the instrument parameters in this workspace - this works around a // Populate the instrument parameters in this workspace - this works around a
......
...@@ -404,7 +404,8 @@ void LoadBBY::exec() { ...@@ -404,7 +404,8 @@ void LoadBBY::exec() {
createChildAlgorithm("LoadInstrument"); createChildAlgorithm("LoadInstrument");
loadInstrumentAlg->setProperty("Workspace", eventWS); loadInstrumentAlg->setProperty("Workspace", eventWS);
loadInstrumentAlg->setPropertyValue("InstrumentName", "BILBY"); loadInstrumentAlg->setPropertyValue("InstrumentName", "BILBY");
loadInstrumentAlg->setProperty("RewriteSpectraMap", false); loadInstrumentAlg->setProperty("OverwriteSpectraMap",
Mantid::Kernel::OptionalBool(false));
loadInstrumentAlg->executeAsChildAlg(); loadInstrumentAlg->executeAsChildAlg();
setProperty("OutputWorkspace", eventWS); setProperty("OutputWorkspace", eventWS);
......
...@@ -115,7 +115,8 @@ LoadCalFile::getInstrument3Ways(Algorithm *alg) { ...@@ -115,7 +115,8 @@ LoadCalFile::getInstrument3Ways(Algorithm *alg) {
childAlg->setProperty<MatrixWorkspace_sptr>("Workspace", tempWS); childAlg->setProperty<MatrixWorkspace_sptr>("Workspace", tempWS);
childAlg->setPropertyValue("Filename", InstrumentFilename); childAlg->setPropertyValue("Filename", InstrumentFilename);
childAlg->setPropertyValue("InstrumentName", InstrumentName); childAlg->setPropertyValue("InstrumentName", InstrumentName);
childAlg->setProperty("RewriteSpectraMap", false); childAlg->setProperty("OverwriteSpectraMap",
Mantid::Kernel::OptionalBool(false));
childAlg->executeAsChildAlg(); childAlg->executeAsChildAlg();
inst = tempWS->getInstrument(); inst = tempWS->getInstrument();
} }
......
...@@ -301,6 +301,8 @@ void LoadCanSAS1D::runLoadInstrument(const std::string &inst_name, ...@@ -301,6 +301,8 @@ void LoadCanSAS1D::runLoadInstrument(const std::string &inst_name,
loadInst->setPropertyValue("InstrumentName", inst_name); loadInst->setPropertyValue("InstrumentName", inst_name);
loadInst->setProperty<API::MatrixWorkspace_sptr>("Workspace", loadInst->setProperty<API::MatrixWorkspace_sptr>("Workspace",
localWorkspace); localWorkspace);
loadInst->setProperty("OverwriteSpectraMap",
Mantid::Kernel::OptionalBool(true));
loadInst->execute(); loadInst->execute();
} catch (std::invalid_argument &) { } catch (std::invalid_argument &) {
g_log.information("Invalid argument to LoadInstrument Child Algorithm"); g_log.information("Invalid argument to LoadInstrument Child Algorithm");
......
...@@ -98,7 +98,8 @@ void LoadDetectorsGroupingFile::exec() { ...@@ -98,7 +98,8 @@ void LoadDetectorsGroupingFile::exec() {
MatrixWorkspace_sptr tempWS(new DataObjects::Workspace2D()); MatrixWorkspace_sptr tempWS(new DataObjects::Workspace2D());
childAlg->setProperty<MatrixWorkspace_sptr>("Workspace", tempWS); childAlg->setProperty<MatrixWorkspace_sptr>("Workspace", tempWS);
childAlg->setPropertyValue("Filename", instrumentFilename); childAlg->setPropertyValue("Filename", instrumentFilename);
childAlg->setProperty("RewriteSpectraMap", false); childAlg->setProperty("OverwriteSpectraMap",
Mantid::Kernel::OptionalBool(false));
childAlg->executeAsChildAlg(); childAlg->executeAsChildAlg();
m_instrument = tempWS->getInstrument(); m_instrument = tempWS->getInstrument();
} }
......
...@@ -252,7 +252,8 @@ void LoadDiffCal::getInstrument(H5File &file) { ...@@ -252,7 +252,8 @@ void LoadDiffCal::getInstrument(H5File &file) {
} else { } else {
childAlg->setPropertyValue("Filename", idf); childAlg->setPropertyValue("Filename", idf);
} }
childAlg->setProperty("RewriteSpectraMap", false); childAlg->setProperty("OverwriteSpectraMap",
Mantid::Kernel::OptionalBool(false));
childAlg->executeAsChildAlg(); childAlg->executeAsChildAlg();
m_instrument = tempWS->getInstrument(); m_instrument = tempWS->getInstrument();
......
...@@ -173,6 +173,7 @@ API::MatrixWorkspace_sptr LoadEmptyInstrument::runLoadInstrument() { ...@@ -173,6 +173,7 @@ API::MatrixWorkspace_sptr LoadEmptyInstrument::runLoadInstrument() {
IAlgorithm_sptr loadInst = createChildAlgorithm("LoadInstrument", 0, 1); IAlgorithm_sptr loadInst = createChildAlgorithm("LoadInstrument", 0, 1);
loadInst->setPropertyValue("Filename", fullPathIDF); loadInst->setPropertyValue("Filename", fullPathIDF);
loadInst->setProperty("OverwriteSpectraMap", OptionalBool(true));
MatrixWorkspace_sptr ws = MatrixWorkspace_sptr ws =
WorkspaceFactory::Instance().create("Workspace2D", 1, 2, 1); WorkspaceFactory::Instance().create("Workspace2D", 1, 2, 1);
loadInst->setProperty<MatrixWorkspace_sptr>("Workspace", ws); loadInst->setProperty<MatrixWorkspace_sptr>("Workspace", ws);
......
...@@ -383,7 +383,8 @@ void LoadEventPreNexus::runLoadInstrument(const std::string &eventfilename, ...@@ -383,7 +383,8 @@ void LoadEventPreNexus::runLoadInstrument(const std::string &eventfilename,
// Now execute the Child Algorithm. Catch and log any error, but don't stop. // Now execute the Child Algorithm. Catch and log any error, but don't stop.
loadInst->setPropertyValue("InstrumentName", instrument); loadInst->setPropertyValue("InstrumentName", instrument);
loadInst->setProperty<MatrixWorkspace_sptr>("Workspace", localWorkspace); loadInst->setProperty<MatrixWorkspace_sptr>("Workspace", localWorkspace);
loadInst->setProperty("RewriteSpectraMap", false); loadInst->setProperty("OverwriteSpectraMap",
Mantid::Kernel::OptionalBool(false));
loadInst->executeAsChildAlg(); loadInst->executeAsChildAlg();
// Populate the instrument parameters in this workspace - this works around a // Populate the instrument parameters in this workspace - this works around a
......
...@@ -631,7 +631,8 @@ void LoadEventPreNexus2::runLoadInstrument( ...@@ -631,7 +631,8 @@ void LoadEventPreNexus2::runLoadInstrument(
// Now execute the Child Algorithm. Catch and log any error, but don't stop. // Now execute the Child Algorithm. Catch and log any error, but don't stop.
loadInst->setPropertyValue("InstrumentName", instrument); loadInst->setPropertyValue("InstrumentName", instrument);
loadInst->setProperty<MatrixWorkspace_sptr>("Workspace", localWorkspace); loadInst->setProperty<MatrixWorkspace_sptr>("Workspace", localWorkspace);
loadInst->setProperty("RewriteSpectraMap", false); loadInst->setProperty("OverwriteSpectraMap",
Mantid::Kernel::OptionalBool(false));
loadInst->executeAsChildAlg(); loadInst->executeAsChildAlg();
// Populate the instrument parameters in this workspace - this works around a // Populate the instrument parameters in this workspace - this works around a
......
...@@ -604,6 +604,8 @@ void LoadILL::runLoadInstrument() { ...@@ -604,6 +604,8 @@ void LoadILL::runLoadInstrument() {
try { try {
loadInst->setPropertyValue("InstrumentName", m_instrumentName); loadInst->setPropertyValue("InstrumentName", m_instrumentName);
loadInst->setProperty<MatrixWorkspace_sptr>("Workspace", m_localWorkspace); loadInst->setProperty<MatrixWorkspace_sptr>("Workspace", m_localWorkspace);
loadInst->setProperty("OverwriteSpectraMap",
Mantid::Kernel::OptionalBool(true));
loadInst->execute(); loadInst->execute();
} catch (...) { } catch (...) {
g_log.information("Cannot load the instrument definition."); g_log.information("Cannot load the instrument definition.");
......
...@@ -102,6 +102,8 @@ void LoadILLReflectometry::runLoadInstrument() { ...@@ -102,6 +102,8 @@ void LoadILLReflectometry::runLoadInstrument() {
try { try {
loadInst->setPropertyValue("InstrumentName", m_instrumentName); loadInst->setPropertyValue("InstrumentName", m_instrumentName);
loadInst->setProperty("OverwriteSpectraMap",
Mantid::Kernel::OptionalBool(true));
loadInst->setProperty<MatrixWorkspace_sptr>("Workspace", m_localWorkspace); loadInst->setProperty<MatrixWorkspace_sptr>("Workspace", m_localWorkspace);
loadInst->execute(); loadInst->execute();
......
...@@ -408,6 +408,8 @@ void LoadILLSANS::runLoadInstrument() { ...@@ -408,6 +408,8 @@ void LoadILLSANS::runLoadInstrument() {
try { try {
loadInst->setPropertyValue("InstrumentName", m_instrumentName); loadInst->setPropertyValue("InstrumentName", m_instrumentName);
loadInst->setProperty<MatrixWorkspace_sptr>("Workspace", m_localWorkspace); loadInst->setProperty<MatrixWorkspace_sptr>("Workspace", m_localWorkspace);
loadInst->setProperty("OverwriteSpectraMap",
Mantid::Kernel::OptionalBool(true));
loadInst->execute(); loadInst->execute();
} catch (...) { } catch (...) {
g_log.information("Cannot load the instrument definition."); g_log.information("Cannot load the instrument definition.");
......
...@@ -886,7 +886,8 @@ void LoadISISNexus2::runLoadInstrument( ...@@ -886,7 +886,8 @@ void LoadISISNexus2::runLoadInstrument(
try { try {
loadInst->setPropertyValue("InstrumentName", m_instrument_name); loadInst->setPropertyValue("InstrumentName", m_instrument_name);
loadInst->setProperty<MatrixWorkspace_sptr>("Workspace", localWorkspace); loadInst->setProperty<MatrixWorkspace_sptr>("Workspace", localWorkspace);
loadInst->setProperty("RewriteSpectraMap", false); loadInst->setProperty("OverwriteSpectraMap",
Mantid::Kernel::OptionalBool(false));
loadInst->execute(); loadInst->execute();
} catch (std::invalid_argument &) { } catch (std::invalid_argument &) {
g_log.information("Invalid argument to LoadInstrument Child Algorithm"); g_log.information("Invalid argument to LoadInstrument Child Algorithm");
......
...@@ -197,8 +197,8 @@ void LoadInstrument::exec() { ...@@ -197,8 +197,8 @@ void LoadInstrument::exec() {
// Rebuild the spectra map for this workspace so that it matches the // Rebuild the spectra map for this workspace so that it matches the
// instrument // instrument
// if required // if required
const OptionalBool rewriteSpectraMap = getProperty("OverwriteSpectraMap"); const OptionalBool OverwriteSpectraMap = getProperty("OverwriteSpectraMap");
if (rewriteSpectraMap == OptionalBool::True) if (OverwriteSpectraMap == OptionalBool::True)
m_workspace->rebuildSpectraMapping(); m_workspace->rebuildSpectraMapping();
} }
......
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