Skip to content
Snippets Groups Projects
Commit 57d5e201 authored by William F Godoy's avatar William F Godoy
Browse files

Refactored LoadEntryMetadata

parent 8094ff65
No related branches found
No related tags found
No related merge requests found
...@@ -603,10 +603,8 @@ void LoadEventNexus::loadEntryMetadata( ...@@ -603,10 +603,8 @@ void LoadEventNexus::loadEntryMetadata(
::NeXus::File file(nexusfilename); ::NeXus::File file(nexusfilename);
file.openGroup(entry_name, "NXentry"); file.openGroup(entry_name, "NXentry");
const std::map<std::string, std::string> entriesNxentry = file.getEntries();
// get the title // get the title
if (descriptor.isEntry("/" + entry_name + "/title", "NXentry")) { if (descriptor.isEntry("/" + entry_name + "/title", "SDS")) {
file.openData("title"); file.openData("title");
if (file.getInfo().type == ::NeXus::CHAR) { if (file.getInfo().type == ::NeXus::CHAR) {
std::string title = file.getStrData(); std::string title = file.getStrData();
...@@ -617,7 +615,7 @@ void LoadEventNexus::loadEntryMetadata( ...@@ -617,7 +615,7 @@ void LoadEventNexus::loadEntryMetadata(
} }
// get the notes // get the notes
if (descriptor.isEntry("/" + entry_name + "/notes", "NXentry")) { if (descriptor.isEntry("/" + entry_name + "/notes", "SDS")) {
file.openData("notes"); file.openData("notes");
if (file.getInfo().type == ::NeXus::CHAR) { if (file.getInfo().type == ::NeXus::CHAR) {
std::string notes = file.getStrData(); std::string notes = file.getStrData();
...@@ -628,7 +626,7 @@ void LoadEventNexus::loadEntryMetadata( ...@@ -628,7 +626,7 @@ void LoadEventNexus::loadEntryMetadata(
} }
// Get the run number // Get the run number
if (descriptor.isEntry("/" + entry_name + "/run_number", "NXentry")) { if (descriptor.isEntry("/" + entry_name + "/run_number", "SDS")) {
file.openData("run_number"); file.openData("run_number");
std::string run; std::string run;
if (file.getInfo().type == ::NeXus::CHAR) { if (file.getInfo().type == ::NeXus::CHAR) {
...@@ -647,8 +645,7 @@ void LoadEventNexus::loadEntryMetadata( ...@@ -647,8 +645,7 @@ void LoadEventNexus::loadEntryMetadata(
} }
// get the experiment identifier // get the experiment identifier
if (descriptor.isEntry("/" + entry_name + "/experiment_identifier", if (descriptor.isEntry("/" + entry_name + "/experiment_identifier", "SDS")) {
"NXentry")) {
file.openData("experiment_identifier"); file.openData("experiment_identifier");
std::string expId; std::string expId;
if (file.getInfo().type == ::NeXus::CHAR) { if (file.getInfo().type == ::NeXus::CHAR) {
...@@ -662,10 +659,10 @@ void LoadEventNexus::loadEntryMetadata( ...@@ -662,10 +659,10 @@ void LoadEventNexus::loadEntryMetadata(
// get the sample name - nested try/catch to leave the handle in an // get the sample name - nested try/catch to leave the handle in an
// appropriate state // appropriate state
if (descriptor.isEntry("/" + entry_name + "/sample", "NXentry")) { if (descriptor.isEntry("/" + entry_name + "/sample", "NXsample")) {
file.openGroup("sample", "NXsample"); file.openGroup("sample", "NXsample");
try { try {
if (exists(file, "name")) { if (descriptor.isEntry("/" + entry_name + "/sample/name", "SDS")) {
file.openData("name"); file.openData("name");
const auto info = file.getInfo(); const auto info = file.getInfo();
std::string name; std::string name;
...@@ -693,7 +690,7 @@ void LoadEventNexus::loadEntryMetadata( ...@@ -693,7 +690,7 @@ void LoadEventNexus::loadEntryMetadata(
} }
// get the duration // get the duration
if (descriptor.isEntry("/" + entry_name + "/duration", "NXentry")) { if (descriptor.isEntry("/" + entry_name + "/duration", "SDS")) {
file.openData("duration"); file.openData("duration");
std::vector<double> duration; std::vector<double> duration;
file.getDataCoerce(duration); file.getDataCoerce(duration);
......
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