code: def fitsInfo(fitsname = None):
      
      hdu = pyfits.open(fitsname)
      hdr = hdu[0].header
      ra = hdr['CRVAL1']
      dra = abs(hdr['CDELT1'])
      raPix = hdr['CRPIX1']
      dec = hdr['CRVAL2']
      ddec = abs(hdr['CDELT2'])
      decPix = hdr['CRPIX2']
      freq0 = 0
      for i in range(1,hdr['NAXIS']+1):
          if hdr['CTYPE%d'%i].strip() == 'FREQ':
              freq0 = hdr['CRVAL%d'%i]
              break
  
      ndim = hdr["NAXIS"]
      imslice = np.zeros(ndim, dtype=int).tolist()
      imslice[-2:] = slice(None), slice(None)
      image = hdu[0].data[imslice]
      wcs = WCS(hdr,mode='pyfits')
  
      return {'image':image,'wcs':wcs,'ra':ra,'dec':dec,'dra':dra,'ddec':ddec,'raPix':raPix,'decPix':decPix,'freq0':freq0}
docs: Get fits info