Skip to content

Commit 9b2268b

Browse files
authored
Divide fix ornl version (#39140)
* fix same unit on lhs and rhs but output not unitless * only test it in divide * release note * delete .gitkeep * better description
1 parent 0be1700 commit 9b2268b

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

Framework/Algorithms/src/Divide.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ void Divide::setOutputUnits(const API::MatrixWorkspace_const_sptr lhs, const API
9090

9191
// If the Y units match, then the output will be a distribution and will be
9292
// dimensionless
93-
else if (lhs->YUnit() == rhs->YUnit() && m_rhsBlocksize > 1) {
93+
else if (lhs->YUnit() == rhs->YUnit() && m_rhsBlocksize != 1) {
9494
out->setYUnit("");
9595
out->setDistribution(true);
9696
}

Framework/Algorithms/test/MultiplyDivideTest.in.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,19 @@ class @MULTIPLYDIVIDETEST_CLASS@ : public CxxTest::TestSuite
10951095
TS_ASSERT(result->YUnit().empty());
10961096
}
10971097

1098+
void test_RaggedWorkspace_sameunit()
1099+
{
1100+
auto lhs = create_RaggedWorkspace();
1101+
auto rhs = create_RaggedWorkspace();
1102+
lhs->setYUnit("counts");
1103+
rhs->setYUnit("counts");
1104+
DO_DIVIDE = true;
1105+
auto result = performTest(lhs, rhs, false, DO_DIVIDE ? 1.0 : 4.0, DO_DIVIDE ? 1.4142135625 : 5.6568542436);
1106+
TS_ASSERT(result->isRaggedWorkspace());
1107+
TS_ASSERT_EQUALS(result->isDistribution(), DO_DIVIDE ? true : false);
1108+
TS_ASSERT(result->YUnit().empty());
1109+
}
1110+
10981111
void test_RaggedWorkspace_and_single_value()
10991112
{
11001113
auto lhs = create_RaggedWorkspace();

docs/source/release/v6.13.0/Framework/Algorithms/Bugfixes/.gitkeep

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Fixes a bug in :ref:`algm-Divide` where units were not properly cleared when dividing two :ref:`ragged_workspace <Ragged_Workspace>` with identical Y-axis Units. This issue could cause errors in downstream data reduction workflows where the resulting workspace should be unitless. The fix ensures proper unit handling for :ref:`ragged_workspace <Ragged_Workspace>` division operations.

0 commit comments

Comments
 (0)