coronalyze.core.photometry#
Convolution-based aperture photometry for coronagraphic images.
Provides differentiable aperture kernels (soft and hard) and convolution-based flux map generation for efficient photometry calculations.
Functions#
|
Create a circular aperture kernel for convolution-based photometry. |
|
Generate a flux map via convolution with an aperture kernel. |
|
Create a circular aperture mask. |
|
Create a soft (differentiable) circular aperture mask. |
|
Perform circular aperture photometry on an image. |
|
Calculate the solid angle of a circular aperture. |
Module Contents#
- coronalyze.core.photometry.make_aperture_kernel(radius, soft=False, sharpness=10.0)[source]#
Create a circular aperture kernel for convolution-based photometry.
This function is cached (up to 32 configurations) to avoid repeated kernel creation overhead when called with the same parameters.
- Args:
radius: Aperture radius in pixels. soft: If True, use sigmoid-based soft edge for differentiability.
If False, use hard binary mask.
sharpness: Steepness of sigmoid transition (only used if soft=True).
- Returns:
2D aperture kernel. Not normalized (sum of counts, not average).
- Parameters:
radius (float)
soft (bool)
sharpness (float)
- Return type:
jax.numpy.ndarray
- coronalyze.core.photometry.flux_map(image, kernel)[source]#
Generate a flux map via convolution with an aperture kernel.
Each pixel in the output represents the integrated flux that would be measured if an aperture were centered at that position.
- Args:
image: 2D image array. kernel: Aperture kernel from make_aperture_kernel.
- Returns:
2D flux map with same shape as input image.
- Parameters:
image (jax.numpy.ndarray)
kernel (jax.numpy.ndarray)
- Return type:
jax.numpy.ndarray
- coronalyze.core.photometry.circular_aperture_mask(shape, center, radius)[source]#
Create a circular aperture mask.
- Args:
shape: Image shape (ny, nx). center: Center of aperture (y, x) in pixels. radius: Radius of aperture in pixels.
- Returns:
Boolean mask array with True inside the aperture.
- Parameters:
shape (tuple[int, int])
center (tuple[float, float])
radius (float)
- Return type:
jax.numpy.ndarray
- coronalyze.core.photometry.soft_aperture_mask(shape, center, radius, sharpness=10.0)[source]#
Create a soft (differentiable) circular aperture mask.
Uses a sigmoid function to create a smooth transition at the aperture edge, enabling gradient-based optimization through the mask.
- Args:
shape: Image shape (ny, nx). center: Center of aperture (y, x) in pixels. radius: Radius of aperture in pixels. sharpness: Steepness of the sigmoid transition.
- Returns:
Soft mask array with values in [0, 1].
- Parameters:
shape (tuple[int, int])
center (tuple[float, float])
radius (float)
sharpness (float)
- Return type:
jax.numpy.ndarray
- coronalyze.core.photometry.aperture_photometry(image, center, radius)[source]#
Perform circular aperture photometry on an image.
- Args:
image: 2D image array. center: Center of aperture (y, x) in pixels. radius: Radius of aperture in pixels.
- Returns:
Total flux within the aperture.
- Parameters:
image (jax.numpy.ndarray)
center (tuple[float, float])
radius (float)
- Return type:
float
- coronalyze.core.photometry.aperture_solid_angle(radius_pixels, pixel_scale_arcsec)[source]#
Calculate the solid angle of a circular aperture.
- Args:
radius_pixels: Aperture radius in pixels. pixel_scale_arcsec: Pixel scale in arcseconds per pixel.
- Returns:
Solid angle in arcsec^2.
- Parameters:
radius_pixels (float)
pixel_scale_arcsec (float)
- Return type:
float