compareScalars

lsst.pex.config.compareScalars(name, v1, v2, output, rtol=1e-08, atol=1e-08, dtype=None)

Compare two scalar values for equality.

This function is a helper for lsst.pex.config.Config.compare.

Parameters:
namestr

Name to use when reporting differences, typically created by getComparisonName.

v1object

Left-hand side value to compare.

v2object

Right-hand side value to compare.

outputcallable or None

A callable that takes a string, used (possibly repeatedly) to report inequalities (for example, print). Set to None to disable output.

rtolfloat, optional

Relative tolerance for floating point comparisons.

atolfloat, optional

Absolute tolerance for floating point comparisons.

dtypeclass, optional

Data type of values for comparison. May be None if values are not floating-point.

Returns:
areEqualbool

True if the values are equal, False if they are not.

Notes

Floating point comparisons are performed by numpy.allclose.