Image, Block & Sequence#

../_images/pipeline.png

prose contains the structure to build modular image processing pipelines with three key objects: Image going through a list of Block assembled into a Sequence.

Image, Block and Sequence#

  • An Image contains the Image data as well as its header metadata.

../_images/image.png
  • A Block is a single unit of processing acting on the Image object, which can read and write its attributes, or modify data.

  • A Sequence is a succesion of Block.

With this architecture proseΒ can deal with any type of FITS images (check Telescope object next).

Example: Hello world#

Let’s have a random set of images

from prose import Image, Block, Sequence
import numpy as np

np.random.seed(42)
images = [Image(data=np.random.rand(10,10)) for i in range(5)]

Here is a block printing hello world and the image mean

class HelloWorld(Block):
    def run(self, image):
        image.mean = np.mean(image.data)
        print(f"Hello world (mean: {image.mean:.2f})")

and running a sequence with it

sequence = Sequence([
    HelloWorld(),
])

sequence.run(images)
RUN Hello world: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 5/5 [00:00<00:00, 15720.78 images/s

Hello world (mean: 0.47)
Hello world (mean: 0.50)
Hello world (mean: 0.52)
Hello world (mean: 0.49)
Hello world (mean: 0.52)