healpy.fitsfunc.read_map

healpy.fitsfunc.read_map(filename, field=0, dtype=None, nest=False, partial=False, hdu=1, h=False, verbose=True, memmap=False)

Read a healpix map from a fits file. Partial-sky files, if properly identified, are expanded to full size and filled with UNSEEN.

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

Parameters:
filenamestr or HDU or HDUList or pathlib.Path instance

the fits file name

fieldint or tuple of int, or None, optional

The column to read. Default: 0. By convention 0 is temperature, 1 is Q, 2 is U. Field can be a tuple to read multiple columns (0,1,2) If the fits file is a partial-sky file, field=0 corresponds to the first column after the pixel index column. If None, all columns are read in.

dtypedata type or list of data types, optional

Force the conversion to some type. Passing a list allows different types for each field. In that case, the length of the list must correspond to the length of the field parameter. If None, keep the dtype of the input FITS file Default: Preserve the data types in the file

nestbool, optional

If True return the map in NEST ordering, otherwise in RING ordering; use fits keyword ORDERING to decide whether conversion is needed or not If None, no conversion is performed.

partialbool, optional

If True, fits file is assumed to be a partial-sky file with explicit indexing, if the indexing scheme cannot be determined from the header. If False, implicit indexing is assumed. Default: False. A partial sky file is one in which OBJECT=PARTIAL and INDXSCHM=EXPLICIT, and the first column is then assumed to contain pixel indices. A full sky file is one in which OBJECT=FULLSKY and INDXSCHM=IMPLICIT. At least one of these keywords must be set for the indexing scheme to be properly identified.

hduint, optional

the header number to look at (start at 0)

hbool, optional

If True, return also the header. Default: False.

verbosebool, deprecated

It has no effect

memmapbool, optional

Argument passed to astropy.io.fits.open, if True, the map is not read into memory, but only the required pixels are read when needed. Default: False.

Returns:
m | (m0, m1, …) [, header]array or a tuple of arrays, optionally with header appended

The map(s) read from the file, and the header if h is True.