Skip to content

ordeq_numpy

NumpyBinary dataclass

Bases: IO[ndarray]

IO to load from and save binary numpy arrays.

Example usage:

>>> from pathlib import Path
>>> from ordeq_numpy import NumpyBinary
>>> MyArray = NumpyBinary(
...     path=Path("path/to.npy")
... )

load(**load_options)

Load numpy array with optional parameters.

Parameters:

Name Type Description Default
**load_options Any

Arguments passed to np.load() (e.g., mmap_mode, allow_pickle, max_header_size)

{}

Returns:

Type Description
ndarray

Numpy array

save(array, **save_options)

Save numpy array with optional parameters.

Parameters:

Name Type Description Default
array ndarray

The array to save

required
**save_options Any

Arguments passed to np.save() (e.g., allow_pickle, fix_imports)

{}

NumpyText dataclass

Bases: IO[ndarray]

IO to load from and save plain text numpy arrays.

Example usage:

>>> from pathlib import Path
>>> from ordeq_numpy import NumpyText
>>> MyArray = NumpyText(
...     path=Path("path/to.txt")
... )

load(**load_options)

Load numpy array with optional parameters.

Parameters:

Name Type Description Default
**load_options Any

Arguments passed to np.loadtxt() (e.g., dtype, delimiter, skiprows, max_rows)

{}

Returns:

Type Description
ndarray

Numpy array

save(array, **save_options)

Save numpy array with optional parameters.

Parameters:

Name Type Description Default
array ndarray

The array to save

required
**save_options Any

Arguments passed to np.savetxt() (e.g., fmt, delimiter, header, footer)

{}