aperture_center

jwst.extract_1d.extract.aperture_center(profile, dispaxis=1, middle_pix=None)[source]

Determine the nominal center of an aperture.

The center is determined from a weighted average of the pixel coordinates, where the weights are set by the profile image.

If middle_pix is specified, it is expected to be the dispersion element at which the cross-dispersion center should be determined. In this case, the profile must contain some non-zero elements at that dispersion coordinate.

If dispaxis is 1 (the default), the return values are in (y,x) order. Otherwise, the return values are in (x,y) order.

Parameters:
profilendarray

Pixel weights for the aperture.

dispaxisint, optional

If 1, the dispersion axis is horizontal. Otherwise, the dispersion axis is vertical.

middle_pixint or None

Index value for the center of the slit along the dispersion axis. If specified, it is returned as spec_center.

Returns:
slit_centerfloat

Index value for the center of the aperture along the cross-dispersion axis.

spec_centerfloat

Index value for the center of the aperture along the dispersion axis.