healpy.fitsfunc.write_map

healpy.fitsfunc.write_map(filename, m, nest=False, dtype=None, fits_IDL=True, coord=None, partial=False, column_names=None, column_units=None, extra_header=(), overwrite=False)

Writes a healpix map into a healpix FITS file.

Starting from healpy 1.15.0, if you do not specify dtype, the map will be written to disk with the same precision it is stored in memory. Previously, by default healpy wrote maps in float32. To reproduce the same behaviour of healpy 1.14.0 and below, set dtype=np.float32.

Parameters:
filenamestr

the fits file name

marray or sequence of 3 arrays

the map to write. Possibly a sequence of 3 maps of same size. They will be considered as I, Q, U maps. Supports masked maps, see the ma function.

nestbool, optional

If True, ordering scheme is assumed to be NESTED, otherwise, RING. Default: RING. The map ordering is not modified by this function, the input map array should already be in the desired ordering (run ud_grade beforehand).

fits_IDLbool, optional

If True, reshapes columns in rows of 1024, otherwise all the data will go in one column. Default: True

coordstr

The coordinate system, typically ‘E’ for Ecliptic, ‘G’ for Galactic or ‘C’ for Celestial (equatorial)

partialbool, optional

If True, fits file is written as a partial-sky file with explicit indexing. Otherwise, implicit indexing is used. Default: False.

column_namesstr or list

Column name or list of column names, if None here the default column names based on the number of columns: 1 : “TEMPERATURE”, 2 : [“Q_POLARISATION”, “U_POLARISATION”], 3 : [“TEMPERATURE”, “Q_POLARISATION”, “U_POLARISATION”], 6 : [“II”, “IQ”, “IU”, “QQ”, “QU”, “UU”] COLUMN_1, COLUMN_2… otherwise (FITS is 1-based)

column_unitsstr or list

Units for each column, or same units for all columns.

extra_headerlist

Extra records to add to FITS header.

dtype: np.dtype or list of np.dtypes, optional

The datatype in which the columns will be stored. Will be converted internally from the numpy datatype to the fits convention. If a list, the length must correspond to the number of map arrays. Default: use the data type of the input array(s) .. note:: this changed in 1.15.0, previous versions saved in float32 by default

overwritebool, optional

If True, existing file is silently overwritten. Otherwise trying to write an existing file raises an OSError (IOError for Python 2).