source_properties¶

photutils.segmentation.
source_properties
(data, segment_img, error=None, mask=None, background=None, filter_kernel=None, wcs=None, labels=None, localbkg_width=None, kron_params=('mask', 2.5, 0.0, 'exact', 5))[source]¶ Deprecated since version 1.1: The source_properties function is deprecated and may be removed in a future version. Use
SourceCatalog
instead.Calculate photometry and morphological properties of sources defined by a labeled segmentation image (deprecated).
 Parameters
 dataarray_like or
Quantity
The 2D array from which to calculate the source photometry and properties.
data
should be backgroundsubtracted. Nonfinitedata
values (NaN and +/ inf) are automatically masked. segment_img
SegmentationImage
or array_like (int) A 2D segmentation image, either as a
SegmentationImage
object or anndarray
, with the same shape asdata
where sources are labeled by different positive integer values. A value of zero is reserved for the background. errorarray_like or
Quantity
, optional The total error array corresponding to the input
data
array.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
. Nonfiniteerror
values (NaN and +/ inf) are not automatically masked, unless they are at the same position of nonfinite values in the inputdata
array. Such pixels can be masked using themask
keyword. See the Notes section below for details on the error propagation. maskarray_like (bool), 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. Nonfinite values (NaN and +/ inf) in the inputdata
are automatically masked. backgroundfloat, array_like, or
Quantity
, optional The background level that was previously present in the input
data
.background
may either be a scalar value or a 2D image with the same shape as the inputdata
. Inputting thebackground
merely allows for its properties to be measured within each source segment. The inputbackground
does not get subtracted from the inputdata
, which should already be backgroundsubtracted. Nonfinitebackground
values (NaN and +/ inf) are not automatically masked, unless they are at the same position of nonfinite values in the inputdata
array. Such pixels can be masked using themask
keyword. filter_kernelarraylike (2D) or
Kernel2D
, optional The 2D array of the kernel used to filter the data prior to calculating the source centroid and morphological parameters. The kernel should be the same one used in defining the source segments, i.e., the detection image (e.g., see
detect_sources()
). IfNone
, then the unfiltereddata
will be used instead. wcs
None
or WCS object, optional A world coordinate system (WCS) transformation that supports the astropy shared interface for WCS (e.g.,
astropy.wcs.WCS
,gwcs.wcs.WCS
). IfNone
, then all skybased properties will be set toNone
. labelsint, arraylike (1D, int)
The segmentation labels for which to calculate source properties. If
None
(default), then the properties will be calculated for all labeled sources. localbkg_width
None
or positive int, optional The width of the rectangular annulus used to compute a local background around each source. If
None
then no local background subtraction is performed. The local background affects thesource_sum
,max_value
,min_value
, andkron_flux
properties. It does not affect the momentbased morphological properties of the source. kron_paramstuple of list, optional
A list of five parameters used to determine how the Kron radius and flux are calculated. The first item represents how data pixels are masked around the source. It must be one of:
 ‘none’: do not mask any pixels (equivalent to
MASK_TYPE=NONE in SourceExtractor).
 ‘mask’: mask pixels assigned to neighboring sources
(equivalent to MASK_TYPE=BLANK in SourceExtractor)
‘mask_all’: mask all pixels outside of the source segment.
 ‘correct’: replace pixels assigned to neighboring sources
by replacing them with pixels on the opposite side of the source (equivalent to MASK_TYPE=CORRECT in SourceExtractor).
The second item represents the scaling parameter of the Kron radius as a scalar float. The third item represents the minimum circular radius as a scalar float. If the Kron radius times sqrt(
semimajor_axis_sigma
*semiminor_axis_sigma
) is less than than this radius, then the Kron flux will be measured in a circle with this minimum radius. The forth and fifth items represent theaperture_photometry()
keywordsmethod
andsubpixels
, respectively, which are used to measure the flux in the Kron aperture.
 dataarray_like or
 Returns
 output
LegacySourceCatalog
instance A
LegacySourceCatalog
instance containing the properties of each source.
 output
See also
Notes
SourceExtractor’s centroid and morphological parameters are always calculated from a filtered “detection” image, i.e., the image used to define the segmentation image. The usual downside of the filtering is the sources will be made more circular than they actually are. If you wish to reproduce SourceExtractor centroid and morphology results, then input a filtered and backgroundsubtracted “detection” image into the
filtered_data
keyword. Iffiltered_data
isNone
, then the unfiltereddata
will be used for the source centroid and morphological parameters.Negative data values (
filtered_data
ordata
) within the source segment are set to zero when calculating morphological properties based on image moments. Negative values could occur, for example, if the segmentation image was defined from a different image (e.g., different bandpass) or if the background was oversubtracted. Note thatsource_sum
always includes the contribution of negativedata
values.The input
error
is assumed to include all sources of error, including the Poisson error of the sources.source_sum_err
is simply the quadrature sum of the pixelwise total errors over the nonmasked pixels within the source segment:\[\Delta F = \sqrt{\sum_{i \in S} \sigma_{\mathrm{tot}, i}^2}\]where \(\Delta F\) is
source_sum_err
, \(S\) are the nonmasked pixels in the source segment, and \(\sigma_{\mathrm{tot}, i}\) is the inputerror
array.