Image, Block & Sequence#
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#
A
Blockis a single unit of processing acting on theImageobject, which can read and write its attributes, or modify data.
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)