简体   繁体   English

在python中重新调整适合图像的大小

[英]re-sizing a fits image in python

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. 我在python中有5个天文图像,每个图像用于不同的波长,因此它们具有不同的角度分辨率和网格尺寸,并且为了比较它们以便我可以创建温度图,我需要它们具有相同的角分辨率和网格尺寸。

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? 我设法将Gaussian卷积成每个图像与最差的图像具有相同的角度分辨率,但是我无法找到一种方法来重新格式化python中的每个图像,并想知道是否有人知道如何去做这个?

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 谢谢

如果图像标题具有正确的世界坐标系数据,则可以使用reproject包重新采样图像: http//reproject.readthedocs.org/en/stable/

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). 您可以使用FITS_tools( https://pypi.python.org/pypi/FITS_tools ,它也可以通过$ pip install FITS_TOOLS在python的anaconda发行版中)。 Both images must have wcs in the header information. 两个图像必须在标题信息中具有wcs。

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. 安装后,您可以提供帮助(FITS_tools.match_fits)以获取更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM