def test_fits_model_multi_extension(exposure): fits_model = models.FITSModel([ models.Extension(data="none", name="FIRST"), models.Extension(data=None, name="SECOND"), models.Extension(data="raw"), models.Extension(data=numpy.zeros((10, 10))), ]) exposure.fits_model = fits_model hdulist = exposure.to_hdu() assert len(hdulist) == 4 assert isinstance(hdulist[0], astropy.io.fits.PrimaryHDU) assert hdulist[0].name == "PRIMARY" assert hdulist[0].data is None assert isinstance(hdulist[1], astropy.io.fits.ImageHDU) assert hdulist[1].name == "SECOND" assert hdulist[1].data is not None assert isinstance(hdulist[2], astropy.io.fits.ImageHDU) assert hdulist[2].data is not None assert isinstance(hdulist[3], astropy.io.fits.ImageHDU) assert numpy.all(hdulist[3].data == numpy.zeros((10, 10)))
def test_fits_model(): fits_model = models.FITSModel() assert len(fits_model) == 1 assert fits_model[0].data == "raw" assert fits_model[0].header_model is None
def test_fits_model_to_hdu(exposure): fits_model = models.FITSModel() hdulist = fits_model.to_hdu(exposure) assert isinstance(hdulist, astropy.io.fits.HDUList) assert isinstance(hdulist[0], astropy.io.fits.PrimaryHDU) assert hdulist[0].header is not None assert hdulist[0].data is not None
def test_model_compressed(exposure, compressed): fits_model = models.FITSModel( [models.Extension(data=None, compressed=compressed)]) exposure.fits_model = fits_model hdulist = exposure.to_hdu() assert isinstance(hdulist[0], astropy.io.fits.PrimaryHDU) assert hdulist[0].data is None assert isinstance(hdulist[1], astropy.io.fits.CompImageHDU) assert hdulist[1].data is not None if compressed is True: assert fits_model[0].compressed == "GZIP_2" else: assert fits_model[0].compressed == compressed
def test_fits_model_multi_extension_compressed(exposure): fits_model = models.FITSModel([ models.Extension(data=None, compressed=True), models.Extension(data=False, compressed=True), ]) exposure.fits_model = fits_model hdulist = exposure.to_hdu() assert len(hdulist) == 3 assert isinstance(hdulist[0], astropy.io.fits.PrimaryHDU) assert hdulist[0].data is None assert isinstance(hdulist[1], astropy.io.fits.CompImageHDU) assert hdulist[1].data is not None assert isinstance(hdulist[2], astropy.io.fits.CompImageHDU) assert hdulist[2].data is None