From e5aaa588539cbe435a398f87e99e3c480a79d540 Mon Sep 17 00:00:00 2001 From: Owen Arnold <owen.arnold@stfc.ac.uk> Date: Wed, 5 Dec 2018 09:51:39 +0000 Subject: [PATCH] refs #24078. Fixes for ESS sample files --- Framework/DataHandling/test/LoadEventNexusTest.h | 3 ++- Framework/NexusGeometry/src/NexusGeometryParser.cpp | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Framework/DataHandling/test/LoadEventNexusTest.h b/Framework/DataHandling/test/LoadEventNexusTest.h index ef109ffe108..7846e39142a 100644 --- a/Framework/DataHandling/test/LoadEventNexusTest.h +++ b/Framework/DataHandling/test/LoadEventNexusTest.h @@ -149,8 +149,9 @@ private: public: void test_load_event_nexus() { - const std::string file = "SANS2D_ESS_example.nxs"; + const std::string file = "/Users/spu92482/Downloads/V20_example_5.nxs"; LoadEventNexus alg; + alg.setRethrows(true); alg.setChild(true); alg.initialize(); alg.setProperty("Filename", file); diff --git a/Framework/NexusGeometry/src/NexusGeometryParser.cpp b/Framework/NexusGeometry/src/NexusGeometryParser.cpp index 7288af47fcd..b67fea3601b 100644 --- a/Framework/NexusGeometry/src/NexusGeometryParser.cpp +++ b/Framework/NexusGeometry/src/NexusGeometryParser.cpp @@ -416,7 +416,10 @@ getTransformations(const H5File &file, const Group &detectorGroup) { std::vector<Mantid::detid_t> getDetectorIds(const Group &detectorGroup) { std::vector<Mantid::detid_t> detIds; - + if (!detectorGroup.exists(DETECTOR_IDS)) + throw std::invalid_argument("Mantid requires the following named dataset " + "to be present in NXDetectors: " + + DETECTOR_IDS); for (unsigned int i = 0; i < detectorGroup.getNumObjs(); ++i) { H5std_string objName = detectorGroup.getObjnameByIdx(i); if (objName == DETECTOR_IDS) { @@ -661,7 +664,10 @@ extractInstrument(const H5File &file, const Group &root) { Eigen::Vector3d bankPos = transforms * Eigen::Vector3d{0, 0, 0}; // Absolute bank rotation auto bankRotation = Eigen::Quaterniond(transforms.rotation()); - auto bankName = get1DStringDataset(BANK_NAME, detectorGroup); + std::string bankName; + if (detectorGroup.exists(BANK_NAME)) + bankName = get1DStringDataset(BANK_NAME, + detectorGroup); // local_name is optional builder.addBank(bankName, bankPos, bankRotation); // Get the pixel detIds auto detectorIds = getDetectorIds(detectorGroup); -- GitLab