Skip to content

Commit

Permalink
Implemented an image processor that adds a given pixel offset to the …
Browse files Browse the repository at this point in the history
…image meta data, so that an acquisition module can simply it.
  • Loading branch information
LeonMee committed Nov 11, 2024
1 parent 5688f2a commit 811d161
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pyobs/images/processors/offsets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""
from .brighteststar_guiding import BrightestStarGuiding
from .offsets import Offsets
from .add_pixeloffset import AddPixelOffset
from .astrometry import AstrometryOffsets
from .brighteststar import BrightestStarOffsets
from .nstar.nstar import NStarOffsets
Expand All @@ -14,6 +15,7 @@

__all__ = [
"Offsets",
"AddPixelOffset",
"AstrometryOffsets",
"NStarOffsets",
"ProjectedOffsets",
Expand Down
26 changes: 26 additions & 0 deletions pyobs/images/processors/offsets/add_pixeloffset.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import logging
from typing import Tuple, Any

from pyobs.images import Image
from pyobs.images.meta import PixelOffsets, OnSkyDistance
from .offsets import Offsets

log = logging.getLogger(__name__)


class AddPixelOffset(Offsets):
"""Adds a given pixel offset to the image meta data, so that an acquisition module can apply it."""
__module__ = "pyobs.images.processors.offsets"

def __init__(self, pixel_offset_x, pixel_offset_y, **kwargs: Any):
Offsets.__init__(self, **kwargs)
self._pixel_offset_x = pixel_offset_x
self._pixel_offset_y = pixel_offset_y


async def __call__(self, image: Image) -> Image:
image.set_meta(PixelOffsets(dx=self._pixel_offset_x, dy=self._pixel_offset_y))
return image


__all__ = ["AddPixelOffset"]

0 comments on commit 811d161

Please sign in to comment.