Skip to content

Commit

Permalink
Merge pull request mantidproject#37640 from peterfpeterson/align_and_…
Browse files Browse the repository at this point in the history
…focus_compress

Consolidate code in AlignAndFocusPowder for selecting whether to CompressEvents - ornl-next
  • Loading branch information
peterfpeterson committed Jul 5, 2024
2 parents 42a5dbc + 7a596ac commit 24f9430
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
15 changes: 6 additions & 9 deletions Framework/WorkflowAlgorithms/src/AlignAndFocusPowder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -698,11 +698,7 @@ void AlignAndFocusPowder::exec() {
} else if (DIFCref > 0.) {
m_outputW = convertUnits(m_outputW, "TOF");
// this correction has some assumptions on the events being compressed
if (auto outputEW = std::dynamic_pointer_cast<EventWorkspace>(m_outputW)) {
if (compressEventsTolerance > 0.) {
compressEventsOutputWS(compressEventsTolerance, wallClockTolerance);
}
}
compressEventsOutputWS(compressEventsTolerance, wallClockTolerance);

// this is a legacy way for describing the minimum wavelength to remove from the data
// it is uncommon that it is used
Expand Down Expand Up @@ -817,9 +813,7 @@ void AlignAndFocusPowder::exec() {
m_progress->report();

// compress again if appropriate
if (compressEventsTolerance > 0.) {
compressEventsOutputWS(compressEventsTolerance, wallClockTolerance);
}
compressEventsOutputWS(compressEventsTolerance, wallClockTolerance);
m_progress->report();

if (!binInDspace && !m_delta_ragged.empty()) {
Expand Down Expand Up @@ -1207,6 +1201,9 @@ void AlignAndFocusPowder::loadCalFile(const std::string &calFilename, const std:

void AlignAndFocusPowder::compressEventsOutputWS(const double compressEventsTolerance,
const double wallClockTolerance) {
if (compressEventsTolerance == 0.)
return; // no compression is required

if (auto outputEW = std::dynamic_pointer_cast<EventWorkspace>(m_outputW)) {
g_log.information() << "running CompressEvents(Tolerance=" << compressEventsTolerance;
if (!isEmpty(wallClockTolerance))
Expand Down Expand Up @@ -1237,7 +1234,7 @@ bool AlignAndFocusPowder::shouldCompressUnfocused(const double compressTolerance
if (hasWallClockTolerance)
return false;
// compressing isn't an option
if (compressTolerance == 0)
if (compressTolerance == 0.)
return false;

if (const auto eventWS = std::dynamic_pointer_cast<const EventWorkspace>(m_outputW)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Fix bug where compression isn't run when logarithmic is selected in :ref:`AlignAndFocusPowder <algm-AlignAndFocusPowder-v1>`

0 comments on commit 24f9430

Please sign in to comment.