scistag.filestag.bundlers.numpy_bundler.NumpyBundler

class NumpyBundler[source]

Bases: object

Bundles and unpacks numpy data, see Bundle

Methods

bundle

Bundled a numpy array to a bytes stream

unpack

Unpacks the data

Attributes

__dict__

__doc__

__module__

__weakref__

list of weak references to the object (if defined)

classmethod bundle(data, options=None)[source]

Bundled a numpy array to a bytes stream

Parameters
  • data (np.ndarray) – The data to be packed

  • options (BundlingOptions | None) – The bundling options

Return type

(str, bytes)

Returns

The packed data as single bytes strings

static unpack(data, options=None)[source]

Unpacks the data

Parameters
  • data (bytes) – The data to be unpacked

  • options (UnpackOptions | None) – The unpacking options

Return type

np.ndarray

Returns

The restored numpy array