cl2fits

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/cl2fits.pro 


FORMAT

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


QUALIFIERS

cl_array
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.
fitsfile
String containing the name of the file to be written.


KEYWORDS

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

XHDR=
String array containing the (non-trivial) extension header for the FITS file.
/CMBFAST
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
UNITS=
String scalar containing units of power spectrum (eg, uK2, 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.


DESCRIPTION

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.


RELATED ROUTINES

This section lists the routines related to cl2fits

idl
version 6.4 or more is necessary to run cl2fits.
fits2cl
provides the complimentary routine to read in a power spectrum from a FITS file.
convert_oldhpx2cmbfast
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).
bl2fits
facility to write a window function into a FITS file.
fits2alm, alm2fits
routines to read and write $a_{\ell m}$ coefficients
synfast
utilises the output file generated by cl2fits.


EXAMPLE:

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.83, 2024-11-13