diff --git a/pyobs/images/processors/misc/catalog_circular_mask.py b/pyobs/images/processors/misc/catalog_circular_mask.py index bcad6bad..d7c24b6e 100644 --- a/pyobs/images/processors/misc/catalog_circular_mask.py +++ b/pyobs/images/processors/misc/catalog_circular_mask.py @@ -26,6 +26,7 @@ def __init__(self, radius: float, center: Tuple[str, str] = ("CRPIX1", "CRPIX2") # init self._center = center self._radius = radius + self._radius_is_corrected = False async def __call__(self, image: Image) -> Image: """Remove everything outside the given radius from the image. @@ -36,6 +37,8 @@ async def __call__(self, image: Image) -> Image: Returns: Image with masked Catalog. """ + if not self._radius_is_corrected: + self._correct_radius_for_binning(image) center_x, center_y = image.header[self._center[0]], image.header[self._center[1]] @@ -45,5 +48,13 @@ async def __call__(self, image: Image) -> Image: return image + def _correct_radius_for_binning(self, image): + binning_x, binning_y = image.header["XBINNING"], image.header["YBINNING"] + if binning_x == binning_y: + self._radius /= binning_x + else: + log.warning("Binning factor is not the same for x and y axis. Filter radius remains uncorrected ...") + self._radius_is_corrected = True + __all__ = ["CatalogCircularMask"]