def test_flux_remains_constant(self, image_hdu_rect, pixel_scale): orig_sum = np.sum(image_hdu_rect.data) new_hdu = imp_utils.rescale_imagehdu(image_hdu_rect, pixel_scale * u.arcsec.to(u.deg)) new_sum = np.sum(new_hdu.data) assert new_sum == approx(orig_sum)
def test_mm_flux_remains_constant(self, image_hdu_rect_mm, pixel_scale): orig_sum = np.sum(image_hdu_rect_mm.data) new_hdu = imp_utils.rescale_imagehdu(image_hdu_rect_mm, pixel_scale, wcs_suffix="D") new_sum = np.sum(new_hdu.data) assert new_sum == approx(orig_sum)
def test_rescales_a_2D_imagehdu(self, scale_factor): hdu0 = imo._image_hdu_rect() hdu1 = imp_utils.rescale_imagehdu(deepcopy(hdu0), scale_factor / 3600) hdr0 = hdu0.header hdr1 = hdu1.header assert hdr1["NAXIS1"] == np.ceil(hdr0["NAXIS1"] / scale_factor) assert hdr1["NAXIS2"] == np.ceil(hdr0["NAXIS2"] / scale_factor)
def test_rescales_a_3D_imagehdu(self, scale_factor): hdu0 = imo._image_hdu_rect() hdu0.data = hdu0.data[None, :, :] * np.ones(5)[:, None, None] hdu1 = imp_utils.rescale_imagehdu(deepcopy(hdu0), scale_factor / 3600) hdr0 = hdu0.header hdr1 = hdu1.header assert np.sum(hdu0.data) == approx(np.sum(hdu1.data)) assert hdr1["NAXIS1"] == np.ceil(hdr0["NAXIS1"] / scale_factor) assert hdr1["NAXIS2"] == np.ceil(hdr0["NAXIS2"] / scale_factor) assert hdr1["NAXIS3"] == hdr0["NAXIS3"]