Stream

class asdf.Stream(shape, dtype, strides=None)[source]

Bases: asdf.tags.core.ndarray.NDArrayType

Used to put a streamed array into the tree.

Examples

Save a double-precision array with 1024 columns, one row at a time:

>>> from asdf import AsdfFile, Stream
>>> import numpy as np
>>> ff = AsdfFile()
>>> ff.tree['streamed'] = Stream([1024], np.float64)
>>> with open('test.asdf', 'wb') as fd:
...     ff.write_to(fd)
...     for i in range(200):
...         nbytes = fd.write(
...                      np.array([i] * 1024, np.float64).tostring())

Attributes Summary

has_required_modules
name
types

Methods Summary

from_tree(data, ctx)
reserve_blocks(data, ctx)
to_tree(data, ctx)

Attributes Documentation

has_required_modules = True
name = None
types = []

Methods Documentation

classmethod from_tree(data, ctx)[source]
classmethod reserve_blocks(data, ctx)[source]
classmethod to_tree(data, ctx)[source]