orca.transform.photometry

Photometry transforms for FITS image analysis.

Provides functions for source detection, flux measurement, noise estimation, and image quality assessment from radio FITS images.

Attributes

PATCH_SIDE_SIZE

logger

Functions

std_and_max_around_coord(fits_file, coord[, radius])

Calculate the stdev around a given coordinate in a FITS file.

average_with_rms_threshold(→ Optional[str])

Average FITS images while rejecting those with high RMS near a source.

estimate_image_noise(→ float)

Estimate the noise in an image using the median absolute deviation (MAD).

search_src(→ Tuple[float, float])

Search for a source and measure its peak flux and local RMS.

noise(→ float)

Estimate noise level around a source position.

make_fig(v_fns, src, stats_box_size, out_dir)

Generate diagnostic figures showing Stokes I and V images.

Module Contents

orca.transform.photometry.PATCH_SIDE_SIZE = 12[source]
orca.transform.photometry.logger[source]
orca.transform.photometry.std_and_max_around_coord(fits_file, coord, radius=5)[source]

Calculate the stdev around a given coordinate in a FITS file.

Parameters:
  • fits_file (str) – Path to the FITS file.

  • coord (astropy.Coordinates) – The coordinate around which to calculate the stdev.

  • radius (int, optional) – Radius in pixels.

orca.transform.photometry.average_with_rms_threshold(fits_list: List[str], out_fn: str, source_coord: astropy.coordinates.SkyCoord | None, radius_px: int, threshold_multiple: float) str | None[source]

Average FITS images while rejecting those with high RMS near a source.

Calculates RMS in a box around the source coordinate and rejects images where RMS exceeds the median RMS times threshold_multiple.

Parameters:
  • fits_list – List of FITS file paths to average.

  • out_fn – Output file path.

  • source_coord – Coordinate for RMS measurement. If None, no filtering.

  • radius_px – Box half-size in pixels for RMS calculation.

  • threshold_multiple – Reject images with RMS > median * threshold_multiple.

Returns:

Output file path on success.

orca.transform.photometry.estimate_image_noise(arr: numpy.ndarray) float[source]

Estimate the noise in an image using the median absolute deviation (MAD).

Parameters:

arr (np.ndarray) – The image data.

Returns:

The estimated noise.

Return type:

float

orca.transform.photometry.search_src(fn: str, src: astropy.coordinates.SkyCoord, stats_box_size: int, peak_search_box_size: int) Tuple[float, float][source]

Search for a source and measure its peak flux and local RMS.

Parameters:
  • fn – Path to the FITS image.

  • src – Sky coordinate of the source to measure.

  • stats_box_size – Box size in pixels for noise estimation.

  • peak_search_box_size – Box size in pixels for peak search.

Returns:

Tuple of (peak_flux, rms) values.

orca.transform.photometry.noise(im: numpy.ndarray, stats_box_size: int, src: astropy.coordinates.SkyCoord, w: astropy.wcs.WCS) float[source]

Estimate noise level around a source position.

Parameters:
  • im – Image data array.

  • stats_box_size – Box size in pixels for noise estimation.

  • src – Sky coordinate of the source.

  • w – WCS object for coordinate transformation.

Returns:

Estimated noise level using MAD estimator.

orca.transform.photometry.make_fig(v_fns: List[str], src: astropy.coordinates.SkyCoord, stats_box_size: int, out_dir: str)[source]

Generate diagnostic figures showing Stokes I and V images.

Creates side-by-side plots of Stokes I and V cutouts around a source with calibrator positions marked.

Parameters:
  • v_fns – List of Stokes V FITS file paths.

  • src – Source coordinate for cutout center.

  • stats_box_size – Box size for noise estimation.

  • out_dir – Output directory for figures.