Using the Astropy library, I created a FIT image which is made by interpolation from 2 actual FIT images (they are scaled as "int16", the right format for the software I use : Maxim DL).
But the scale of this image is float64 and not int16. And any astronomical processing software can't read it (except FITS Liberator)
Do you have an idea how to proceed ? Can we convert a FIT image just by changing the "BITPIX" in the header ?
I tried: (following this method : Why is an image containing integer data being converted unexpectedly to floats?
from astropy.io import fits
print(image.header['BITPIX']) # it gives : -64
print(image.header['BITPIX']) # it gives : 16
If I understand your problem correctly, this should work.
from astropy.io import fits import numpy as np # create dummy fits file a = np.array([[1,2,3], [4,5,6], [7,8,9]],dtype=np.float64) hdu = fits.PrimaryHDU() hdu.data = a # looking at the header object confirms BITPIX = -64 hdu.header # change data type hdu.data = np.int16(hdu.data) # look again to confirm BITPIX = 16 hdu.header