From 0d63a8fa175e81f1d2777d6a07fed3b08fd9f159 Mon Sep 17 00:00:00 2001 From: lgrcia Date: Fri, 17 Nov 2023 16:14:05 -0500 Subject: [PATCH] docs: example for Get --- prose/blocks/utils.py | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/prose/blocks/utils.py b/prose/blocks/utils.py index 6e6b6b9..e4ec63c 100644 --- a/prose/blocks/utils.py +++ b/prose/blocks/utils.py @@ -87,7 +87,7 @@ def __init__(self, *attributes, name: str = "get", arrays: bool = True, **getter If a list of paths is provided to a :py:class:`~prose.Sequence`, each image is created at the beginning of the sequence, and deleted at the end, so that computed data stored as :py:class:`prose.Image` properties are deleted at each iteration. - Using the Get blocks provides a way to retain any daa stored in images before + This :code:`Get` block provides a way to retain any data stored in images before they are deleted. When a sequence is finished, this block has a `values` property, a dictionary @@ -95,9 +95,6 @@ def __init__(self, *attributes, name: str = "get", arrays: bool = True, **getter a length corresponding to the number of images processed. The parameters of this dictionary are the args and kwargs provided to the block (see Example). - If Image is constructed from a FITS image, header values can be retrieved using the - syntax "keyword:KEY" (see example todo) - Parameters ---------- *attributes: str @@ -111,8 +108,24 @@ def __init__(self, *attributes, name: str = "get", arrays: bool = True, **getter Example ------- - TODO + .. code-block:: python + + from prose import example_image + from prose import blocks + + # example image + image = example_image() + + # running the block + block = blocks.Get(image_shape = lambda im: im.shape) + block.run(image) + + # getting the output + block.image_shape + + .. code-block:: + [array([600, 600])] """ super().__init__(name=name) new_getters = {}