astropy 5.0

ParametersReturnsBackRef
fitsopen(name, mode='readonly', memmap=None, save_backup=False, cache=True, lazy_load_hdus=None, ignore_missing_simple=False, **kwargs)

Parameters

name : str, file-like or `pathlib.Path`

File to be opened.

mode : str, optional

Open mode, 'readonly', 'update', 'append', 'denywrite', or 'ostream'. Default is 'readonly'.

If name is a file object that is already opened, mode must match the mode the file was opened with, readonly (rb), update (rb+), append (ab+), ostream (w), denywrite (rb)).

memmap : bool, optional

Is memory mapping to be used? This value is obtained from the configuration item astropy.io.fits.Conf.use_memmap . Default is :None:None:`True`.

save_backup : bool, optional

If the file was opened in update or append mode, this ensures that a backup of the original file is saved before any changes are flushed. The backup has the same name as the original file with ".bak" appended. If "file.bak" already exists then "file.bak.1" is used, and so on. Default is :None:None:`False`.

cache : bool, optional

If the file name is a URL, ~astropy.utils.data.download_file is used to open the file. This specifies whether or not to save the file locally in Astropy's download cache. Default is :None:None:`True`.

lazy_load_hdus : bool, optional

To avoid reading all the HDUs and headers in a FITS file immediately upon opening. This is an optimization especially useful for large files, as FITS has no way of determining the number and offsets of all the HDUs in a file without scanning through the file and reading all the headers. Default is :None:None:`True`.

To disable lazy loading and read all HDUs immediately (the old behavior) use lazy_load_hdus=False . This can lead to fewer surprises--for example with lazy loading enabled, len(hdul) can be slow, as it means the entire FITS file needs to be read in order to determine the number of HDUs. lazy_load_hdus=False ensures that all HDUs have already been loaded after the file has been opened.

versionadded
uint : bool, optional

Interpret signed integer data where BZERO is the central value and BSCALE == 1 as unsigned integer data. For example, int16 data with BZERO = 32768 and BSCALE = 1 would be treated as uint16 data. Default is :None:None:`True` so that the pseudo-unsigned integer convention is assumed.

ignore_missing_end : bool, optional

Do not raise an exception when opening a file that is missing an END card in the last header. Default is :None:None:`False`.

ignore_missing_simple : bool, optional

Do not raise an exception when the SIMPLE keyword is missing. Note that io.fits will raise a warning if a SIMPLE card is present but written in a way that does not follow the FITS Standard. Default is :None:None:`False`.

versionadded
checksum : bool, str, optional

If :None:None:`True`, verifies that both DATASUM and CHECKSUM card values (when present in the HDU header) match the header and data of all HDU's in the file. Updates to a file that already has a checksum will preserve and update the existing checksums unless this argument is given a value of 'remove', in which case the CHECKSUM and DATASUM values are not checked, and are removed when saving changes to the file. Default is :None:None:`False`.

disable_image_compression : bool, optional

If :None:None:`True`, treats compressed image HDU's like normal binary table HDU's. Default is :None:None:`False`.

do_not_scale_image_data : bool, optional

If :None:None:`True`, image data is not scaled using BSCALE/BZERO values when read. Default is :None:None:`False`.

character_as_bytes : bool, optional

Whether to return bytes for string columns, otherwise unicode strings are returned, but this does not respect memory mapping and loads the whole column in memory when accessed. Default is :None:None:`False`.

ignore_blank : bool, optional

If :None:None:`True`, the BLANK keyword is ignored if present. Default is :None:None:`False`.

scale_back : bool, optional

If :None:None:`True`, when saving changes to a file that contained scaled image data, restore the data to the original type and reapply the original BSCALE/BZERO values. This could lead to loss of accuracy if scaling back to integer values after performing floating point operations on the data. Default is :None:None:`False`.

output_verify : str

Output verification option. Must be one of "fix" , "silentfix" , "ignore" , "warn" , or "exception" . May also be any combination of "fix" or "silentfix" with "+ignore" , +warn , or +exception" (e.g. ``"fix+warn" ). See astropy:verify for more info.

Returns

hdulist : `HDUList`

HDUList containing all of the header data units in the file.

Factory function to open a FITS file and return an HDUList object.

Examples

See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

astropy.io.fits.convenience.delval astropy.io.fits.convenience.update astropy.io.fits.convenience.getdata astropy.io.fits.convenience.getheader astropy.io.fits.convenience.info astropy.io.fits.convenience.setval astropy.io.fits.convenience.getval astropy.io.fits.convenience.append

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /astropy/io/fits/hdu/hdulist.py#38
type: <class 'function'>
Commit: