nanover.utilities.packing module
- class nanover.utilities.packing.PackingPair(*, pack: Callable[[U], P], unpack: Callable[[P], U])
Bases:
Generic[U,P]Pair of functions for packing and unpacking rich data into and from simpler types understood by MessagePack.
- pack: Callable[[U], P]
- unpack: Callable[[P], U]
- nanover.utilities.packing.make_bytes_packer(dtype: dtype[Any] | None | type[Any] | _SupportsDType[dtype[Any]] | str | tuple[Any, int] | tuple[Any, SupportsIndex | Sequence[SupportsIndex]] | list[Any] | _DTypeDict | tuple[Any, Any], shape: tuple[int, ...] = (-1,))
- nanover.utilities.packing.pack_array(values: Iterable, *, dtype: dtype[Any] | None | type[Any] | _SupportsDType[dtype[Any]] | str | tuple[Any, int] | tuple[Any, SupportsIndex | Sequence[SupportsIndex]] | list[Any] | _DTypeDict | tuple[Any, Any]) bytes
Serialize an array of numbers into bytes of the given dtype.
- nanover.utilities.packing.unpack_array(buffer: bytes, *, dtype: dtype[Any] | None | type[Any] | _SupportsDType[dtype[Any]] | str | tuple[Any, int] | tuple[Any, SupportsIndex | Sequence[SupportsIndex]] | list[Any] | _DTypeDict | tuple[Any, Any]) ndarray[tuple[int, ...], dtype[_ScalarType_co]]
Deserialize an array of numeric data of the given dtype from bytes.