Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Conversion of healpix fits file to normal fits file

  1. Dec 15, 2008 #1
    im working with idl and we are trying to convert a cmb map in healpix fits file format to a normal fits file format. any help!
  2. jcsd
  3. Dec 15, 2008 #2
    Can you do this with write_fits_map or write_fits_sb? If not, can you just read in the image with the healpix fits reader, then use writefits to write the image into a standard fits file? syntax is

    writefits, 'MyCMBMap.fits', data, header

    for standard writefits.
  4. Dec 18, 2008 #3
    thanks for the help. tried all the suggestions but they don't seem to work. WRITE_FITS_MAP still outputs a file in healpix convention and write_fits_sb doesnt output the type of fits file we want since we can't use atv on it in idl. I dont see why the last option should work either because the file would still be in healpix format
  5. Dec 18, 2008 #4
    Dunno, could try fits_reproj_healpix, should be able to use atv or ds9 with the converted file?

    pro fits_reproj_healpix, infile, outfile,coord=coord,projection=projct,size=size
    ; NAME:
    ; PURPOSE:
    ; Convert a HealPix image to a flatmap projection FITS file with WCS info
    ; Writes a FITS file containing a flatmap projection in either a Mollweide
    ; or Zenithal Equal Area projection, and write the appropriate World
    ; Coordinate System (WCS, see Calabretta & Greisen, 2002, A&A, 395, 1077)
    ; information into the FITS header. This allows coordinates to be
    ; displayed by standard astronomical display software (e.g. DS9, SAOImage).
    ; Note that the conversion to a flat map projection does not preserve the
    ; noise properties of the CMB, and should not be used for a CMB analysis.
    ; PROJECT=['M','Z'],SIZE=[1-5],$
    ; INFILE - Scalar string giving name of the FITS file containing the
    ; image in HealPix projection.
    ; 'map_k_imap_yr1_v1.fits'
    ; OUTFILE - Scalar string giving the name of the FITS file containing
    ; the flat map projection with astrometry.
    ; User will be prompted for the following values if they are not supplied
    ; as keywords:
    ; PROJECT - Scalar string specifying either a "Mollweide" or a "Zenithal"
    ; Equal Area projection. Only the first letter is needed.
    ; SIZE - Scalar integer giving the size of the output image described by
    ; the table:
    ; 1 -- Small (512 x 256)
    ; 2 -- Medium (1024 x 512)
    ; 3 -- Large (2048 x 1024)
    ; 4 -- X large (4096 x 2048)
    ; 5 -- XX large (8192 x 4096, mollweide, native
    ; coordinates only)
    ; COORD - One of the three words "Galactic" (default), "Celestial", or
    ; "Ecliptic' giving the output projection. Only the first
    ; letter is needed.
    ; EXAMPLE:
    ; Convert the K band all-sky HealPix map to a medium (1024 x 512) size
    ; Mollweide projection stored in a FITS file moll_k_yr1_v1.fits

    ; IDL> infile = 'map_k_imap_yr1_v1.fits'
    ; IDL> fits_reproj_healpix, infile, 'moll_k_yr1_v1.fits',size=2,proj='Mol'
    ; NOTES:
    ; A Mollweide projection is written in a single FITS file extension. A
    ; Zenithal Equal Area projection is written as two image in two extensions
    ; -- the first centered on the North Pole, and the second on the South
    ; Pole.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Discussions: Conversion of healpix fits file to normal fits file