bundles / astropy latest / astropy / io / fits / hdu / hdulist / fitsopen
function
astropy.io.fits.hdu.hdulist:fitsopen
source: /astropy/io/fits/hdu/hdulist.py :48
Signature
def fitsopen ( name , mode = readonly , memmap = None , save_backup = False , cache = True , lazy_load_hdus = None , ignore_missing_simple = False , * , use_fsspec = None , fsspec_kwargs = None , decompress_in_memory = False , ** kwargs ) Summary
Factory function to open a FITS file and return an HDUList object.
Parameters
name: str, file-like or `pathlib.Path`File to be opened.
mode: str, optionalOpen mode, 'readonly', 'update', 'append', 'denywrite', or 'ostream'. Default is 'readonly'.
If
nameis a file object that is already opened,modemust match the mode the file was opened with, readonly (rb), update (rb+), append (ab+), ostream (w), denywrite (rb)).memmap: bool, optionalIs memory mapping to be used? This value is obtained from the configuration item
astropy.io.fits.Conf.use_memmap. Default isTrue.save_backup: bool, optionalIf 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
False.cache: bool, optionalIf the file name is a URL, 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
True.lazy_load_hdus: bool, optionalTo 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
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=Falseensures that all HDUs have already been loaded after the file has been opened.uint: bool, optionalInterpret signed integer data where
BZEROis the central value andBSCALE == 1as unsigned integer data. For example,int16data withBZERO = 32768andBSCALE = 1would be treated asuint16data. Default isTrueso that the pseudo-unsigned integer convention is assumed.ignore_missing_end: bool, optionalDo not raise an exception when opening a file that is missing an
ENDcard in the last header. Default isFalse.ignore_missing_simple: bool, optionalDo 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
False.checksum: bool, str, optionalIf
True, verifies that bothDATASUMandCHECKSUMcard 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 isFalse.disable_image_compression: bool, optionalIf
True, treats compressed image HDU's like normal binary table HDU's. Default isFalse.do_not_scale_image_data: bool, optionalIf
True, image data is not scaled using BSCALE/BZERO values when read. Default isFalse.character_as_bytes: bool, optionalWhether 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
False.ignore_blank: bool, optionalIf
True, the BLANK keyword is ignored if present. Default isFalse.scale_back: bool, optionalIf
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 isFalse.output_verify: strOutput 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"). Seeastropy:verifyfor more info.use_fsspec: bool, optionalUse
fsspec.opento open the file? Defaults toFalseunlessnamestarts with the Amazon S3 storage prefixs3://or the Google Cloud Storage prefixgs://. Can also be used for paths with other prefixes (e.g.,http://) but in this case you must explicitly passuse_fsspec=True. Use of this feature requires the optionalfsspecpackage. AModuleNotFoundErrorwill be raised if the dependency is missing.fsspec_kwargs: dict, optionalKeyword arguments passed on to
fsspec.open. This can be used to configure cloud storage credentials and caching behavior. For example, passfsspec_kwargs={"anon": True}to enable anonymous access to Amazon S3 open data buckets. Seefsspec's documentation for available parameters.decompress_in_memory: bool, optionalBy default files are decompressed progressively depending on what data is needed. This is good for memory usage, avoiding decompression of the whole file, but it can be slow. With decompress_in_memory=True it is possible to decompress instead the whole file in memory.
Returns
hdulist: `HDUList`HDUList containing all of the header data units in the file.
Aliases
-
astropy.io.fits.open
Referenced by
This package
- astropy.io.fits.convenience
- astropy.io.fits.convenience:append
- astropy.io.fits.convenience:delval
- astropy.io.fits.convenience:getdata
- astropy.io.fits.convenience:getheader
- astropy.io.fits.convenience:getval
- astropy.io.fits.convenience:info
- astropy.io.fits.convenience:setval
- astropy.io.fits.convenience:update
- astropy.io.fits.hdu.hdulist:HDUList.fromstring