Skip to content

Commit

Permalink
Merge branch 'Catalog_CircularMask' into BrightStarGuiding
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonMee committed May 10, 2024
2 parents 793d564 + 21de4d9 commit fcfb990
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pyobs/images/processors/misc/catalog_circular_mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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]]

Expand All @@ -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"]

0 comments on commit fcfb990

Please sign in to comment.