I have two images of NGC 6946:

item       description        size (pixels)    scale (arcseconds/pixel)
 1.     70 micron MIPS FITS     241 x 241           4.5 
 2.     20 cm VLA FITS          512 x 512           2.0  

I need to create a matrix with 2 columns (70 micron vs 20 cm), where each column will store the values at each pixel in such a way that the central pixel coordinate of each image coincides, so that I can plot for Radio/FIR correlation.

How should I perform such task in python?

  • $\begingroup$ I've added the astropy tag on the off chance that it will apply. Do you want to interpolate one image to fit the other, since their pixel sizes aren't 1:1? Will you need to rotate one image to match the other as well? I reformatted a bit, feel free to edit further or roll-back. $\endgroup$ – uhoh Nov 19 '19 at 8:03
  • 1
    $\begingroup$ Thank you for formatting my question. I will keep this method in mind. Returning to the problem at hand, I want to create a 70 micron intensity (Jy) vs 20 cm intensity (Jy) plot and fit a curve through those points. $\endgroup$ – user30981 Nov 19 '19 at 9:15
  • $\begingroup$ Right, you are hoping for pixel-for-pixel matching so that you can look for a correlation. They have different scales, so you'll need to at least interpolate first, since the pixel scales are different, (roughly 9:4). Is there some rotation difference, or are they both oriented exactly the same way (e.g. North = up)? $\endgroup$ – uhoh Nov 19 '19 at 12:24
  • $\begingroup$ Do the images have world co-ordinate system (WCS) in their headers? $\endgroup$ – TazAstroSpacial Nov 22 '19 at 6:17
  • $\begingroup$ Yes. Thank you. I have already done it. $\endgroup$ – user30981 Dec 17 '19 at 0:17

If you have the WCS for both images, you can use the astropy reproject module. Once you have projected image 1 onto image 2, the (x,y)th pixel from the output will correspond to the (x,y)th pixel from image 2.

Then you can flatten both images with numpy, and assemble them into a 2-column array.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.