API#

Reading from FITS files#

xarrayfits.xds_from_fits(fits_filename: str | Iterable[str], hdus: None | int | Iterable[int] | Iterable[str] | Mapping[int, str] = None, chunks: None | Mapping[str, int] | Iterable[Mapping[str, int]] = None) Iterable[Dataset]#

Parameters#

fits_filename: str or Iterable of str.

FITS filename or a list of FITS filenames. The first case supports a globbed pattern.

hdusint or Iterable of int or str or Iterable of str or Mapping[int, str], optional

Specifies which HDUs are stored on the returned datasets.

  • If None, all HDUs are selected.

  • If integers, the DataArray’s will be named hdu{h}, where h is the hdu index.

  • If strings are provided, the DataArray’s will be named by them.

  • A Mapping[int, str] will name DataArry hdus at specific indices.

chunksMapping[str, int] or Iterable of Mapping[str, int], optional

Chunking strategy for each dimension of each hdu. Dimensions should be specified via the C order dimensions {0: 513, 1: 513, 2: 33}

Returns#

datasets: list of xarray.Dataset

A list of xarray Datasets corresponding to glob matches in the fits_filename parameter. Each Dataset contains xarray.DataArray ‘s corresponding to each HDU on the FITS file.