NDIOMixin¶
-
class
astropy.nddata.NDIOMixin[source]¶ Bases:
objectMixin class to connect NDData to the astropy input/output registry.
This mixin adds two methods to its subclasses,
readandwrite.Methods Summary
read(*args, **kwargs)Generate a CCDData object from a FITS file. write(*args, **kwargs)Write CCDData object to FITS file. Methods Documentation
-
classmethod
read(*args, **kwargs)[source]¶ Generate a CCDData object from a FITS file.
Parameters: filename : str
Name of fits file.
hdu : int, optional
FITS extension from which CCDData should be initialized. If zero and and no data in the primary extension, it will search for the first extension with data. The header will be added to the primary header. Default is
0.unit :
Unit, optionalUnits of the image data. If this argument is provided and there is a unit for the image in the FITS header (the keyword
BUNITis used as the unit, if present), this argument is used for the unit. Default isNone.hdu_uncertainty : str or None, optional
FITS extension from which the uncertainty should be initialized. If the extension does not exist the uncertainty of the CCDData is
None. Default is'UNCERT'.hdu_mask : str or None, optional
FITS extension from which the mask should be initialized. If the extension does not exist the mask of the CCDData is
None. Default is'MASK'.hdu_flags : str or None, optional
Currently not implemented. Default is
None.key_uncertainty_type : str, optional
The header key name where the class name of the uncertainty is stored in the hdu of the uncertainty (if any). Default is
UTYPE.New in version 3.1.
kwd :
Any additional keyword parameters are passed through to the FITS reader in
astropy.io.fits; see Notes for additional discussion.Notes
FITS files that contained scaled data (e.g. unsigned integer images) will be scaled and the keywords used to manage scaled data in
astropy.io.fitsare disabled.
-
write(*args, **kwargs)[source]¶ Write CCDData object to FITS file.
Parameters: filename : str
Name of file.
hdu_mask, hdu_uncertainty, hdu_flags : str or None, optional
If it is a string append this attribute to the HDUList as
ImageHDUwith the string as extension name. Flags are not supported at this time. IfNonethis attribute is not appended. Default is'MASK'for mask,'UNCERT'for uncertainty andNonefor flags.key_uncertainty_type : str, optional
The header key name for the class name of the uncertainty (if any) that is used to store the uncertainty type in the uncertainty hdu. Default is
UTYPE.New in version 3.1.
kwd :
All additional keywords are passed to
astropy.io.fitsRaises: ValueError
- If
self.maskis set but not anumpy.ndarray. - If
self.uncertaintyis set but not aStdDevUncertainty. - If
self.uncertaintyis set but has another unit thenself.data.
NotImplementedError
Saving flags is not supported.
- If
-
classmethod