\(\renewcommand\AA{\unicode{x212B}}\)
assert_not_equal¶
This is a Python function for testing that two workspaces are not equal within a tolerance.
If rtol
is specified, the workspaces will be compared using the relative difference.
If atol
is specified, the workspaces will be compared using the absolute difference.
Only one of rtol
and atol
may be specified.
assert_not_equal
will run the underlying CompareWorkspaces v1 algorithm for the
case specified, and fail if the comparison succeeds.
If neither rtol
nor atol
is specified, will perform an absolute comparison to within 1.e-10.
Raises an assertion error if two workspaces are equal within specified tolerance.
Parameters¶
- Workspace1, Workspace2Workspace
Input workspaces to compare.
- rtolfloat
The relative tolerance parameter.
- atolfloat
The absolute tolerance parameter.
- kwargs: dict
Other options available to CompareWorkspaces.
Raises¶
- AssertionError
If Workspace1 and Workspace2 are equal up to specified precision
- ValueError
If atol or rtol are below zero or both are specified.
- ValueError
If kwargs contains keys that should instead be set by atol or rtol
Usage¶
Example - Comparison that passes
from mantid.testing import assert_not_equal
ts1 = CreateSingleValuedWorkspace(0.1)
ts2 = CreateSingleValuedWorkspace(0.3)
assert_not_equal(ts1, ts2, atol=0.1) # passes
Example - Comparison that fails
from mantid.testing import assert_not_equal
ts1 = CreateSingleValuedWorkspace(0.1)
ts2 = CreateSingleValuedWorkspace(0.3)
# uncomment to see that an AssertionError is raised
# assert_not_equal(ts1, ts2, atol=1.0)