astroapers._rust is the expert API for the least Python overhead.
Facts:
Import it as import astroapers._rust as aapr.
It expects raw, C-contiguous (row-major) NumPy arrays with the exact dtype required by the function name. Image, path-data, and mask functions reject other layouts; use np.ascontiguousarray() to convert them before raw calls.
It does not accept mask=, validate=, return_npix=, keyword geometry arguments, scalar/list coordinate normalization, or Python BoundingBox objects.
It returns raw extension values, usually Python lists or tuples of lists.
Function docstrings are currently not generated by the Rust extension, so the examples below are the API guide.
For more raw-call patterns, inspect astroapers.kernels; it is the Python layer that calls _rust internally.
Basic aperture sums
import numpy as npimport astroapers as aapimport astroapers._rust as aaprdata = np.ascontiguousarray(np.ones((32, 32)), dtype=np.float64)x = np.ascontiguousarray([16.0], dtype=np.float64)y = np.ascontiguousarray([16.0], dtype=np.float64)apsum = aapr.apsum_circ_exact_sum(data, x, y, 5.0)apsum_with_npix = aapr.apsum_circ_exact(data, x, y, 5.0)apsum, apsum_with_npix
circular, elliptical, and rectangular raw apsum_* functions;
circular-annulus exact raw apsum_* functions;
raw npix_* functions for simple circle/ellipse/rectangle exact and center modes;
raw weights_* functions for circle, ellipse, rectangle, pill, wedge, path, and their annuli;
raw bboxes_* functions for supported geometries;
parallel-threshold utilities.
For shapes without a fused raw apsum_* function, use raw weights_* or bboxes_*, or use the Python convenience layer when readability and mask handling matter more than minimum overhead.