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 Verification options for more info.

Returns a dictionary detailing information about the locations
of the indexed HDU within any associated file. The values are
only valid after a read or write of the associated file with
no intervening changes to the HDUList.

Parameters:

index:int

Index of HDU for which info is to be returned.

Returns:

fileinfo:dict or None

The dictionary details information about the locations of
the indexed HDU within an associated file. Returns None
when the HDU is not associated with a file.

Dictionary contents:

Key

Value

file

File object associated with the HDU

filename

Name of associated file object

filemode

Mode in which the file was opened (readonly,
update, append, denywrite, ostream)

resized

Flag that when True indicates that the data has been
resized since the last read/write so the returned values
may not be valid.

Force a write of the HDUList back to the file (for append and
update modes only).

Parameters:

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 Verification options for more info.

Creates an HDUList instance from a string or other in-memory data
buffer containing an entire FITS file. Similar to
HDUList.fromfile(), but does not accept the mode or memmap
arguments, as they are only relevant to reading from a file on disk.

This is useful for interfacing with other libraries such as CFITSIO,
and may also be useful for streaming applications.

Parameters:

data:str, buffer, memoryview, etc.

A string or other memory buffer containing an entire FITS file. It
should be noted that if that memory is read-only (such as a Python
string) the returned HDUList’s data portions will also be
read-only.

An integer value of index indicates the position from which
pop() removes and returns an HDU. A string value or a tuple
of (string,int) functions as a key for identifying the
HDU to be removed and returned. If key is a tuple, it is
of the form (key,ver) where ver is an EXTVER
value that must match the HDU being searched for.

If the key is ambiguous (e.g. there are multiple ‘SCI’ extensions)
the first match is returned. For a more precise match use the
(name,ver) pair.

If even the (name,ver) pair is ambiguous the numeric index
must be used to index the duplicate HDU.

Returns:

hdu:HDU object

The HDU object at position indicated by index or having name
and version specified by index.

File to write to. If a file object, must be opened in a
writeable mode.

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 Verification options for more info.

overwrite:bool, optional

If True, overwrite the output file if it exists. Raises an
OSError if False and the output file exists. Default is
False.

Changed in version 1.3: overwrite replaces the deprecated clobber argument.

checksum:bool

When True adds both DATASUM and CHECKSUM cards
to the headers of all HDU’s written to the file.