This IDL facility provides a means to write into a FITS file as an ascii table extension the power spectrum coefficients passed to the routine. Adds additional headers if required. The facility is primarily intended to allow the user to write a theoretical power spectrum into a FITS file in the correct format to be ingested by the HEALPix simulation facility synfast.

Location in HEALPix directory tree: src/idl/fits/ 


IDL> CL2FITS, cl_array, fitsfile, [HDR=, /HELP, XHDR=, /CMBFAST, UNITS=]


real or double array of Cl coefficients to be written to file. This has dimension either (lmax+1,9) given in the sequence T E B TxE TxB ExB ExT BxT BxE or (lmax+1,6) given in the sequence T E B TxE TxB ExB or (lmax+1,4) given in the sequence T E B TxE or (lmax+1) for T alone.
The convention for the power spectrum is that it is not normalised by the Harrison-Zeldovich (flat) spectrum.
String containing the name of the file to be written.


String array containing the (non-trivial) primary header for the FITS file.
If set, a help message is printed out, no file is written

String array containing the (non-trivial) extension header for the FITS file.
if set, the routine will add the keyword 'POLNORM = CMBFAST' in the FITS header, meaning that the polarization power spectra have the same convention as CMBFAST (and Healpix 1.2). If this keyword is not present in the input FITS file, synfast will issue a warning when simulating a polarization map from that power spectrum, but no attempt to renormalize the power spectra will be made. To actually perform the renormalization, see convert_oldhpx2cmbfast
String scalar containing units of power spectrum (eg, uK^2, Kelvin**2, ...), to be put in keywords 'TUNIT*' of the extension header. If provided, will override the values present in XHDR (if any).
NOTE: optional header strings should NOT include the header keywords explicitly written by this routine.


cl2fits writes the input power spectrum coefficients into a FITS file containing an ascii table extension. Optional headers conforming to the FITS convention can also be written to the output file. All required FITS header keywords (like SIMPLE, BITPIX, ...) are automatically generated by the routine and should NOT be duplicated in the optional header inputs (they would be ignored anyway). The one/four/six/nine column(s) are automatically named TEMPERATURE, GRAD, CURL, TG, TC, GC, GT, CT and CG respectively. If the power spectrum is provided in a double precision array, the output format will automatically feature more decimal places. The current implementation is much faster than the one available in Healpix 1.10 thanks to replacing an internal loop by vector operations.


This section lists the routines related to cl2fits

version 6.4 or more is necessary to run cl2fits.
provides the complimentary routine to read in a power spectrum from a FITS file.
convert an existing power spectrum FITS file from the polarization convention used in Healpix 1.1 to the one used in Healpix 1.2 (and CMBFAST).
facility to write a window function into a FITS file.
fits2alm, alm2fits
routines to read and write alm coefficients
utilises the output file generated by cl2fits.


cl2fits, pwrsp, 'spectrum.fits', HDR = hdr, XHDR = xhdr
cl2fits writes the power spectrum stored in the variable pwrsp to the output FITS file spectrum.fits with optional headers passed by the string variables hdr and xhdr.

Version 3.31, 2017-01-06