scopesim.utils.zeros_from_header

scopesim.utils.zeros_from_header#

scopesim.utils.zeros_from_header(header: ~astropy.io.fits.header.Header, dtype: type | ~numpy.dtype = <class 'float'>, ndims: int | None = None) ndarray#

Create all-zero array of the shape given by NAXISn keywords in header.

Added in version 0.10.0.

Parameters:
  • header (fits.Header) – FITS header containing relevant keywords.

  • dtype (type | np.dtype, optional) – Valid type or numpy dtype for output array. The default is float.

  • ndims (int | None, optional) – Override number of dimensions. If None (the default), the number of dimensions is taken from the “NAXIS” header keyword. This argument is useful for e.g. creating a 2D image array from a 3D header.

Returns:

arr – All-zero array of desired shape and dtype.

Return type:

np.ndarray