diff --git a/Framework/DataHandling/src/LoadISISNexus2.cpp b/Framework/DataHandling/src/LoadISISNexus2.cpp index fbf9e4897460198e22657622d917e32fbef37cec..32742e3cffd3b15a38dc3c5ddfdc661edd3462c2 100644 --- a/Framework/DataHandling/src/LoadISISNexus2.cpp +++ b/Framework/DataHandling/src/LoadISISNexus2.cpp @@ -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); diff --git a/Framework/DataHandling/src/LoadNexusLogs.cpp b/Framework/DataHandling/src/LoadNexusLogs.cpp index 927184c5f641a2ced602aa5ec75405133814cce0..278e8761ba901e8dc3e2fef95f59df97f20dbacc 100644 --- a/Framework/DataHandling/src/LoadNexusLogs.cpp +++ b/Framework/DataHandling/src/LoadNexusLogs.cpp @@ -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 diff --git a/MantidQt/CustomInterfaces/src/ReflLegacyTransferStrategy.cpp b/MantidQt/CustomInterfaces/src/ReflLegacyTransferStrategy.cpp index 00ae00f823f4972f570d83a8f8e74da8b4ea4564..ca5d75ac4199cd782efe817f81c112d602247655 100644 --- a/MantidQt/CustomInterfaces/src/ReflLegacyTransferStrategy.cpp +++ b/MantidQt/CustomInterfaces/src/ReflLegacyTransferStrategy.cpp @@ -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 '+' diff --git a/MantidQt/CustomInterfaces/src/ReflMeasureTransferStrategy.cpp b/MantidQt/CustomInterfaces/src/ReflMeasureTransferStrategy.cpp index 9254ac0cb871fa9b0f9a3bf3bfd3cd519445e960..6976db501c0cce4c24968db07c1ef7214219cb1b 100644 --- a/MantidQt/CustomInterfaces/src/ReflMeasureTransferStrategy.cpp +++ b/MantidQt/CustomInterfaces/src/ReflMeasureTransferStrategy.cpp @@ -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.