Skip to content
Snippets Groups Projects
Commit 1b768211 authored by Owen Arnold's avatar Owen Arnold
Browse files

refs #13989. Load Logs Rather than LoadISISNexus.

We only need to load the logs for the measurement information.
parent 964b0053
No related branches found
No related tags found
No related merge requests found
......@@ -39,52 +39,6 @@
namespace Mantid {
namespace DataHandling {
namespace {
/**
* @brief loadAndApplyMeasurementInfo
* @param file : Nexus::File pointer
* @param workspace : Pointer to the workspace to set logs on
* @return True only if reading and execution successful.
*/
bool loadAndApplyMeasurementInfo(::NeXus::File *const file,
DataObjects::Workspace2D &workspace) {
bool successfullyApplied = false;
try {
file->openGroup("measurement", "NXcollection");
// If we can open the measurement group. We assume that the following will
// be avaliable.
file->openData("id");
workspace.mutableRun().addLogData(
new Mantid::Kernel::PropertyWithValue<std::string>("measurement_id",
file->getStrData()));
file->closeData();
file->openData("label");
workspace.mutableRun().addLogData(
new Mantid::Kernel::PropertyWithValue<std::string>("measurement_label",
file->getStrData()));
file->closeData();
file->openData("subid");
workspace.mutableRun().addLogData(
new Mantid::Kernel::PropertyWithValue<std::string>("measurement_subid",
file->getStrData()));
file->closeData();
file->openData("type");
workspace.mutableRun().addLogData(
new Mantid::Kernel::PropertyWithValue<std::string>("measurement_type",
file->getStrData()));
file->closeData();
file->closeGroup();
successfullyApplied = true;
} catch (::NeXus::Exception &) {
successfullyApplied = false;
}
return successfullyApplied;
}
}
DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadISISNexus2)
using namespace Kernel;
......@@ -298,8 +252,6 @@ void LoadISISNexus2::exec() {
m_cppFile->openPath(entry.path());
local_workspace->loadSampleAndLogInfoNexus(m_cppFile.get());
loadAndApplyMeasurementInfo(m_cppFile.get(), *local_workspace);
// Load logs and sample information further information... See maintenance
// ticket #8697
loadSampleData(local_workspace, entry);
......
......@@ -28,6 +28,52 @@ using API::MatrixWorkspace_sptr;
using API::FileProperty;
using std::size_t;
namespace {
/**
* @brief loadAndApplyMeasurementInfo
* @param file : Nexus::File pointer
* @param workspace : Pointer to the workspace to set logs on
* @return True only if reading and execution successful.
*/
bool loadAndApplyMeasurementInfo(::NeXus::File *const file,
API::MatrixWorkspace &workspace) {
bool successfullyApplied = false;
try {
file->openGroup("measurement", "NXcollection");
// If we can open the measurement group. We assume that the following will
// be avaliable.
file->openData("id");
workspace.mutableRun().addLogData(
new Mantid::Kernel::PropertyWithValue<std::string>("measurement_id",
file->getStrData()));
file->closeData();
file->openData("label");
workspace.mutableRun().addLogData(
new Mantid::Kernel::PropertyWithValue<std::string>("measurement_label",
file->getStrData()));
file->closeData();
file->openData("subid");
workspace.mutableRun().addLogData(
new Mantid::Kernel::PropertyWithValue<std::string>("measurement_subid",
file->getStrData()));
file->closeData();
file->openData("type");
workspace.mutableRun().addLogData(
new Mantid::Kernel::PropertyWithValue<std::string>("measurement_type",
file->getStrData()));
file->closeData();
file->closeGroup();
successfullyApplied = true;
} catch (::NeXus::Exception &) {
successfullyApplied = false;
}
return successfullyApplied;
}
}
/// Empty default constructor
LoadNexusLogs::LoadNexusLogs() {}
......@@ -124,6 +170,9 @@ void LoadNexusLogs::exec() {
}
}
// If there's measurement information, load that info as logs.
loadAndApplyMeasurementInfo(&file, *workspace);
// Freddie Akeroyd 12/10/2011
// current ISIS implementation contains an additional indirection between
// collected frames via an
......
......@@ -10,8 +10,8 @@ namespace MantidQt
namespace CustomInterfaces
{
std::vector<std::map<std::string, std::string>>
ReflLegacyTransferStrategy::transferRuns(SearchResultMap &searchResults,
Mantid::Kernel::ProgressBase &progress) {
ReflLegacyTransferStrategy::transferRuns(
SearchResultMap &searchResults, Mantid::Kernel::ProgressBase &progress) {
/*
* If the descriptions are the same except for theta: same group, different rows.
* If the descriptions are the same including theta: same row with runs separated by '+'
......
......@@ -40,8 +40,7 @@ ReflMeasureTransferStrategy::~ReflMeasureTransferStrategy() {}
std::vector<std::map<std::string, std::string>>
MantidQt::CustomInterfaces::ReflMeasureTransferStrategy::transferRuns(
SearchResultMap &searchResults,
Mantid::Kernel::ProgressBase &progress) {
SearchResultMap &searchResults, Mantid::Kernel::ProgressBase &progress) {
typedef std::vector<Measurement> VecSameMeasurement;
typedef std::map<Measurement::IDType, VecSameMeasurement>
......@@ -68,9 +67,8 @@ MantidQt::CustomInterfaces::ReflMeasureTransferStrategy::transferRuns(
// Add to existing group
mapOfMeasurements[metaData.id()].push_back(metaData);
}
}
else{
it->second.issues = metaData.whyUnuseable();
} else {
it->second.issues = metaData.whyUnuseable();
}
// Obtaining metadata could take time.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment