re-sizing a fits image in python

做~自己de王妃 提交于 2019-12-08 08:54:07

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!