SourceCatalog

class photutils.segmentation.SourceCatalog(properties_list, wcs=None)[source]

Bases: object

Class to hold source catalogs.

Attributes Summary

dec_icrs_centroid

Deprecated since version 0.4.

icrs_centroid

Deprecated since version 0.4.

ra_icrs_centroid

Deprecated since version 0.4.

sky_bbox_ll
sky_bbox_lr
sky_bbox_ul
sky_bbox_ur
sky_centroid
sky_centroid_icrs

Methods Summary

to_table([columns, exclude_columns]) Construct a QTable of source properties from a SourceCatalog object.

Attributes Documentation

dec_icrs_centroid

Deprecated since version 0.4: The dec_icrs_centroid function is deprecated and may be removed in a future version. Use sky_centroid_icrs.dec instead.

icrs_centroid

Deprecated since version 0.4: The icrs_centroid function is deprecated and may be removed in a future version. Use sky_centroid_icrs instead.

ra_icrs_centroid

Deprecated since version 0.4: The ra_icrs_centroid function is deprecated and may be removed in a future version. Use sky_centroid_icrs.ra instead.

sky_bbox_ll
sky_bbox_lr
sky_bbox_ul
sky_bbox_ur
sky_centroid
sky_centroid_icrs

Methods Documentation

to_table(columns=None, exclude_columns=None)[source]

Construct a QTable of source properties from a SourceCatalog object.

If columns or exclude_columns are not input, then the QTable will include most scalar-valued source properties. Multi-dimensional properties, e.g. data_cutout, can be included in the columns input, but they will not be preserved when writing the table to a file. This is a limitation of multi-dimensional columns in astropy tables.

Parameters:

columns : str or list of str, optional

Names of columns, in order, to include in the output QTable. The allowed column names are any of the attributes of SourceProperties.

exclude_columns : str or list of str, optional

Names of columns to exclude from the default properties list in the output QTable. The default properties are those with scalar values:

‘id’, ‘xcentroid’, ‘ycentroid’, ‘sky_centroid’, ‘sky_centroid_icrs’, ‘source_sum’, ‘source_sum_err’, ‘background_sum’, ‘background_mean’, ‘background_at_centroid’, ‘xmin’, ‘xmax’, ‘ymin’, ‘ymax’, ‘min_value’, ‘max_value’, ‘minval_xpos’, ‘minval_ypos’, ‘maxval_xpos’, ‘maxval_ypos’, ‘area’, ‘equivalent_radius’, ‘perimeter’, ‘semimajor_axis_sigma’, ‘semiminor_axis_sigma’, ‘eccentricity’, ‘orientation’, ‘ellipticity’, ‘elongation’, ‘covar_sigx2’, ‘covar_sigxy’, ‘covar_sigy2’, ‘cxx’, ‘cxy’, ‘cyy’

Returns:

table : QTable

A table of source properties with one row per source.

Examples

>>> import numpy as np
>>> from photutils import source_properties
>>> image = np.arange(16.).reshape(4, 4)
>>> print(image)
[[  0.   1.   2.   3.]
[  4.   5.   6.   7.]
[  8.   9.  10.  11.]
[ 12.  13.  14.  15.]]
>>> segm = SegmentationImage([[1, 1, 0, 0],
...                           [1, 0, 0, 2],
...                           [0, 0, 2, 2],
...                           [0, 2, 2, 0]])
>>> cat = source_properties(image, segm)
>>> columns = ['id', 'xcentroid', 'ycentroid', 'source_sum']
>>> tbl = cat.to_table(columns=columns)
>>> tbl['xcentroid'].info.format = '.10f'  # optional format
>>> tbl['ycentroid'].info.format = '.10f'  # optional format
>>> print(tbl)
id  xcentroid    ycentroid   source_sum
        pix          pix
--- ------------ ------------ ----------
1 0.2000000000 0.8000000000        5.0
2 2.0909090909 2.3636363636       55.0