assert_values_equal#
- lsst.images.tests.assert_values_equal(a, b, *, rtol=0.0, atol=0.0, equal_nan=True, label='', wrap_angles=False)#
Assert that two arrays, quantities, floats, astropy times, or sky coordinates are equal or close.
On mismatch this raises an
AssertionErrorwith a concise report (count, max absolute difference, location, NaN-mismatch count) rather than dumping the arrays. Exact (non-floating-point) mismatches instead report throughnumpy.testing.assert_array_equal.Both operands must be of the same kind: both floating-point numeric (bare or as
QuantityorTimeDelta), or both the same astropy type (Timeorastropy.coordinates.SkyCoord). Operands that cannot hold floating-point values (integers, bools, strings) are compared exactly, with no tolerance or NaN semantics. Tolerances never have their units guessed: a bare-floatatolis only valid for dimensionless operands, and for unitful operands only exactly0.0(which is unit-independent) is accepted without units.- Parameters:
a (
ndarray|Quantity|float|Time|TimeDelta|SkyCoord) – First value to compare.b (
ndarray|Quantity|float|Time|TimeDelta|SkyCoord) – Second value to compare.rtol (
float, default:0.0) – Relative tolerance, applied to the operand magnitudes. Must be zero for comparisons of separations.atol (
float|Quantity|TimeDelta, default:0.0) – Absolute tolerance. For dimensionless operands, a bare float. For unitful operands, aQuantitywith units compatible witha, or exactly0.0.equal_nan (
bool, default:True) – IfTrue, treat NaN as equal to NaN. Aastropy.coordinates.SkyCoordelement counts as NaN only when both of its coordinates are NaN.label (
str, default:'') – Prefix prepended to the failure message.wrap_angles (
bool, default:False) – IfTrue, compareaandb(angular quantities) modulo 2 pi.
- Return type: