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