Unverified Commit b62658ce authored by Gigg, Martyn Anthony's avatar Gigg, Martyn Anthony Committed by GitHub
Browse files

Merge pull request #33089 from rosswhitfield/fix_event_loading_logic

Fix LoadEventNexus logic in checking valid event ID's
parents 069555d2 6e9e4718
......@@ -114,7 +114,7 @@ template <class T> void DefaultEventLoader::makeMapToEventLists(std::vector<std:
} else {
// To avoid going out of range in the vector, this is the MAX INDEX that can
// go into it
eventid_max = static_cast<int32_t>(pixelID_to_wi_vector.size());
eventid_max = static_cast<int32_t>(pixelID_to_wi_vector.size() - 1 - pixelID_to_wi_offset);
// Make an array where index = pixel ID
// Set the value to NULL by default
......
......@@ -967,6 +967,11 @@ void LoadEventNexus::loadEvents(API::Progress *const prog, const bool monitors)
if (std::regex_match(classEntry, groups, classRegex)) {
const std::string entry_name(groups[2].str());
// skip entries with junk data
if (entry_name == "bank_error_events" || entry_name == "bank_unmapped_events")
continue;
m_file->openGroup(entry_name, classType);
if (takeTimesFromEvents) {
......
......@@ -1033,6 +1033,26 @@ public:
runner.runParallel(run_MPI_load, hdf5Mutex, "SANS2D00022048.nxs");
}
void test_load_CG3_bad_event_id() {
// The test file CG3_13118.nxs.h5 being loaded has:
// bank1: all correct data, only events in this file should end up loaded (6052 events)
// bank2: all event_id are out of range and should be ignored (91 events)
// bank_error: all correct data but should be skipped because this bank is junk output (6052 events)
// bank_unmapped: all junk data and shouldn't be loaded (91 events)
LoadEventNexus load;
TS_ASSERT_THROWS_NOTHING(load.initialize());
TS_ASSERT_THROWS_NOTHING(load.setPropertyValue("Filename", "CG3_13118.nxs.h5"));
const std::string outws("CG3_bad_id_test");
TS_ASSERT_THROWS_NOTHING(load.setPropertyValue("OutputWorkspace", outws));
TS_ASSERT(load.execute());
auto ws = AnalysisDataService::Instance().retrieveWS<EventWorkspace>(outws);
// only events from bank1 should be loaded
TS_ASSERT_EQUALS(ws->getNumberEvents(), 6052);
}
void test_load_fails_on_corrupted_run() {
// Some ISIS runs can be corrupted by instrument noise,
// resulting in incorrect period numbers.
......
1e7cb2c01941e37f2952886f267ee5ea
......@@ -392,7 +392,7 @@ constParameter:${CMAKE_SOURCE_DIR}/Framework/DataHandling/src/LoadEMU.cpp:230
constParameter:${CMAKE_SOURCE_DIR}/Framework/DataHandling/src/LoadEMU.cpp:729
useStlAlgorithm:${CMAKE_SOURCE_DIR}/Framework/DataHandling/src/LoadEventNexusIndexSetup.cpp:59
useStlAlgorithm:${CMAKE_SOURCE_DIR}/Framework/DataHandling/src/LoadEventNexusIndexSetup.cpp:175
useStlAlgorithm:${CMAKE_SOURCE_DIR}/Framework/DataHandling/src/LoadEventNexus.cpp:1059
useStlAlgorithm:${CMAKE_SOURCE_DIR}/Framework/DataHandling/src/LoadEventNexus.cpp:1064
useStlAlgorithm:${CMAKE_SOURCE_DIR}/Framework/DataHandling/src/LoadEventPreNexus2.cpp:668
constParameter:${CMAKE_SOURCE_DIR}/Framework/DataHandling/src/LoadFITS.cpp:951
constParameter:${CMAKE_SOURCE_DIR}/Framework/DataHandling/src/LoadFITS.cpp:951
......
......@@ -36,6 +36,7 @@ Improvements
Bugfixes
########
- Fix bug in :ref:`LoadEventNexus <algm-LoadEventNexus>` in checking valid event ID's and make sure to always exclude data in ``error`` and ``unmapped`` banks.
- Fix bug in :ref:`Integration <algm-Integration>` when using UsePartialBinsOption with integration limits that are either equal or close together
- The :ref:`Load <algm-Load>` algorithm now reports the correct history.
......
Markdown is supported
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