py21cmfast.wrapper.arrays.Array =============================== .. py:class:: py21cmfast.wrapper.arrays.Array A flexible array management class providing state tracking and initialization capabilities. The Array class supports dynamic array creation, caching, and state management with immutable semantics.The class allows for creating arrays with configurable shape, data type, initialization function, and optional caching backend. It provides methods for initializing, setting values, removing values, writing to disk, and loading from disk while maintaining a consistent state. :ivar shape: Dimensions of the array. :ivar dtype: Data type of the array (default is float). :ivar state: Current state of the array. :ivar initfunc: Function used for array initialization (default is np.zeros). :ivar value: Actual array data. :ivar cache_backend: Optional backend for disk caching. .. rubric:: Examples # Create an array with specific shape and initialize arr = Array(shape=(10, 10)) initialized_arr = arr.initialize() # Set a value and write to disk arr = arr.set_value(np.random.rand(10, 10)) arr = arr.written_to_disk(backend) .. !! processed by numpydoc !! .. py:method:: computed() Set the array to a given value and return a new Array. .. !! processed by numpydoc !! .. py:method:: initialize() Initialize the array to its initial/default allocated state. .. !! processed by numpydoc !! .. py:method:: loaded_from_disk(backend = None) Load values for the array from a cache backend, and return a new instance. .. !! processed by numpydoc !! .. py:method:: purged_to_disk(backend) Move the array data to disk and return a new object with correct state. .. !! processed by numpydoc !! .. py:method:: with_value(val) Set the array to a given value and return a new Array. .. !! processed by numpydoc !! .. py:method:: without_value() Remove the allocated data from the array. .. !! processed by numpydoc !! .. py:method:: written_to_disk(backend) Write the array to disk and return a new object with correct state. .. !! processed by numpydoc !! .. py:attribute:: cache_backend .. py:attribute:: dtype .. py:attribute:: initfunc .. py:attribute:: shape .. py:attribute:: state .. py:attribute:: value