open

astrodata.open(source)

Return an AstroData instance from a file or HDUList.

Takes either a string (with the path to a file) or an HDUList as input, and tries to return an AstroData instance.

It will raise exceptions if the file is not found, or if there is no match for the HDUList, among the registered AstroData classes.

Returns an instantiated object, or raises AstroDataError if it was not possible to find a match

Parameters:

source (str, os.PathLike or fits.HDUList) – The path to the file or the HDUList object. If a string is passed, it will be treated as a path to a file.

Returns:

An instantiated object. It will be a subclass of AstroData.

Return type:

AstroData