\(\renewcommand\AA{\unicode{x212B}}\)

assert_almost_equal

This is a Python function for testing if two modules are within a tolerance. If rtol is specified, will compare using the relative difference. If atol is specified, will compare using the absolute difference. One or both of rtol and atol may be specified. Will run the underlying CompareWorkspaces v1 algorithm for each case specified, and fail if any of the comparisons fail. If neither rtol nor atol is specified, will perform an absolute compatison to within 1.e-10.

Raises an assertion error if two workspaces are not within specified tolerance.

Parameters

Workspace1, Workspace2Workspace

Input workspaces to compare.

rtolfloat

The relative tolerance parameter.

atolfloat

The absolute tolerance parameter.

Raises

AssertionError

If Workspace1 and Workspace2 are not equal up to specified precision

ValueError

If atol or rtol are below zero

ValueError

If kwargs contains keys that cshould instead be set by atol or rtol

See Also

CompareWorkspaces v1