redsun.writers¶
Write a derived product against the store a run names.
Writer reads a run's documents for where each product goes: a key of the
acquisition's store, or a store of its own beside it. Nothing is registered
in a catalog.
Without acquire-zarr, importing this package raises ImportError naming
redsun[zarr]. Writing beside an OME-Zarr image needs redsun[ome-zarr],
named the same way on first use.
OME_ZARR
module-attribute
¶
Mimetype of a Zarr store written as OME-Zarr.
Writer
¶
Bases: DocumentRouter
Write a component's products against the stores a run names.
Declare each product before the run: declare gives its layout and
store, derive takes both from the run's descriptor and
stream_resource naming a source data key. The component forwards every
document with writer(name, doc) and hands data over with append
per frame or write for the whole product. A run's stop closes its
streams and writes each product's metadata: the mapping given to write,
and a redsun mapping with the run, source, store and time.
A store's stream opens on the first append or write, with every
product of that store known by then. A product resolves against the
innermost open run naming both its layout and its store, so a nested run
sees what the run around it declared.
declare
¶
Declare a product of frames of shape, a key of the Zarr store at store.
derive
¶
Declare a product laid out and stored as the run's source is.
append
¶
Append one frame, or a stack of frames, to data_key.
Raises:
| Type | Description |
|---|---|
WriterError
|
If data_key was not declared, no open run named its layout and store, or it goes to a store of its own, written whole. |
write
¶
Write the whole of data_key and return the URI it went to.
A key of the run's store is finished at the run's stop; a store of
its own at once, with the layout of data.
Raises:
| Type | Description |
|---|---|
WriterError
|
If data_key was not declared, no open run named its layout and store, or the run described its store with a mimetype no writer knows. |
descriptor
¶
Record the layout of each derived source this stream describes.
stream_resource
¶
Record the store this resource names for its data key.
ArrayShape
dataclass
¶
Shape and dtype of one frame; a stream appends frames along a leading axis.
of
classmethod
¶
Return the layout with shape and dtype normalised.
check
¶
Return data contiguous, as one frame or a stack of frames of this layout.
Raises:
| Type | Description |
|---|---|
WriterError
|
If the trailing dimensions or the dtype differ from this layout. |
WriterError
¶
Bases: RuntimeError
Raised when a product cannot be written against a store.