npix_rect_center

npix_rect_center(x, y, w, h, theta=0.0, *, shape, mask=None, validate=True)

Return center-selected rotated-rectangle-aperture effective in-frame pixel counts.

Parameters

x, y : scalar or array_like

Aperture center coordinates in pixel units. Shapes must match after numpy.atleast_1d. The return shape matches that broadcast-free input shape, so scalar inputs return one-element arrays.

w, h : float

Full rectangle width and height in pixels. w is measured along the rectangle’s local x axis, and h along its local y axis. At theta=0, the width axis is aligned with the image x axis and the height axis is aligned with the image y axis.

theta : float, optional = 0.0

Rotation angle in radians, measured counterclockwise from the positive image x axis to the rectangle’s local width axis.

shape : tuple[int, int]

Image shape as (ny, nx) used to clip the aperture footprint.

mask : array_like of bool, optional = None

Boolean image mask with shape shape. True pixels are excluded from the returned effective pixel count.

Returns

npix : ndarray

Effective pixel count inside the image frame.

Notes

center mode uses binary weights selected by pixel-center inclusion. The boundary convention matches Photutils for supported shapes: pixels exactly on the outer boundary are excluded, and annuli include the inner boundary while excluding the outer boundary.