delayed_image.delayed_base module

Abstract nodes

class delayed_image.delayed_base.DelayedOperation[source]

Bases: NiceRepr

nesting()[source]
Returns:

Dict[str, dict]

as_graph(fields='auto')[source]

Builds the underlying graph structure as a networkx graph with human readable labels.

Parameters:

fields (str | List[str]) – Add the specified fields as labels. If ‘auto’ then does somthing “reasonable”. If ‘all’ then shows everything. TODO: only implemented for “auto” and “all”, implement general field selection (PR Wanted).

Returns:

networkx.DiGraph

leafs()[source]

Iterates over all leafs in the tree.

Yields:

Tuple[DelayedOperation]

print_graph(fields='auto', with_labels=True, rich='auto', vertical_chains=True)[source]

Alias for write_network_text

Parameters:
  • fields (str | List[str]) – Add the specified fields as labels. If ‘auto’ then does somthing “reasonable”. If ‘all’ then shows everything. TODO: only implemented for “auto” and “all”, implement general field selection (PR Wanted).

  • with_labels (bool) – set to false for no label data

  • rich (bool | str) – defaults to ‘auto’

  • vertical_chains (bool) – Defaults to True. Set to false to save vertical space at the cost of horizontal space.

write_network_text(fields='auto', with_labels=True, rich='auto', vertical_chains=True)[source]

Alias for DelayedOperation.print_graph()

property shape

Returns: None | Tuple[int | None, …]

children()[source]
Yields:

Any

prepare()[source]

If metadata is missing, perform minimal IO operations in order to prepopulate metadata that could help us better optimize the operation tree.

Returns:

DelayedOperation

finalize(prepare=True, optimize=True, **kwargs)[source]

Evaluate the operation tree in full.

Parameters:
  • prepare (bool) – ensure prepare is called to ensure metadata exists if possible before optimizing. Defaults to True.

  • optimize (bool) – ensure the graph is optimized before loading. Default to True.

  • **kwargs – for backwards compatibility, these will allow for in-place modification of select nested parameters.

Returns:

ArrayLike

Notes

Do not overload this method. Overload DelayedOperation._finalize() instead.

optimize()[source]
Returns:

DelayedOperation

class delayed_image.delayed_base.DelayedNaryOperation(parts)[source]

Bases: DelayedOperation

For operations that have multiple input arrays

children()[source]
Yields:

Any

class delayed_image.delayed_base.DelayedUnaryOperation(subdata)[source]

Bases: DelayedOperation

For operations that have a single input array

children()[source]
Yields:

Any