1

I'm trying to read and plot a Halpha map from a fits image whose 'info' is the following:

No.    Name      Ver    Type      Cards   Dimensions   Format
  0  PRIMARY       1 PrimaryHDU      66   (8640, 4320)   float32

And the header is composed of:

"SIMPLE  =                    T / Written by IDL:  Sat Jan 25 22:41:24 2003      
BITPIX  =                  -32 / Number of bits per data pixel                  
NAXIS   =                    2 / Number of data axes                            
NAXIS1  =                 8640 /                                                
NAXIS2  =                 4320 /                                                
DATE    = '2003-01-26'         / Creation UTC (CCCC-MM-DD) date of FITS header  
COMMENT FITS (Flexible Image Transport System) format is defined in 'Astronomy  
COMMENT and Astrophysics', volume 376, page 359; bibcode 2001A&A...376..359H    
CTYPE1  = 'GLON-CAR'           /                                                
CRPIX1  =              4320.50 /                                                
CRVAL1  =              0.00000 /                                                
CTYPE2  = 'GLAT-CAR'           /                                                
CRPIX2  =              2160.50 /                                                
CRVAL2  =              0.00000 /                                                
CD1_1   =     -0.0416666666667 /                                                
CD1_2   =        0.00000000000 /                                                
CD2_1   =        0.00000000000 /                                                
CD2_2   =      0.0416666666667 /                                                
LONPOLE =                  180 /                                                
PROJP1  =                    0 /                                                
PROJP2  =                    0 /                                                
EQUINOX =              2000.00 / "

Therefore, if I understand properly, I can perform directly a conversion from pixels coordinates to world coordinates (in that case, galactic longitude and latitude), using the WCS module. My code is then written as follows:

hdu = fits.open('Halpha_map.fits')
hdr = hdu[0].header
data = hdu[0].data
wcs = WCS(header=hdr, fix = True)
ax = plt.subplot(projection=wcs)
im = ax.imshow(-np.log10(data), cmap = 'gray') #Invert logarithm gray map.

Then I want to restrict the plot to specific galactic longitudes and latitudes, let's say for instance l = [50°,55°] and b = [0°,5°]. When I try this, I obtain the following plot:

https://i.stack.imgur.com/uMo6i.png

So I have a weird grey instead of the proper portion of the Halpha map and the coordinates do not correspond to the part I want to plot. Any idea of the origin of this issue, please?

0 Answers0