Skip to content

Commit

Permalink
Merge a8f733e into 85398cf
Browse files Browse the repository at this point in the history
  • Loading branch information
keflavich committed May 16, 2014
2 parents 85398cf + a8f733e commit cb9214d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 4 additions & 2 deletions spectral_cube/masks.py
Expand Up @@ -234,7 +234,8 @@ def _validate_wcs(self, new_data, new_wcs):
if new_data.shape != self._mask.shape:
raise ValueError("data shape does not match mask shape")
if new_wcs not in self._wcs_whitelist:
if not wcs_utils.check_equality(new_wcs, self._wcs):
if not wcs_utils.check_equality(new_wcs, self._wcs,
warn_missing=True):
raise ValueError("WCS does not match mask WCS")
self._wcs_whitelist.add(new_wcs)

Expand Down Expand Up @@ -308,7 +309,8 @@ def _validate_wcs(self, new_data, new_wcs):
if new_data.shape != self._data.shape:
raise ValueError("data shape does not match mask shape")
if new_wcs not in self._wcs_whitelist:
if not wcs_utils.check_equality(new_wcs, self._wcs):
if not wcs_utils.check_equality(new_wcs, self._wcs,
warn_missing=True):
raise ValueError("WCS does not match mask WCS")
self._wcs_whitelist.add(new_wcs)

Expand Down
7 changes: 7 additions & 0 deletions spectral_cube/wcs_utils.py
Expand Up @@ -215,6 +215,13 @@ def check_equality(wcs1, wcs2, warn_missing=False, verbose=False):
OK = False
if verbose:
print("Header 1, {0}: {1} != {2}".format(key,u1,u2))
elif isinstance(c1[1], (float, np.float)):
try:
np.testing.assert_almost_equal(c1[1], c2[1])
except AssertionError:
if verbose:
print("Header 1, {0}: {1} != {2}".format(key,c1[1],c2[1]))
OK = False
elif c1[1] != c2[1]:
if verbose:
print("Header 1, {0}: {1} != {2}".format(key,c1[1],c2[1]))
Expand Down

0 comments on commit cb9214d

Please sign in to comment.