问题
I have 5 astronomy images in python, each for a different wavelength, therefore they are of different angular resolutions and grid sizes and in order to compare them so that i can create temperature maps i need them to be the same angular resolution and grid size.
I have managed to Gaussian convolve each image to the same angular resolution as the worst one, however i am having trouble finding a method to re-grid each image in python and wondered if anyone knew how to go about doing this?
I wish to re-grid the images to the same grid size as the worst quality image and so i can use that as a reference image if required. Thank you
回答1:
If the image headers have the correct World Coordinate System data, you can use the reproject package to resample the images: http://reproject.readthedocs.org/en/stable/
回答2:
You can use FITS_tools (https://pypi.python.org/pypi/FITS_tools, it can also be installed via $ pip install FITS_TOOLS
in the anaconda distribution of python).
Both images must have wcs in the header information.
import FITS_tools
to_be_projected = 'fits_file_to_be_projected.fits'
reference_fits = 'fits_file_serving_as_reference.fits'
im1,im2 = FITS_tools.match_fits(to_be_projected,reference_fits)
It returns: Two images projected into the same space, and optionally the header used to project them. Once installed, you can do help(FITS_tools.match_fits) for more information.
来源:https://stackoverflow.com/questions/33107224/re-sizing-a-fits-image-in-python