LazyArray

LazyArray(fits_data, header=None, hdu=None)

Lazy-loading proxy for FITS data arrays using memmap.

Per ADR-006: - Defer I/O via astropy.io.fits.open(…, memmap=True) - .shape, .dtype, .header never trigger I/O - Safe: slicing, iteration, .mean(), .sum() - Unsafe (raise NotImplementedError): fancy indexing, reshape, transpose - .materialize() forces full load into RAM

Attributes

Name Description
dtype Array data type. No I/O triggered.
header FITS header. No I/O triggered.
materialized Whether array has been materialized into RAM.
ndim Number of dimensions. No I/O triggered.
shape Array shape. No I/O triggered.
size Total number of elements. No I/O triggered.

Methods

Name Description
astype Cast array to specified dtype - works on memmap data.
copy Create a copy of the array - triggers materialization.
flatten Flatten array - requires materialization.
materialize Force full array load into RAM and return a copy.
max Compute maximum - works on memmap data.
mean Compute mean - works on memmap data without full load.
min Compute minimum - works on memmap data.
ravel Flatten array - requires materialization.
reshape Reshape array - requires materialization.
std Compute standard deviation - works on memmap data.
sum Compute sum - works on memmap data without full load.
swapaxes Swap axes - requires materialization.
transpose Transpose array - requires materialization.

astype

LazyArray.astype(dtype)

Cast array to specified dtype - works on memmap data.

copy

LazyArray.copy()

Create a copy of the array - triggers materialization.

flatten

LazyArray.flatten()

Flatten array - requires materialization.

materialize

LazyArray.materialize()

Force full array load into RAM and return a copy.

max

LazyArray.max(axis=None, dtype=None, out=None)

Compute maximum - works on memmap data.

mean

LazyArray.mean(axis=None, dtype=None, out=None)

Compute mean - works on memmap data without full load.

min

LazyArray.min(axis=None, dtype=None, out=None)

Compute minimum - works on memmap data.

ravel

LazyArray.ravel()

Flatten array - requires materialization.

reshape

LazyArray.reshape(*args, **kwargs)

Reshape array - requires materialization.

std

LazyArray.std(axis=None, dtype=None, out=None)

Compute standard deviation - works on memmap data.

sum

LazyArray.sum(axis=None, dtype=None, out=None)

Compute sum - works on memmap data without full load.

swapaxes

LazyArray.swapaxes(axis1, axis2)

Swap axes - requires materialization.

transpose

LazyArray.transpose(*args)

Transpose array - requires materialization.