py21cmfast.wrapper.arrays¶
Module for dealing with arrays that are input/output to C functions.
Attributes¶
Classes¶
A flexible array management class providing state tracking and initialization capabilities. |
|
Exposes an OutputStruct's Array field as a plain numpy array. |
|
Abstract base class for cache backends. |
|
Backend for caching arrays in a HDF5 file. |
Functions¶
|
Class decorator exposing every private Array field as a plain numpy array. |
Module Contents¶
- py21cmfast.wrapper.arrays.expose_arrays(cls: type) type[source]¶
Class decorator exposing every private Array field as a plain numpy array.
Must be applied outside attrs.define, so that it runs once attrs has finished building the class:
@expose_arrays @attrs.define(slots=False, kw_only=True) class InitialConditions(OutputStruct): _hires_density = _arrayfield()
Keeping the Array in the private field means attrs’ generated __repr__, eq and asdict continue to see it, so inspecting a purged struct still never touches the disk. The public name is purely this descriptor. attrs strips the leading underscore for __init__, so InitialConditions(hires_density=…) is unchanged.
- Parameters:
cls (type)
- Return type:
type