sep.winpos

sep.winpos(data, xinit, yinit, sig, mask=None, maskthresh=0.0, subpix=11, minsig=2.0/2.35*0.5)

Calculate more accurate object centroids using ‘windowed’ algorithm.

Starting from the supplied initial center position, an iterative algorithm is used to determine a better object centroid. On each iteration, the centroid is calculated using all pixels within a circular aperture of 4*sig from the current position, weighting pixel positions by their flux and the amplitude of a 2-d Gaussian with sigma sig. Iteration stops when the change in position falls under some threshold or a maximum number of iterations is reached. This is equivalent to XWIN_IMAGE and YWIN_IMAGE parameters in Source Extractor (for the correct choice of sigma for each object).

Note: One should be cautious about using windowed positions in crowded fields or for sources with nearby neighbors, as the iterative algorithm can fail catastrophically.

Parameters:
data : ndarray

Data array.

xinit, yinit : array_like

Initial center(s).

sig : array_like

Gaussian sigma used for weighting pixels. Pixels within a circular aperture of radius 4*sig are included.

mask : numpy.ndarray, optional

An optional mask.

maskthresh : float, optional

Pixels with mask > maskthresh will be ignored.

subpix : int, optional

Subpixel sampling used to determine pixel overlap with aperture. 11 is used in Source Extractor. For exact overlap calculation, use 0.

minsig : float, optional

Minimum bound on sig parameter. sig values smaller than this are increased to minsig to replicate Source Extractor behavior. Source Extractor uses a minimum half-light radius of 0.5 pixels, equivalent to a sigma of 0.5 * 2.0 / 2.35.

Returns:
x, y : np.ndarray

New x and y position(s).

flag : np.ndarray

Flags.