ProfileBase#
- class photutils.profiles.ProfileBase(data, xycen, radii, *, error=None, mask=None, method='exact', subpixels=5)[source]#
Bases:
object
Abstract base class for profile classes.
- Parameters:
- data2D
ndarray
The 2D data array. The data should be background-subtracted.
- xycentuple of 2 floats
The
(x, y)
pixel coordinate of the source center.- radii1D float
ndarray
An array of radii defining the radial bins.
radii
must be strictly increasing with a minimum value greater than or equal to zero, and contain at least 2 values. The radial spacing does not need to be constant. ForRadialProfile
, the input radii are the edges of the radial annulus bins, and the outputradius
represents the bin centers.- error2D
ndarray
, optional The 1-sigma errors of the input
data
.error
is assumed to include all sources of error, including the Poisson error of the sources (seecalc_total_error
) .error
must have the same shape as the inputdata
.- mask2D bool
ndarray
, optional A boolean mask with the same shape as
data
where aTrue
value indicates the corresponding element ofdata
is masked. Masked data are excluded from all calculations.- method{‘exact’, ‘center’, ‘subpixel’}, optional
The method used to determine the overlap of the aperture on the pixel grid:
'exact'
(default): The exact fractional overlap of the aperture and each pixel is calculated. The aperture weights will contain values between 0 and 1.'center'
: A pixel is considered to be entirely in or out of the aperture depending on whether its center is in or out of the aperture. The aperture weights will contain values only of 0 (out) and 1 (in).'subpixel'
: A pixel is divided into subpixels (see thesubpixels
keyword), each of which are considered to be entirely in or out of the aperture depending on whether its center is in or out of the aperture. Ifsubpixels=1
, this method is equivalent to'center'
. The aperture weights will contain values between 0 and 1.
- subpixelsint, optional
For the
'subpixel'
method, resample pixels by this factor in each dimension. That is, each pixel is divided intosubpixels**2
subpixels. This keyword is ignored unlessmethod='subpixel'
.
- data2D
Attributes Summary
The radial profile as a 1D
ndarray
.The radial profile errors as a 1D
ndarray
.The profile radius in pixels as a 1D
ndarray
.Methods Summary
normalize
([method])Normalize the profile.
plot
([ax])Plot the profile.
plot_error
([ax])Plot the profile errors.
Unnormalize the profile back to the original state before any calls to
normalize
.Attributes Documentation
Methods Documentation
- normalize(method='max')[source]#
Normalize the profile.
- Parameters:
- method{‘max’, ‘sum’}, optional
The method used to normalize the profile:
'max'
(default): The profile is normalized such that its maximum value is 1.'sum'
: The profile is normalized such that its sum (integral) is 1.
- plot(ax=None, **kwargs)[source]#
Plot the profile.
- Parameters:
- ax
matplotlib.axes.Axes
orNone
, optional The matplotlib axes on which to plot. If
None
, then the currentAxes
instance is used.- **kwargsdict, optional
Any keyword arguments accepted by
matplotlib.pyplot.plot
.
- ax
- Returns:
- lineslist of
Line2D
A list of lines representing the plotted data.
- lineslist of
- plot_error(ax=None, **kwargs)[source]#
Plot the profile errors.
- Parameters:
- ax
matplotlib.axes.Axes
orNone
, optional The matplotlib axes on which to plot. If
None
, then the currentAxes
instance is used.- **kwargsdict, optional
Any keyword arguments accepted by
matplotlib.pyplot.fill_between
.
- ax
- Returns:
- lines
matplotlib.collections.PolyCollection
A
PolyCollection
containing the plotted polygons.
- lines