nbodykit.io.fits

Classes

FITSFile(path[, ext]) A file object to handle the reading of FITS data using the fitsio package.
class nbodykit.io.fits.FITSFile(path, ext=None)[source]

A file object to handle the reading of FITS data using the fitsio package.

See also: https://github.com/esheldon/fitsio

Parameters:
  • path (str) – the file path to load
  • ext (number or string, optional) – The extension. Either the numerical extension from zero or a string extension name. If not sent, data is read from the first HDU that has data.

Attributes

columns A list of the names of the columns in the file.
dtype A numpy.dtype object holding the data types of each column in the file.
ncol The number of data columns in the file.
shape The shape of the file, which defaults to (size, )
size The size of the file, i.e., number of rows

Methods

asarray() Return a view of the file, where the fields of the
get_dask(column[, blocksize]) Return the specified column as a dask array, which
keys() Aliased function to return columns
read(columns, start, stop[, step]) Read the specified column(s) over the given range
read(columns, start, stop, step=1)[source]

Read the specified column(s) over the given range

‘start’ and ‘stop’ should be between 0 and size, which is the total size of the file

Parameters:
  • columns (str, list of str) – the name of the column(s) to return
  • start (int) – the row integer to start reading at
  • stop (int) – the row integer to stop reading at
  • step (int, optional) – the step size to use when reading; default is 1
Returns:

structured array holding the requested columns over the specified range of rows

Return type:

numpy.array