Search code examples
pythonpython-3.xresolutionastronomyfits

How to change fits images' angular resolution in astropy?


I have two fits image of different wavelength. They have different angular resolution.
I want to convolve the higher resolution image to the lower one.
I have tried astropy.convolution.convolve and astropy.convolution.Gaussian2DKernel. Resolution is 0.184" for 1600nm, and 0.124" for 606nm. So I think the resolution for the kernel should be 0.136". Then I tried following code:

import os
from astropy.io import fits  
from astropy.convolution import Gaussian2DKernel  
from astropy.convolution import convolve  
  
kernel = Gaussian2DKernel(x_stddev=0.136)   
hdu = fits.open('/Users/lpr/Data/fits/pridata/goodsn_f606/606.fits')[0]  
img = hdu.data  
astropy_conv = convolve(img,kernel)  
hdu.data = astropy_conv  
hdu.writeto('/Users/lpr/Data/fits/expdata/CONVOLIMAGE/convolved_606.fits')  
print('done')  

Of course, that's wrong. The resolution of higher one(606) almost unchanged. Then I realize that I convolve two different type thing. One is flux(or electrons/s), the other is kernel.

Now I don't know how to match the higher resolution image to lower one. Thank you for answering my question!


Solution

  • I think the first issue is that the standard deviation of your kernel should be in pixels, not in arcseconds.

    Then you may be interested in two packages that allow to compute the matching kernel between two PSFs: