phot.radprof.radial_profile

phot.radprof.radial_profile(
    im,
    center,
    radii=1,
    thickness=1,
    mask=None,
    norm_by_center=False,
    add_center=False,
    **kwargs,
)

Calculate an annular radial profile of an image.

Parameters

im : ~astropy.nddata.CCDData or ndarray

Image data.

center : tuple of float

Profile center in (x, y) order.

radii : 1-D array = 1

Annulus centers in pixels. Each value is paired with the corresponding thickness.

thickness : int or array of int = 1

Annulus width(s) in pixels. Overlapping annuli are allowed. Default is 1.

mask : 2-D array = None

Boolean mask; True pixels are ignored. Default is None.

norm_by_center : bool = False

Divide profile values and spreads by the absolute center pixel value when True. Default is False.

add_center : bool = False

Prepend the center pixel as r=0, mpix=center value, spix=0, npix=1 when True. Default is False.

****kwargs** : = {}

Additional keyword arguments for sky_fit.

Returns

profs : pandas.DataFrame

Radial profile with columns r, mpix, spix, dpix, npix, nrej, and spix_n. The first five are the radius, estimated value, sample spread, standard error of mpix (sky_fit dsky), and used pixel support; nrej is the number rejected by sky_fit, and spix_n is spix / sqrt(npix), which equals dpix only for the mean estimator.

center_val : float

The value of the pixel at the center position.

Notes

Each annulus delegates its statistics to sky_fit; this function has no separate mode estimator. Visualization’s annular_normalize instead takes nonoverlapping bin edges and transforms the original image.

Examples

>>> profs, center_val = radial_profile(im, center=(50, 50), radii=np.arange(1, 11), thickness=2)
>>> profs
     r      mpix      spix  npix    spix_n
0   0.0  1500.0000   0.0000     1   0.000000
1   1.0   1450.1234  10.5678   12   3.045678
2   2.0   1400.5678  15.6789   28   2.962345
...
>>> profs["spix_n"] = profs["spix"] / np.sqrt(profs["npix"])
>>> plt.errorbar(profs['r'], profs['mpix'], yerr=profs['spix_n'], fmt='o', color="k", capsize=3)
>>> plt.errorbar(profs['r'], profs['mpix'], yerr=profs['spix'], fmt='', color="k", capsize=0, elinewidth=0.5)