astropy/astropy — pull request #2503 by mdboom (2014-05-16 13:16:07+00:00)
Title: WCS comparison can fail for least-significant-digit comparison

Follow-up to #2330:

```
In [48]: w1 = wcs.WCS(naxis=1)

In [49]: w2 = wcs.WCS(naxis=1)

In [50]: w1.wcs.compare(0, w2.wcs)
Out[50]: True

In [51]: w1.wcs == w2.wcs
Out[51]: True

In [52]: w1.wcs.cdelt[0] = np.float32(0.00416666666666666666666666)

In [53]: w2.wcs.cdelt[0] = np.float64(0.00416666666666666666666666)

In [54]: w1.wcs == w2.wcs
Out[54]: False

In [55]: w1.wcs.compare(0, w2.wcs)
Out[55]: False

In [56]: w1.wcs.compare(1, w2.wcs)
Out[56]: False

In [57]: w1.wcs.compare(2, w2.wcs)
Out[57]: False
```

Would it be possible to include an additional `cmp` flag that says "compare to precision X" or perhaps uses `np.testing....almost_equal` instead of direct equality comparison?

cc @astrofrog (this affects `spectral_cube`) and @mdboom