FitsReader#

class FitsReader#

Chunked FITS file reader.

There are two column-level arguments for reading fits files: column_names and skip_column_names.

  • If neither is provided, we will read and process all columns in the fits file.

  • If column_names is given, we will use _only_ those names, and skip_column_names will be ignored.

  • If skip_column_names is provided, we will remove those columns from processing stages.

NB: Uses astropy table memmap to avoid reading the entire file into memory.

See: https://docs.astropy.org/en/stable/io/fits/index.html#working-with-large-files

chunksize#

number of rows of the file to process at once. For large files, this can prevent loading the entire file into memory at once.

Type:

int

column_names#

list of column names to keep. only use one of column_names or skip_column_names

Type:

list[str]

skip_column_names#

list of column names to skip. only use one of column_names or skip_column_names

Type:

list[str]

hdu#

index of HDU to read. If None, use the first HDU with a table.

Type:

int | None

flatten_tensors#

whether to flatten tensors. If True, the fixed-length list-array will be used, otherwise the arrow extension fixed-shape tensor will be used.

Type:

bool

fits_kwargs#

keyword arguments passed along to astropy.io.fits.open(file_handler, **kwargs). See https://docs.astropy.org/en/stable/io/fits/api/files.html#astropy.io.fits.open

table_kwargs#

keyword arguments passed along to astropy.Table.read(hdu, **kwargs). See https://docs.astropy.org/en/stable/api/astropy.table.Table.html#astropy.table.Table.read

Methods

__init__([chunksize, column_names, ...])

read(input_file[, read_columns])

Read the input file, or chunk of the input file.

read_index_file(input_file[, upath_kwargs])

Read an "indexed" file.

regular_file_exists(input_file, **_kwargs)

Check that the input_file points to a single regular file

__init__(chunksize=500000, column_names=None, skip_column_names=None, hdu: int | None = None, flatten_tensors: bool = True, fits_kwargs: dict[str, object] | None = None, table_kwargs: dict[str, object] | None = None)#
classmethod __new__(*args, **kwargs)#