phot.center.find_centroid
phot.center.find_centroid(
ccd,
position_xy,
centroider=centroid_com,
maxiters=5,
cbox_size=5.0,
csigma=0,
msky=None,
error=0,
tol_shift=0.0001,
max_shift=1,
max_shift_step=None,
full=False,
)Find the intensity-weighted centroid iteratively.
Notes
Cut out small box region (cbox_size) around the initial position, use pixels above certain threshold, and find the intensity-weighted centroid of the box after subtracting “background”:
csigma=0(or < 1.e-6): Use pixels only above the mean of the box. Ignoremskyanderror. (IRAF default?)csigma=None: Use pixels only above the minimum of the box. Ignoremskyanderror.csigmais a positive number: Use pixels abovemsky + csigma*error.- If
mskyis not given, use the minimum pixel value within the box.
Simply run _centroiding_iteration function iteratively for maxiters times. Given the initial guess of centroid position in image xy coordinate, it finds the intensity-weighted centroid (center of mass) after rejecting pixels by sigma-clipping.
https://iraf.readthedocs.io/en/latest/tasks/noao/digiphot/daophot/centerpars.html
Parameters
ccd : CCDData or ndarray-
The whole image which the
position_xyis calculated. position_xy : array - like-
The position of the initial guess in image XY coordinate. It is assumed that the
position_xyis already quite close to the centroid, so bothmskyandsskyare not needed to be updated at every iteration. centroider : callable = centroid_com-
The centroider function (default uses
photutils.centroid_com). cbox_size : float or int = 5.0-
The size of the box to find the centroid. Recommended to use 2.5 to 4.0 times the seeing FWHM. Minimally about 5 pixel is recommended. If extended source (e.g., comet), recommend larger cbox. See: https://iraf.readthedocs.io/en/latest/tasks/noao/digiphot/apphot/centerpars.html
csigma : float or int = 0-
The parameter to use in sigma-clipping. If
None, pixels ABOVE (not equal to) the minimum pixel value within thecbox_sizewill be used. If0(actually if < 1.e-6), pixels ABOVE the “mean pixel value within thecbox_size” will be used (IRAF default?). Otherwise, pixels abovemsky + csigma*errorwill be used. Default is 0 msky : float = None-
The approximate value of the sky or background. If
None(default), it is the minimum pixel value within thecbox_size. error : (float, ndarray) = 0-
The 1-sigma error-bar for each pixel. If float, a constant error-bar (e.g., sample standard deviation of sky) is assumed. If array-like, it should be in the shape of ccd. Ignored if
csigmaisNoneor0. Default is0. tol_shift : float = 0.0001-
The absolute tolerance for the shift. If the shift in centroid after iteration is smaller than this, iteration stops. Default is
1.0e-4. max_shift : = 1-
The maximum acceptable shift. If shift is larger than this, raises warning. Default is
1. max_shift_step : (float, None) = None-
The maximum acceptable shift for each iteration. If the shift (call it
shift_raw) is larger than this, the actual shift will bemax_shift_steptowards the direction identical toshift_raw. IfNone(default), no such truncation is done. full : bool = False-
Whether to return the original and final cutout images.
Returns
com_xy : list-
The iteratively found centroid position.