astro py:docs

- Index
- Modules

### Navigation

- next »
- « previous |
- asdf v1.3.3 »
- Stream

# Stream

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

  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` |
  `supported_versions` |
  `types` |

  Methods Summary

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

  Attributes Documentation

  `has_required_modules` = True
  `name` = None
  `supported_versions` = []
  `types` = []

  Methods Documentation

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