Skip to content

numpy

stores.arrays._numpy.NumpyArrayStore(path, disk_format=DiskFormat.NPZ, **kwargs)

Bases: ArrayStore

In-memory array store using NumPy arrays in a flat dict keyed by hierarchical paths.

Paths use '/' to denote nested logical structure but are stored as flat keys.

PARAMETER DESCRIPTION
path

Path to directory where arrays will be stored. For example, this a directory called something like <prj_name>.arrays.

TYPE: Path | str

disk_format

File format when writing arrays to disk.

TYPE: DiskFormat DEFAULT: NPZ

append(path, data, *args, **kwargs)

Append data along the first axis to an existing array at path; if no array exists, creates one.

available()

List all stored paths.

create(path, shape, overwrite=False, dtype=np.dtype(np.float64), fill=None, **kwargs)

dump(**kwargs)

read(path, view=None, **kwargs)

Read the array at path, optionally returning a subset.

PARAMETER DESCRIPTION
path

the key of the stored array.

TYPE: Path | str

view

either a tuple of slice objects for each axis, or a dict mapping axis index to a tuple of slice objects. If None, returns the full array.

TYPE: OptionalSliceSpec DEFAULT: None

RETURNS DESCRIPTION
NDArray[generic] | None

The requested ndarray, or None if path not found.

write(path, data, view=None, **kwargs)

Write or overwrite the array at the given path.