# 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 background-subtracted. Non-finite data values (NaN and +/- inf) are automatically masked.

segment_imgSegmentationImage or array_like (int)

A 2D segmentation image, either as a SegmentationImage object or an ndarray, with the same shape as data 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 (see calc_total_error) . error must have the same shape as the input data. Non-finite error values (NaN and +/- inf) are not automatically masked, unless they are at the same position of non-finite values in the input data array. Such pixels can be masked using the mask keyword. See the Notes section below for details on the error propagation.

A boolean mask with the same shape as data where a True value indicates the corresponding element of data is masked. Masked data are excluded from all calculations. Non-finite values (NaN and +/- inf) in the input data 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 input data. Inputting the background merely allows for its properties to be measured within each source segment. The input background does not get subtracted from the input data, which should already be background-subtracted. Non-finite background values (NaN and +/- inf) are not automatically masked, unless they are at the same position of non-finite values in the input data array. Such pixels can be masked using the mask keyword.

filter_kernelarray-like (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()). If None, then the unfiltered data will be used instead.

wcsNone 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). If None, then all sky-based properties will be set to None.

labelsint, array-like (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_widthNone 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 the source_sum, max_value, min_value, and kron_flux properties. It does not affect the moment-based 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’: 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 the aperture_photometry() keywords method and subpixels, respectively, which are used to measure the flux in the Kron aperture.

Returns
outputLegacySourceCatalog instance

A LegacySourceCatalog instance containing the properties of each source.

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 background-subtracted “detection” image into the filtered_data keyword. If filtered_data is None, then the unfiltered data will be used for the source centroid and morphological parameters.

Negative data values (filtered_data or data) 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 that source_sum always includes the contribution of negative data 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 pixel-wise total errors over the non-masked 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 non-masked pixels in the source segment, and $$\sigma_{\mathrm{tot}, i}$$ is the input error array.