phot.center.center_sep

phot.center.center_sep(
    data,
    position,
    err=None,
    var=None,
    crad=3,
    bkg='min',
    mask=None,
    maskthresh=0.0,
    minarea=5,
    filter_kernel=sep_default_kernel,
    filter_type='matched',
    deblend_nthresh=32,
    deblend_cont=1,
    clean=False,
    clean_param=1.0,
    maxiters=50,
    tol_shift=0.001,
    max_shift=1,
    max_shift_step=1,
    full=False,
)

Find an object’s center by iterated SEP detection.

Parameters

data : ~astropy.nddata.CCDData, array-like

Image data.

position : array - like

Initial guess in zero-based image (x, y) coordinates.

err : float or ~numpy.ndarray = None

Error or variance array. Supply at most one.

var : float or ~numpy.ndarray = None

Error or variance array. Supply at most one.

crad : float = 3

Radius of the circular cutout. Use about 2–4 times the FWHM while keeping only one object in the cutout. Its approximate side length is 2*crad+1; this cutout is called the centering box (cbox). Default is 3.

bkg : (min, mean, median, float, array_like, sep.Background) = 'min'

Background method within the cbox:

  • "min": use the minimum value of the data.
  • "mean": use the mean value of the data.
  • "median": use the median value of the data.
  • float: use the given value as the background level.
  • array_like: use the given array as the background level.

Default is "min".

mask : ~numpy.ndarray = None

Boolean mask; True values are masked.

maskthresh : float = 0.0

Mask threshold. Values above maskthresh are masked. Default is 0.0.

minarea : int = 5

Minimum detection area in pixels. Default is 5.

filter_kernel : ~numpy.ndarray or None = sep_default_kernel

Object-detection filter kernel. Default is SEP’s kernel.

filter_type : (matched, conv) = 'matched'

Filter type. Default is "matched".

deblend_nthresh : int = 32

Number of deblending thresholds. Default is 32.

deblend_cont : float = 1

Minimum deblending contrast. Set to 1 to disable deblending. Default is 1.

clean : bool = False

Remove spurious detections. Default is False.

clean_param : float = 1.0

Cleaning parameter. Default is 1.0.

maxiters : int = 50

Maximum iterations. Default is 50.

tol_shift : float = 0.001

Stop when the centroid shift is below this absolute tolerance. Default is 1e-3.

max_shift : float = 1

Warn when the total shift exceeds this value. Default is 1.

max_shift_step : float or None = 1

Maximum shift per iteration. Larger shifts are truncated in the same direction. If None, do not truncate. Default is 1.

full : bool = False

Return the shift and SEP histories when True. Default is False.

Returns

pos : ~numpy.ndarray

The final (x, y) position of the centroid.

dxdy : ~numpy.ndarray

The (dx, dy) shift from initial position to final position. Only returned if full=True.

total : float

The total shift in pixels. Only returned if full=True.

objs : list

List of SEP object arrays from each iteration. Only returned if full=True.

segs : list

List of segmentation maps from each iteration. Only returned if full=True.

Notes

Uses SEP (Source Extractor Python) to detect the brightest object in the cutout and iterates until convergence or maxiters is reached.