astro py:docs

- Index
- Modules

### Navigation

- next »
- « previous |
- asdf v »
- Developer API »
- Stream

# Stream

class asdf.tags.core.Stream(shape, dtype, strides=None)

  Bases: `object`

  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).tobytes())