id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
10,500 | astropy/photutils | photutils/extern/sigma_clipping.py | _nanstd | def _nanstd(array, axis=None, ddof=0):
"""Bottleneck nanstd function that handle tuple axis."""
if isinstance(axis, tuple):
array = _move_tuple_axes_first(array, axis=axis)
axis = 0
return bottleneck.nanstd(array, axis=axis, ddof=ddof) | python | def _nanstd(array, axis=None, ddof=0):
"""Bottleneck nanstd function that handle tuple axis."""
if isinstance(axis, tuple):
array = _move_tuple_axes_first(array, axis=axis)
axis = 0
return bottleneck.nanstd(array, axis=axis, ddof=ddof) | [
"def",
"_nanstd",
"(",
"array",
",",
"axis",
"=",
"None",
",",
"ddof",
"=",
"0",
")",
":",
"if",
"isinstance",
"(",
"axis",
",",
"tuple",
")",
":",
"array",
"=",
"_move_tuple_axes_first",
"(",
"array",
",",
"axis",
"=",
"axis",
")",
"axis",
"=",
"0... | Bottleneck nanstd function that handle tuple axis. | [
"Bottleneck",
"nanstd",
"function",
"that",
"handle",
"tuple",
"axis",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/extern/sigma_clipping.py#L69-L75 |
10,501 | astropy/photutils | photutils/extern/sigma_clipping.py | sigma_clip | def sigma_clip(data, sigma=3, sigma_lower=None, sigma_upper=None, maxiters=5,
cenfunc='median', stdfunc='std', axis=None, masked=True,
return_bounds=False, copy=True):
"""
Perform sigma-clipping on the provided data.
The data will be iterated over, each time rejecting values t... | python | def sigma_clip(data, sigma=3, sigma_lower=None, sigma_upper=None, maxiters=5,
cenfunc='median', stdfunc='std', axis=None, masked=True,
return_bounds=False, copy=True):
"""
Perform sigma-clipping on the provided data.
The data will be iterated over, each time rejecting values t... | [
"def",
"sigma_clip",
"(",
"data",
",",
"sigma",
"=",
"3",
",",
"sigma_lower",
"=",
"None",
",",
"sigma_upper",
"=",
"None",
",",
"maxiters",
"=",
"5",
",",
"cenfunc",
"=",
"'median'",
",",
"stdfunc",
"=",
"'std'",
",",
"axis",
"=",
"None",
",",
"mask... | Perform sigma-clipping on the provided data.
The data will be iterated over, each time rejecting values that are
less or more than a specified number of standard deviations from a
center value.
Clipped (rejected) pixels are those where::
data < cenfunc(data [,axis=int]) - (sigma_lower * stdfu... | [
"Perform",
"sigma",
"-",
"clipping",
"on",
"the",
"provided",
"data",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/extern/sigma_clipping.py#L467-L640 |
10,502 | astropy/photutils | photutils/extern/sigma_clipping.py | sigma_clipped_stats | def sigma_clipped_stats(data, mask=None, mask_value=None, sigma=3.0,
sigma_lower=None, sigma_upper=None, maxiters=5,
cenfunc='median', stdfunc='std', std_ddof=0,
axis=None):
"""
Calculate sigma-clipped statistics on the provided data.
... | python | def sigma_clipped_stats(data, mask=None, mask_value=None, sigma=3.0,
sigma_lower=None, sigma_upper=None, maxiters=5,
cenfunc='median', stdfunc='std', std_ddof=0,
axis=None):
"""
Calculate sigma-clipped statistics on the provided data.
... | [
"def",
"sigma_clipped_stats",
"(",
"data",
",",
"mask",
"=",
"None",
",",
"mask_value",
"=",
"None",
",",
"sigma",
"=",
"3.0",
",",
"sigma_lower",
"=",
"None",
",",
"sigma_upper",
"=",
"None",
",",
"maxiters",
"=",
"5",
",",
"cenfunc",
"=",
"'median'",
... | Calculate sigma-clipped statistics on the provided data.
Parameters
----------
data : array-like or `~numpy.ma.MaskedArray`
Data array or object that can be converted to an array.
mask : `numpy.ndarray` (bool), optional
A boolean mask with the same shape as ``data``, where a `True`
... | [
"Calculate",
"sigma",
"-",
"clipped",
"statistics",
"on",
"the",
"provided",
"data",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/extern/sigma_clipping.py#L644-L753 |
10,503 | astropy/photutils | photutils/extern/sigma_clipping.py | SigmaClip._sigmaclip_noaxis | def _sigmaclip_noaxis(self, data, masked=True, return_bounds=False,
copy=True):
"""
Sigma clip the data when ``axis`` is None.
In this simple case, we remove clipped elements from the
flattened array during each iteration.
"""
filtered_data = d... | python | def _sigmaclip_noaxis(self, data, masked=True, return_bounds=False,
copy=True):
"""
Sigma clip the data when ``axis`` is None.
In this simple case, we remove clipped elements from the
flattened array during each iteration.
"""
filtered_data = d... | [
"def",
"_sigmaclip_noaxis",
"(",
"self",
",",
"data",
",",
"masked",
"=",
"True",
",",
"return_bounds",
"=",
"False",
",",
"copy",
"=",
"True",
")",
":",
"filtered_data",
"=",
"data",
".",
"ravel",
"(",
")",
"# remove masked values and convert to ndarray",
"if... | Sigma clip the data when ``axis`` is None.
In this simple case, we remove clipped elements from the
flattened array during each iteration. | [
"Sigma",
"clip",
"the",
"data",
"when",
"axis",
"is",
"None",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/extern/sigma_clipping.py#L265-L313 |
10,504 | astropy/photutils | photutils/extern/sigma_clipping.py | SigmaClip._sigmaclip_withaxis | def _sigmaclip_withaxis(self, data, axis=None, masked=True,
return_bounds=False, copy=True):
"""
Sigma clip the data when ``axis`` is specified.
In this case, we replace clipped values with NaNs as placeholder
values.
"""
# float array type i... | python | def _sigmaclip_withaxis(self, data, axis=None, masked=True,
return_bounds=False, copy=True):
"""
Sigma clip the data when ``axis`` is specified.
In this case, we replace clipped values with NaNs as placeholder
values.
"""
# float array type i... | [
"def",
"_sigmaclip_withaxis",
"(",
"self",
",",
"data",
",",
"axis",
"=",
"None",
",",
"masked",
"=",
"True",
",",
"return_bounds",
"=",
"False",
",",
"copy",
"=",
"True",
")",
":",
"# float array type is needed to insert nans into the array",
"filtered_data",
"="... | Sigma clip the data when ``axis`` is specified.
In this case, we replace clipped values with NaNs as placeholder
values. | [
"Sigma",
"clip",
"the",
"data",
"when",
"axis",
"is",
"specified",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/extern/sigma_clipping.py#L315-L385 |
10,505 | astropy/photutils | photutils/aperture/core.py | PixelAperture.do_photometry | def do_photometry(self, data, error=None, mask=None, method='exact',
subpixels=5, unit=None):
"""
Perform aperture photometry on the input data.
Parameters
----------
data : array_like or `~astropy.units.Quantity` instance
The 2D array on which ... | python | def do_photometry(self, data, error=None, mask=None, method='exact',
subpixels=5, unit=None):
"""
Perform aperture photometry on the input data.
Parameters
----------
data : array_like or `~astropy.units.Quantity` instance
The 2D array on which ... | [
"def",
"do_photometry",
"(",
"self",
",",
"data",
",",
"error",
"=",
"None",
",",
"mask",
"=",
"None",
",",
"method",
"=",
"'exact'",
",",
"subpixels",
"=",
"5",
",",
"unit",
"=",
"None",
")",
":",
"data",
"=",
"np",
".",
"asanyarray",
"(",
"data",... | Perform aperture photometry on the input data.
Parameters
----------
data : array_like or `~astropy.units.Quantity` instance
The 2D array on which to perform photometry. ``data``
should be background subtracted.
error : array_like or `~astropy.units.Quantity`, ... | [
"Perform",
"aperture",
"photometry",
"on",
"the",
"input",
"data",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/aperture/core.py#L301-L410 |
10,506 | astropy/photutils | photutils/aperture/core.py | PixelAperture._to_sky_params | def _to_sky_params(self, wcs, mode='all'):
"""
Convert the pixel aperture parameters to those for a sky
aperture.
Parameters
----------
wcs : `~astropy.wcs.WCS`
The world coordinate system (WCS) transformation to use.
mode : {'all', 'wcs'}, optional
... | python | def _to_sky_params(self, wcs, mode='all'):
"""
Convert the pixel aperture parameters to those for a sky
aperture.
Parameters
----------
wcs : `~astropy.wcs.WCS`
The world coordinate system (WCS) transformation to use.
mode : {'all', 'wcs'}, optional
... | [
"def",
"_to_sky_params",
"(",
"self",
",",
"wcs",
",",
"mode",
"=",
"'all'",
")",
":",
"sky_params",
"=",
"{",
"}",
"x",
",",
"y",
"=",
"np",
".",
"transpose",
"(",
"self",
".",
"positions",
")",
"sky_params",
"[",
"'positions'",
"]",
"=",
"pixel_to_... | Convert the pixel aperture parameters to those for a sky
aperture.
Parameters
----------
wcs : `~astropy.wcs.WCS`
The world coordinate system (WCS) transformation to use.
mode : {'all', 'wcs'}, optional
Whether to do the transformation including distorti... | [
"Convert",
"the",
"pixel",
"aperture",
"parameters",
"to",
"those",
"for",
"a",
"sky",
"aperture",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/aperture/core.py#L526-L568 |
10,507 | astropy/photutils | photutils/aperture/core.py | SkyAperture._to_pixel_params | def _to_pixel_params(self, wcs, mode='all'):
"""
Convert the sky aperture parameters to those for a pixel
aperture.
Parameters
----------
wcs : `~astropy.wcs.WCS`
The world coordinate system (WCS) transformation to use.
mode : {'all', 'wcs'}, optiona... | python | def _to_pixel_params(self, wcs, mode='all'):
"""
Convert the sky aperture parameters to those for a pixel
aperture.
Parameters
----------
wcs : `~astropy.wcs.WCS`
The world coordinate system (WCS) transformation to use.
mode : {'all', 'wcs'}, optiona... | [
"def",
"_to_pixel_params",
"(",
"self",
",",
"wcs",
",",
"mode",
"=",
"'all'",
")",
":",
"pixel_params",
"=",
"{",
"}",
"x",
",",
"y",
"=",
"skycoord_to_pixel",
"(",
"self",
".",
"positions",
",",
"wcs",
",",
"mode",
"=",
"mode",
")",
"pixel_params",
... | Convert the sky aperture parameters to those for a pixel
aperture.
Parameters
----------
wcs : `~astropy.wcs.WCS`
The world coordinate system (WCS) transformation to use.
mode : {'all', 'wcs'}, optional
Whether to do the transformation including distorti... | [
"Convert",
"the",
"sky",
"aperture",
"parameters",
"to",
"those",
"for",
"a",
"pixel",
"aperture",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/aperture/core.py#L601-L647 |
10,508 | astropy/photutils | photutils/segmentation/properties.py | source_properties | def source_properties(data, segment_img, error=None, mask=None,
background=None, filter_kernel=None, wcs=None,
labels=None):
"""
Calculate photometry and morphological properties of sources defined
by a labeled segmentation image.
Parameters
----------
... | python | def source_properties(data, segment_img, error=None, mask=None,
background=None, filter_kernel=None, wcs=None,
labels=None):
"""
Calculate photometry and morphological properties of sources defined
by a labeled segmentation image.
Parameters
----------
... | [
"def",
"source_properties",
"(",
"data",
",",
"segment_img",
",",
"error",
"=",
"None",
",",
"mask",
"=",
"None",
",",
"background",
"=",
"None",
",",
"filter_kernel",
"=",
"None",
",",
"wcs",
"=",
"None",
",",
"labels",
"=",
"None",
")",
":",
"if",
... | Calculate photometry and morphological properties of sources defined
by a labeled segmentation image.
Parameters
----------
data : array_like or `~astropy.units.Quantity`
The 2D array from which to calculate the source photometry and
properties. ``data`` should be background-subtracted... | [
"Calculate",
"photometry",
"and",
"morphological",
"properties",
"of",
"sources",
"defined",
"by",
"a",
"labeled",
"segmentation",
"image",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L1223-L1412 |
10,509 | astropy/photutils | photutils/segmentation/properties.py | _properties_table | def _properties_table(obj, columns=None, exclude_columns=None):
"""
Construct a `~astropy.table.QTable` of source properties from a
`SourceProperties` or `SourceCatalog` object.
Parameters
----------
obj : `SourceProperties` or `SourceCatalog` instance
The object containing the source p... | python | def _properties_table(obj, columns=None, exclude_columns=None):
"""
Construct a `~astropy.table.QTable` of source properties from a
`SourceProperties` or `SourceCatalog` object.
Parameters
----------
obj : `SourceProperties` or `SourceCatalog` instance
The object containing the source p... | [
"def",
"_properties_table",
"(",
"obj",
",",
"columns",
"=",
"None",
",",
"exclude_columns",
"=",
"None",
")",
":",
"# default properties",
"columns_all",
"=",
"[",
"'id'",
",",
"'xcentroid'",
",",
"'ycentroid'",
",",
"'sky_centroid'",
",",
"'sky_centroid_icrs'",
... | Construct a `~astropy.table.QTable` of source properties from a
`SourceProperties` or `SourceCatalog` object.
Parameters
----------
obj : `SourceProperties` or `SourceCatalog` instance
The object containing the source properties.
columns : str or list of str, optional
Names of colu... | [
"Construct",
"a",
"~astropy",
".",
"table",
".",
"QTable",
"of",
"source",
"properties",
"from",
"a",
"SourceProperties",
"or",
"SourceCatalog",
"object",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L1609-L1673 |
10,510 | astropy/photutils | photutils/segmentation/properties.py | SourceProperties._total_mask | def _total_mask(self):
"""
Combination of the _segment_mask, _input_mask, and _data_mask.
This mask is applied to ``data``, ``error``, and ``background``
inputs when calculating properties.
"""
mask = self._segment_mask | self._data_mask
if self._input_mask is ... | python | def _total_mask(self):
"""
Combination of the _segment_mask, _input_mask, and _data_mask.
This mask is applied to ``data``, ``error``, and ``background``
inputs when calculating properties.
"""
mask = self._segment_mask | self._data_mask
if self._input_mask is ... | [
"def",
"_total_mask",
"(",
"self",
")",
":",
"mask",
"=",
"self",
".",
"_segment_mask",
"|",
"self",
".",
"_data_mask",
"if",
"self",
".",
"_input_mask",
"is",
"not",
"None",
":",
"mask",
"|=",
"self",
".",
"_input_mask",
"return",
"mask"
] | Combination of the _segment_mask, _input_mask, and _data_mask.
This mask is applied to ``data``, ``error``, and ``background``
inputs when calculating properties. | [
"Combination",
"of",
"the",
"_segment_mask",
"_input_mask",
"and",
"_data_mask",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L228-L241 |
10,511 | astropy/photutils | photutils/segmentation/properties.py | SourceProperties.to_table | def to_table(self, columns=None, exclude_columns=None):
"""
Create a `~astropy.table.QTable` of properties.
If ``columns`` or ``exclude_columns`` are not input, then the
`~astropy.table.QTable` will include a default list of
scalar-valued properties.
Parameters
... | python | def to_table(self, columns=None, exclude_columns=None):
"""
Create a `~astropy.table.QTable` of properties.
If ``columns`` or ``exclude_columns`` are not input, then the
`~astropy.table.QTable` will include a default list of
scalar-valued properties.
Parameters
... | [
"def",
"to_table",
"(",
"self",
",",
"columns",
"=",
"None",
",",
"exclude_columns",
"=",
"None",
")",
":",
"return",
"_properties_table",
"(",
"self",
",",
"columns",
"=",
"columns",
",",
"exclude_columns",
"=",
"exclude_columns",
")"
] | Create a `~astropy.table.QTable` of properties.
If ``columns`` or ``exclude_columns`` are not input, then the
`~astropy.table.QTable` will include a default list of
scalar-valued properties.
Parameters
----------
columns : str or list of str, optional
Names ... | [
"Create",
"a",
"~astropy",
".",
"table",
".",
"QTable",
"of",
"properties",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L330-L356 |
10,512 | astropy/photutils | photutils/segmentation/properties.py | SourceProperties.data_cutout_ma | def data_cutout_ma(self):
"""
A 2D `~numpy.ma.MaskedArray` cutout from the data.
The mask is `True` for pixels outside of the source segment
(labeled region of interest), masked pixels from the ``mask``
input, or any non-finite ``data`` values (e.g. NaN or inf).
"""
... | python | def data_cutout_ma(self):
"""
A 2D `~numpy.ma.MaskedArray` cutout from the data.
The mask is `True` for pixels outside of the source segment
(labeled region of interest), masked pixels from the ``mask``
input, or any non-finite ``data`` values (e.g. NaN or inf).
"""
... | [
"def",
"data_cutout_ma",
"(",
"self",
")",
":",
"return",
"np",
".",
"ma",
".",
"masked_array",
"(",
"self",
".",
"_data",
"[",
"self",
".",
"_slice",
"]",
",",
"mask",
"=",
"self",
".",
"_total_mask",
")"
] | A 2D `~numpy.ma.MaskedArray` cutout from the data.
The mask is `True` for pixels outside of the source segment
(labeled region of interest), masked pixels from the ``mask``
input, or any non-finite ``data`` values (e.g. NaN or inf). | [
"A",
"2D",
"~numpy",
".",
"ma",
".",
"MaskedArray",
"cutout",
"from",
"the",
"data",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L368-L378 |
10,513 | astropy/photutils | photutils/segmentation/properties.py | SourceProperties.error_cutout_ma | def error_cutout_ma(self):
"""
A 2D `~numpy.ma.MaskedArray` cutout from the input ``error``
image.
The mask is `True` for pixels outside of the source segment
(labeled region of interest), masked pixels from the ``mask``
input, or any non-finite ``data`` values (e.g. NaN... | python | def error_cutout_ma(self):
"""
A 2D `~numpy.ma.MaskedArray` cutout from the input ``error``
image.
The mask is `True` for pixels outside of the source segment
(labeled region of interest), masked pixels from the ``mask``
input, or any non-finite ``data`` values (e.g. NaN... | [
"def",
"error_cutout_ma",
"(",
"self",
")",
":",
"if",
"self",
".",
"_error",
"is",
"None",
":",
"return",
"None",
"else",
":",
"return",
"np",
".",
"ma",
".",
"masked_array",
"(",
"self",
".",
"_error",
"[",
"self",
".",
"_slice",
"]",
",",
"mask",
... | A 2D `~numpy.ma.MaskedArray` cutout from the input ``error``
image.
The mask is `True` for pixels outside of the source segment
(labeled region of interest), masked pixels from the ``mask``
input, or any non-finite ``data`` values (e.g. NaN or inf).
If ``error`` is `None`, then... | [
"A",
"2D",
"~numpy",
".",
"ma",
".",
"MaskedArray",
"cutout",
"from",
"the",
"input",
"error",
"image",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L381-L397 |
10,514 | astropy/photutils | photutils/segmentation/properties.py | SourceProperties.background_cutout_ma | def background_cutout_ma(self):
"""
A 2D `~numpy.ma.MaskedArray` cutout from the input
``background``.
The mask is `True` for pixels outside of the source segment
(labeled region of interest), masked pixels from the ``mask``
input, or any non-finite ``data`` values (e.g.... | python | def background_cutout_ma(self):
"""
A 2D `~numpy.ma.MaskedArray` cutout from the input
``background``.
The mask is `True` for pixels outside of the source segment
(labeled region of interest), masked pixels from the ``mask``
input, or any non-finite ``data`` values (e.g.... | [
"def",
"background_cutout_ma",
"(",
"self",
")",
":",
"if",
"self",
".",
"_background",
"is",
"None",
":",
"return",
"None",
"else",
":",
"return",
"np",
".",
"ma",
".",
"masked_array",
"(",
"self",
".",
"_background",
"[",
"self",
".",
"_slice",
"]",
... | A 2D `~numpy.ma.MaskedArray` cutout from the input
``background``.
The mask is `True` for pixels outside of the source segment
(labeled region of interest), masked pixels from the ``mask``
input, or any non-finite ``data`` values (e.g. NaN or inf).
If ``background`` is `None`, ... | [
"A",
"2D",
"~numpy",
".",
"ma",
".",
"MaskedArray",
"cutout",
"from",
"the",
"input",
"background",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L400-L417 |
10,515 | astropy/photutils | photutils/segmentation/properties.py | SourceProperties.coords | def coords(self):
"""
A tuple of two `~numpy.ndarray` containing the ``y`` and ``x``
pixel coordinates of unmasked pixels within the source segment.
Non-finite pixel values (e.g. NaN, infs) are excluded
(automatically masked).
If all pixels are masked, ``coords`` will b... | python | def coords(self):
"""
A tuple of two `~numpy.ndarray` containing the ``y`` and ``x``
pixel coordinates of unmasked pixels within the source segment.
Non-finite pixel values (e.g. NaN, infs) are excluded
(automatically masked).
If all pixels are masked, ``coords`` will b... | [
"def",
"coords",
"(",
"self",
")",
":",
"yy",
",",
"xx",
"=",
"np",
".",
"nonzero",
"(",
"self",
".",
"data_cutout_ma",
")",
"return",
"(",
"yy",
"+",
"self",
".",
"_slice",
"[",
"0",
"]",
".",
"start",
",",
"xx",
"+",
"self",
".",
"_slice",
"[... | A tuple of two `~numpy.ndarray` containing the ``y`` and ``x``
pixel coordinates of unmasked pixels within the source segment.
Non-finite pixel values (e.g. NaN, infs) are excluded
(automatically masked).
If all pixels are masked, ``coords`` will be a tuple of
two empty arrays. | [
"A",
"tuple",
"of",
"two",
"~numpy",
".",
"ndarray",
"containing",
"the",
"y",
"and",
"x",
"pixel",
"coordinates",
"of",
"unmasked",
"pixels",
"within",
"the",
"source",
"segment",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L442-L455 |
10,516 | astropy/photutils | photutils/segmentation/properties.py | SourceProperties.sky_centroid | def sky_centroid(self):
"""
The sky coordinates of the centroid within the source segment,
returned as a `~astropy.coordinates.SkyCoord` object.
The output coordinate frame is the same as the input WCS.
"""
if self._wcs is not None:
return pixel_to_skycoord(... | python | def sky_centroid(self):
"""
The sky coordinates of the centroid within the source segment,
returned as a `~astropy.coordinates.SkyCoord` object.
The output coordinate frame is the same as the input WCS.
"""
if self._wcs is not None:
return pixel_to_skycoord(... | [
"def",
"sky_centroid",
"(",
"self",
")",
":",
"if",
"self",
".",
"_wcs",
"is",
"not",
"None",
":",
"return",
"pixel_to_skycoord",
"(",
"self",
".",
"xcentroid",
".",
"value",
",",
"self",
".",
"ycentroid",
".",
"value",
",",
"self",
".",
"_wcs",
",",
... | The sky coordinates of the centroid within the source segment,
returned as a `~astropy.coordinates.SkyCoord` object.
The output coordinate frame is the same as the input WCS. | [
"The",
"sky",
"coordinates",
"of",
"the",
"centroid",
"within",
"the",
"source",
"segment",
"returned",
"as",
"a",
"~astropy",
".",
"coordinates",
".",
"SkyCoord",
"object",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L526-L539 |
10,517 | astropy/photutils | photutils/segmentation/properties.py | SourceProperties.sky_bbox_ll | def sky_bbox_ll(self):
"""
The sky coordinates of the lower-left vertex of the minimal
bounding box of the source segment, returned as a
`~astropy.coordinates.SkyCoord` object.
The bounding box encloses all of the source segment pixels in
their entirety, thus the vertice... | python | def sky_bbox_ll(self):
"""
The sky coordinates of the lower-left vertex of the minimal
bounding box of the source segment, returned as a
`~astropy.coordinates.SkyCoord` object.
The bounding box encloses all of the source segment pixels in
their entirety, thus the vertice... | [
"def",
"sky_bbox_ll",
"(",
"self",
")",
":",
"if",
"self",
".",
"_wcs",
"is",
"not",
"None",
":",
"return",
"pixel_to_skycoord",
"(",
"self",
".",
"xmin",
".",
"value",
"-",
"0.5",
",",
"self",
".",
"ymin",
".",
"value",
"-",
"0.5",
",",
"self",
".... | The sky coordinates of the lower-left vertex of the minimal
bounding box of the source segment, returned as a
`~astropy.coordinates.SkyCoord` object.
The bounding box encloses all of the source segment pixels in
their entirety, thus the vertices are at the pixel *corners*. | [
"The",
"sky",
"coordinates",
"of",
"the",
"lower",
"-",
"left",
"vertex",
"of",
"the",
"minimal",
"bounding",
"box",
"of",
"the",
"source",
"segment",
"returned",
"as",
"a",
"~astropy",
".",
"coordinates",
".",
"SkyCoord",
"object",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L602-L617 |
10,518 | astropy/photutils | photutils/segmentation/properties.py | SourceProperties.sky_bbox_ul | def sky_bbox_ul(self):
"""
The sky coordinates of the upper-left vertex of the minimal
bounding box of the source segment, returned as a
`~astropy.coordinates.SkyCoord` object.
The bounding box encloses all of the source segment pixels in
their entirety, thus the vertice... | python | def sky_bbox_ul(self):
"""
The sky coordinates of the upper-left vertex of the minimal
bounding box of the source segment, returned as a
`~astropy.coordinates.SkyCoord` object.
The bounding box encloses all of the source segment pixels in
their entirety, thus the vertice... | [
"def",
"sky_bbox_ul",
"(",
"self",
")",
":",
"if",
"self",
".",
"_wcs",
"is",
"not",
"None",
":",
"return",
"pixel_to_skycoord",
"(",
"self",
".",
"xmin",
".",
"value",
"-",
"0.5",
",",
"self",
".",
"ymax",
".",
"value",
"+",
"0.5",
",",
"self",
".... | The sky coordinates of the upper-left vertex of the minimal
bounding box of the source segment, returned as a
`~astropy.coordinates.SkyCoord` object.
The bounding box encloses all of the source segment pixels in
their entirety, thus the vertices are at the pixel *corners*. | [
"The",
"sky",
"coordinates",
"of",
"the",
"upper",
"-",
"left",
"vertex",
"of",
"the",
"minimal",
"bounding",
"box",
"of",
"the",
"source",
"segment",
"returned",
"as",
"a",
"~astropy",
".",
"coordinates",
".",
"SkyCoord",
"object",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L620-L635 |
10,519 | astropy/photutils | photutils/segmentation/properties.py | SourceProperties.sky_bbox_lr | def sky_bbox_lr(self):
"""
The sky coordinates of the lower-right vertex of the minimal
bounding box of the source segment, returned as a
`~astropy.coordinates.SkyCoord` object.
The bounding box encloses all of the source segment pixels in
their entirety, thus the vertic... | python | def sky_bbox_lr(self):
"""
The sky coordinates of the lower-right vertex of the minimal
bounding box of the source segment, returned as a
`~astropy.coordinates.SkyCoord` object.
The bounding box encloses all of the source segment pixels in
their entirety, thus the vertic... | [
"def",
"sky_bbox_lr",
"(",
"self",
")",
":",
"if",
"self",
".",
"_wcs",
"is",
"not",
"None",
":",
"return",
"pixel_to_skycoord",
"(",
"self",
".",
"xmax",
".",
"value",
"+",
"0.5",
",",
"self",
".",
"ymin",
".",
"value",
"-",
"0.5",
",",
"self",
".... | The sky coordinates of the lower-right vertex of the minimal
bounding box of the source segment, returned as a
`~astropy.coordinates.SkyCoord` object.
The bounding box encloses all of the source segment pixels in
their entirety, thus the vertices are at the pixel *corners*. | [
"The",
"sky",
"coordinates",
"of",
"the",
"lower",
"-",
"right",
"vertex",
"of",
"the",
"minimal",
"bounding",
"box",
"of",
"the",
"source",
"segment",
"returned",
"as",
"a",
"~astropy",
".",
"coordinates",
".",
"SkyCoord",
"object",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L638-L653 |
10,520 | astropy/photutils | photutils/segmentation/properties.py | SourceProperties.sky_bbox_ur | def sky_bbox_ur(self):
"""
The sky coordinates of the upper-right vertex of the minimal
bounding box of the source segment, returned as a
`~astropy.coordinates.SkyCoord` object.
The bounding box encloses all of the source segment pixels in
their entirety, thus the vertic... | python | def sky_bbox_ur(self):
"""
The sky coordinates of the upper-right vertex of the minimal
bounding box of the source segment, returned as a
`~astropy.coordinates.SkyCoord` object.
The bounding box encloses all of the source segment pixels in
their entirety, thus the vertic... | [
"def",
"sky_bbox_ur",
"(",
"self",
")",
":",
"if",
"self",
".",
"_wcs",
"is",
"not",
"None",
":",
"return",
"pixel_to_skycoord",
"(",
"self",
".",
"xmax",
".",
"value",
"+",
"0.5",
",",
"self",
".",
"ymax",
".",
"value",
"+",
"0.5",
",",
"self",
".... | The sky coordinates of the upper-right vertex of the minimal
bounding box of the source segment, returned as a
`~astropy.coordinates.SkyCoord` object.
The bounding box encloses all of the source segment pixels in
their entirety, thus the vertices are at the pixel *corners*. | [
"The",
"sky",
"coordinates",
"of",
"the",
"upper",
"-",
"right",
"vertex",
"of",
"the",
"minimal",
"bounding",
"box",
"of",
"the",
"source",
"segment",
"returned",
"as",
"a",
"~astropy",
".",
"coordinates",
".",
"SkyCoord",
"object",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L656-L671 |
10,521 | astropy/photutils | photutils/segmentation/properties.py | SourceProperties.min_value | def min_value(self):
"""
The minimum pixel value of the ``data`` within the source
segment.
"""
if self._is_completely_masked:
return np.nan * self._data_unit
else:
return np.min(self.values) | python | def min_value(self):
"""
The minimum pixel value of the ``data`` within the source
segment.
"""
if self._is_completely_masked:
return np.nan * self._data_unit
else:
return np.min(self.values) | [
"def",
"min_value",
"(",
"self",
")",
":",
"if",
"self",
".",
"_is_completely_masked",
":",
"return",
"np",
".",
"nan",
"*",
"self",
".",
"_data_unit",
"else",
":",
"return",
"np",
".",
"min",
"(",
"self",
".",
"values",
")"
] | The minimum pixel value of the ``data`` within the source
segment. | [
"The",
"minimum",
"pixel",
"value",
"of",
"the",
"data",
"within",
"the",
"source",
"segment",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L674-L683 |
10,522 | astropy/photutils | photutils/segmentation/properties.py | SourceProperties.max_value | def max_value(self):
"""
The maximum pixel value of the ``data`` within the source
segment.
"""
if self._is_completely_masked:
return np.nan * self._data_unit
else:
return np.max(self.values) | python | def max_value(self):
"""
The maximum pixel value of the ``data`` within the source
segment.
"""
if self._is_completely_masked:
return np.nan * self._data_unit
else:
return np.max(self.values) | [
"def",
"max_value",
"(",
"self",
")",
":",
"if",
"self",
".",
"_is_completely_masked",
":",
"return",
"np",
".",
"nan",
"*",
"self",
".",
"_data_unit",
"else",
":",
"return",
"np",
".",
"max",
"(",
"self",
".",
"values",
")"
] | The maximum pixel value of the ``data`` within the source
segment. | [
"The",
"maximum",
"pixel",
"value",
"of",
"the",
"data",
"within",
"the",
"source",
"segment",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L686-L695 |
10,523 | astropy/photutils | photutils/segmentation/properties.py | SourceProperties.source_sum | def source_sum(self):
"""
The sum of the unmasked ``data`` values within the source segment.
.. math:: F = \\sum_{i \\in S} (I_i - B_i)
where :math:`F` is ``source_sum``, :math:`(I_i - B_i)` is the
``data``, and :math:`S` are the unmasked pixels in the source
segment.
... | python | def source_sum(self):
"""
The sum of the unmasked ``data`` values within the source segment.
.. math:: F = \\sum_{i \\in S} (I_i - B_i)
where :math:`F` is ``source_sum``, :math:`(I_i - B_i)` is the
``data``, and :math:`S` are the unmasked pixels in the source
segment.
... | [
"def",
"source_sum",
"(",
"self",
")",
":",
"if",
"self",
".",
"_is_completely_masked",
":",
"return",
"np",
".",
"nan",
"*",
"self",
".",
"_data_unit",
"# table output needs unit",
"else",
":",
"return",
"np",
".",
"sum",
"(",
"self",
".",
"values",
")"
] | The sum of the unmasked ``data`` values within the source segment.
.. math:: F = \\sum_{i \\in S} (I_i - B_i)
where :math:`F` is ``source_sum``, :math:`(I_i - B_i)` is the
``data``, and :math:`S` are the unmasked pixels in the source
segment.
Non-finite pixel values (e.g. NaN,... | [
"The",
"sum",
"of",
"the",
"unmasked",
"data",
"values",
"within",
"the",
"source",
"segment",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L818-L835 |
10,524 | astropy/photutils | photutils/segmentation/properties.py | SourceProperties.source_sum_err | def source_sum_err(self):
"""
The uncertainty of `~photutils.SourceProperties.source_sum`,
propagated from the input ``error`` array.
``source_sum_err`` is the quadrature sum of the total errors
over the non-masked pixels within the source segment:
.. math:: \\Delta F =... | python | def source_sum_err(self):
"""
The uncertainty of `~photutils.SourceProperties.source_sum`,
propagated from the input ``error`` array.
``source_sum_err`` is the quadrature sum of the total errors
over the non-masked pixels within the source segment:
.. math:: \\Delta F =... | [
"def",
"source_sum_err",
"(",
"self",
")",
":",
"if",
"self",
".",
"_error",
"is",
"not",
"None",
":",
"if",
"self",
".",
"_is_completely_masked",
":",
"return",
"np",
".",
"nan",
"*",
"self",
".",
"_error_unit",
"# table output needs unit",
"else",
":",
"... | The uncertainty of `~photutils.SourceProperties.source_sum`,
propagated from the input ``error`` array.
``source_sum_err`` is the quadrature sum of the total errors
over the non-masked pixels within the source segment:
.. math:: \\Delta F = \\sqrt{\\sum_{i \\in S}
\\s... | [
"The",
"uncertainty",
"of",
"~photutils",
".",
"SourceProperties",
".",
"source_sum",
"propagated",
"from",
"the",
"input",
"error",
"array",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L838-L865 |
10,525 | astropy/photutils | photutils/segmentation/properties.py | SourceProperties.background_sum | def background_sum(self):
"""
The sum of ``background`` values within the source segment.
Pixel values that are masked in the input ``data``, including
any non-finite pixel values (i.e. NaN, infs) that are
automatically masked, are also masked in the background array.
""... | python | def background_sum(self):
"""
The sum of ``background`` values within the source segment.
Pixel values that are masked in the input ``data``, including
any non-finite pixel values (i.e. NaN, infs) that are
automatically masked, are also masked in the background array.
""... | [
"def",
"background_sum",
"(",
"self",
")",
":",
"if",
"self",
".",
"_background",
"is",
"not",
"None",
":",
"if",
"self",
".",
"_is_completely_masked",
":",
"return",
"np",
".",
"nan",
"*",
"self",
".",
"_background_unit",
"# unit for table",
"else",
":",
... | The sum of ``background`` values within the source segment.
Pixel values that are masked in the input ``data``, including
any non-finite pixel values (i.e. NaN, infs) that are
automatically masked, are also masked in the background array. | [
"The",
"sum",
"of",
"background",
"values",
"within",
"the",
"source",
"segment",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L868-L883 |
10,526 | astropy/photutils | photutils/segmentation/properties.py | SourceProperties.background_mean | def background_mean(self):
"""
The mean of ``background`` values within the source segment.
Pixel values that are masked in the input ``data``, including
any non-finite pixel values (i.e. NaN, infs) that are
automatically masked, are also masked in the background array.
... | python | def background_mean(self):
"""
The mean of ``background`` values within the source segment.
Pixel values that are masked in the input ``data``, including
any non-finite pixel values (i.e. NaN, infs) that are
automatically masked, are also masked in the background array.
... | [
"def",
"background_mean",
"(",
"self",
")",
":",
"if",
"self",
".",
"_background",
"is",
"not",
"None",
":",
"if",
"self",
".",
"_is_completely_masked",
":",
"return",
"np",
".",
"nan",
"*",
"self",
".",
"_background_unit",
"# unit for table",
"else",
":",
... | The mean of ``background`` values within the source segment.
Pixel values that are masked in the input ``data``, including
any non-finite pixel values (i.e. NaN, infs) that are
automatically masked, are also masked in the background array. | [
"The",
"mean",
"of",
"background",
"values",
"within",
"the",
"source",
"segment",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L886-L901 |
10,527 | astropy/photutils | photutils/segmentation/properties.py | SourceProperties.background_at_centroid | def background_at_centroid(self):
"""
The value of the ``background`` at the position of the source
centroid.
The background value at fractional position values are
determined using bilinear interpolation.
"""
from scipy.ndimage import map_coordinates
i... | python | def background_at_centroid(self):
"""
The value of the ``background`` at the position of the source
centroid.
The background value at fractional position values are
determined using bilinear interpolation.
"""
from scipy.ndimage import map_coordinates
i... | [
"def",
"background_at_centroid",
"(",
"self",
")",
":",
"from",
"scipy",
".",
"ndimage",
"import",
"map_coordinates",
"if",
"self",
".",
"_background",
"is",
"not",
"None",
":",
"# centroid can still be NaN if all data values are <= 0",
"if",
"(",
"self",
".",
"_is_... | The value of the ``background`` at the position of the source
centroid.
The background value at fractional position values are
determined using bilinear interpolation. | [
"The",
"value",
"of",
"the",
"background",
"at",
"the",
"position",
"of",
"the",
"source",
"centroid",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L904-L928 |
10,528 | astropy/photutils | photutils/segmentation/properties.py | SourceProperties.perimeter | def perimeter(self):
"""
The total perimeter of the source segment, approximated lines
through the centers of the border pixels using a 4-connectivity.
If any masked pixels make holes within the source segment, then
the perimeter around the inner hole (e.g. an annulus) will also... | python | def perimeter(self):
"""
The total perimeter of the source segment, approximated lines
through the centers of the border pixels using a 4-connectivity.
If any masked pixels make holes within the source segment, then
the perimeter around the inner hole (e.g. an annulus) will also... | [
"def",
"perimeter",
"(",
"self",
")",
":",
"if",
"self",
".",
"_is_completely_masked",
":",
"return",
"np",
".",
"nan",
"*",
"u",
".",
"pix",
"# unit for table",
"else",
":",
"from",
"skimage",
".",
"measure",
"import",
"perimeter",
"return",
"perimeter",
... | The total perimeter of the source segment, approximated lines
through the centers of the border pixels using a 4-connectivity.
If any masked pixels make holes within the source segment, then
the perimeter around the inner hole (e.g. an annulus) will also
contribute to the total perimete... | [
"The",
"total",
"perimeter",
"of",
"the",
"source",
"segment",
"approximated",
"lines",
"through",
"the",
"centers",
"of",
"the",
"border",
"pixels",
"using",
"a",
"4",
"-",
"connectivity",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L957-L971 |
10,529 | astropy/photutils | photutils/segmentation/properties.py | SourceProperties.inertia_tensor | def inertia_tensor(self):
"""
The inertia tensor of the source for the rotation around its
center of mass.
"""
mu = self.moments_central
a = mu[0, 2]
b = -mu[1, 1]
c = mu[2, 0]
return np.array([[a, b], [b, c]]) * u.pix**2 | python | def inertia_tensor(self):
"""
The inertia tensor of the source for the rotation around its
center of mass.
"""
mu = self.moments_central
a = mu[0, 2]
b = -mu[1, 1]
c = mu[2, 0]
return np.array([[a, b], [b, c]]) * u.pix**2 | [
"def",
"inertia_tensor",
"(",
"self",
")",
":",
"mu",
"=",
"self",
".",
"moments_central",
"a",
"=",
"mu",
"[",
"0",
",",
"2",
"]",
"b",
"=",
"-",
"mu",
"[",
"1",
",",
"1",
"]",
"c",
"=",
"mu",
"[",
"2",
",",
"0",
"]",
"return",
"np",
".",
... | The inertia tensor of the source for the rotation around its
center of mass. | [
"The",
"inertia",
"tensor",
"of",
"the",
"source",
"for",
"the",
"rotation",
"around",
"its",
"center",
"of",
"mass",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L974-L984 |
10,530 | astropy/photutils | photutils/segmentation/properties.py | SourceProperties.covariance | def covariance(self):
"""
The covariance matrix of the 2D Gaussian function that has the
same second-order moments as the source.
"""
mu = self.moments_central
if mu[0, 0] != 0:
m = mu / mu[0, 0]
covariance = self._check_covariance(
... | python | def covariance(self):
"""
The covariance matrix of the 2D Gaussian function that has the
same second-order moments as the source.
"""
mu = self.moments_central
if mu[0, 0] != 0:
m = mu / mu[0, 0]
covariance = self._check_covariance(
... | [
"def",
"covariance",
"(",
"self",
")",
":",
"mu",
"=",
"self",
".",
"moments_central",
"if",
"mu",
"[",
"0",
",",
"0",
"]",
"!=",
"0",
":",
"m",
"=",
"mu",
"/",
"mu",
"[",
"0",
",",
"0",
"]",
"covariance",
"=",
"self",
".",
"_check_covariance",
... | The covariance matrix of the 2D Gaussian function that has the
same second-order moments as the source. | [
"The",
"covariance",
"matrix",
"of",
"the",
"2D",
"Gaussian",
"function",
"that",
"has",
"the",
"same",
"second",
"-",
"order",
"moments",
"as",
"the",
"source",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L987-L1000 |
10,531 | astropy/photutils | photutils/segmentation/properties.py | SourceProperties.covariance_eigvals | def covariance_eigvals(self):
"""
The two eigenvalues of the `covariance` matrix in decreasing
order.
"""
if not np.isnan(np.sum(self.covariance)):
eigvals = np.linalg.eigvals(self.covariance)
if np.any(eigvals < 0): # negative variance
... | python | def covariance_eigvals(self):
"""
The two eigenvalues of the `covariance` matrix in decreasing
order.
"""
if not np.isnan(np.sum(self.covariance)):
eigvals = np.linalg.eigvals(self.covariance)
if np.any(eigvals < 0): # negative variance
... | [
"def",
"covariance_eigvals",
"(",
"self",
")",
":",
"if",
"not",
"np",
".",
"isnan",
"(",
"np",
".",
"sum",
"(",
"self",
".",
"covariance",
")",
")",
":",
"eigvals",
"=",
"np",
".",
"linalg",
".",
"eigvals",
"(",
"self",
".",
"covariance",
")",
"if... | The two eigenvalues of the `covariance` matrix in decreasing
order. | [
"The",
"two",
"eigenvalues",
"of",
"the",
"covariance",
"matrix",
"in",
"decreasing",
"order",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L1024-L1036 |
10,532 | astropy/photutils | photutils/segmentation/properties.py | SourceProperties.eccentricity | def eccentricity(self):
"""
The eccentricity of the 2D Gaussian function that has the same
second-order moments as the source.
The eccentricity is the fraction of the distance along the
semimajor axis at which the focus lies.
.. math:: e = \\sqrt{1 - \\frac{b^2}{a^2}}
... | python | def eccentricity(self):
"""
The eccentricity of the 2D Gaussian function that has the same
second-order moments as the source.
The eccentricity is the fraction of the distance along the
semimajor axis at which the focus lies.
.. math:: e = \\sqrt{1 - \\frac{b^2}{a^2}}
... | [
"def",
"eccentricity",
"(",
"self",
")",
":",
"l1",
",",
"l2",
"=",
"self",
".",
"covariance_eigvals",
"if",
"l1",
"==",
"0",
":",
"return",
"0.",
"# pragma: no cover",
"return",
"np",
".",
"sqrt",
"(",
"1.",
"-",
"(",
"l2",
"/",
"l1",
")",
")"
] | The eccentricity of the 2D Gaussian function that has the same
second-order moments as the source.
The eccentricity is the fraction of the distance along the
semimajor axis at which the focus lies.
.. math:: e = \\sqrt{1 - \\frac{b^2}{a^2}}
where :math:`a` and :math:`b` are th... | [
"The",
"eccentricity",
"of",
"the",
"2D",
"Gaussian",
"function",
"that",
"has",
"the",
"same",
"second",
"-",
"order",
"moments",
"as",
"the",
"source",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L1061-L1078 |
10,533 | astropy/photutils | photutils/segmentation/properties.py | SourceProperties.orientation | def orientation(self):
"""
The angle in radians between the ``x`` axis and the major axis
of the 2D Gaussian function that has the same second-order
moments as the source. The angle increases in the
counter-clockwise direction.
"""
a, b, b, c = self.covariance.f... | python | def orientation(self):
"""
The angle in radians between the ``x`` axis and the major axis
of the 2D Gaussian function that has the same second-order
moments as the source. The angle increases in the
counter-clockwise direction.
"""
a, b, b, c = self.covariance.f... | [
"def",
"orientation",
"(",
"self",
")",
":",
"a",
",",
"b",
",",
"b",
",",
"c",
"=",
"self",
".",
"covariance",
".",
"flat",
"if",
"a",
"<",
"0",
"or",
"c",
"<",
"0",
":",
"# negative variance",
"return",
"np",
".",
"nan",
"*",
"u",
".",
"rad",... | The angle in radians between the ``x`` axis and the major axis
of the 2D Gaussian function that has the same second-order
moments as the source. The angle increases in the
counter-clockwise direction. | [
"The",
"angle",
"in",
"radians",
"between",
"the",
"x",
"axis",
"and",
"the",
"major",
"axis",
"of",
"the",
"2D",
"Gaussian",
"function",
"that",
"has",
"the",
"same",
"second",
"-",
"order",
"moments",
"as",
"the",
"source",
".",
"The",
"angle",
"increa... | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L1081-L1092 |
10,534 | astropy/photutils | photutils/utils/stats.py | _mesh_values | def _mesh_values(data, box_size):
"""
Extract all the data values in boxes of size ``box_size``.
Values from incomplete boxes, either because of the image edges or
masked pixels, are not returned.
Parameters
----------
data : 2D `~numpy.ma.MaskedArray`
The input masked array.
... | python | def _mesh_values(data, box_size):
"""
Extract all the data values in boxes of size ``box_size``.
Values from incomplete boxes, either because of the image edges or
masked pixels, are not returned.
Parameters
----------
data : 2D `~numpy.ma.MaskedArray`
The input masked array.
... | [
"def",
"_mesh_values",
"(",
"data",
",",
"box_size",
")",
":",
"data",
"=",
"np",
".",
"ma",
".",
"asanyarray",
"(",
"data",
")",
"ny",
",",
"nx",
"=",
"data",
".",
"shape",
"nyboxes",
"=",
"ny",
"//",
"box_size",
"nxboxes",
"=",
"nx",
"//",
"box_s... | Extract all the data values in boxes of size ``box_size``.
Values from incomplete boxes, either because of the image edges or
masked pixels, are not returned.
Parameters
----------
data : 2D `~numpy.ma.MaskedArray`
The input masked array.
box_size : int
The box size.
Retu... | [
"Extract",
"all",
"the",
"data",
"values",
"in",
"boxes",
"of",
"size",
"box_size",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/utils/stats.py#L9-L50 |
10,535 | astropy/photutils | photutils/utils/stats.py | std_blocksum | def std_blocksum(data, block_sizes, mask=None):
"""
Calculate the standard deviation of block-summed data values at
sizes of ``block_sizes``.
Values from incomplete blocks, either because of the image edges or
masked pixels, are not included.
Parameters
----------
data : array-like
... | python | def std_blocksum(data, block_sizes, mask=None):
"""
Calculate the standard deviation of block-summed data values at
sizes of ``block_sizes``.
Values from incomplete blocks, either because of the image edges or
masked pixels, are not included.
Parameters
----------
data : array-like
... | [
"def",
"std_blocksum",
"(",
"data",
",",
"block_sizes",
",",
"mask",
"=",
"None",
")",
":",
"data",
"=",
"np",
".",
"ma",
".",
"asanyarray",
"(",
"data",
")",
"if",
"mask",
"is",
"not",
"None",
"and",
"mask",
"is",
"not",
"np",
".",
"ma",
".",
"n... | Calculate the standard deviation of block-summed data values at
sizes of ``block_sizes``.
Values from incomplete blocks, either because of the image edges or
masked pixels, are not included.
Parameters
----------
data : array-like
The 2D array to block sum.
block_sizes : int, arra... | [
"Calculate",
"the",
"standard",
"deviation",
"of",
"block",
"-",
"summed",
"data",
"values",
"at",
"sizes",
"of",
"block_sizes",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/utils/stats.py#L53-L97 |
10,536 | astropy/photutils | photutils/psf/photometry.py | BasicPSFPhotometry.nstar | def nstar(self, image, star_groups):
"""
Fit, as appropriate, a compound or single model to the given
``star_groups``. Groups are fitted sequentially from the
smallest to the biggest. In each iteration, ``image`` is
subtracted by the previous fitted group.
Parameters
... | python | def nstar(self, image, star_groups):
"""
Fit, as appropriate, a compound or single model to the given
``star_groups``. Groups are fitted sequentially from the
smallest to the biggest. In each iteration, ``image`` is
subtracted by the previous fitted group.
Parameters
... | [
"def",
"nstar",
"(",
"self",
",",
"image",
",",
"star_groups",
")",
":",
"result_tab",
"=",
"Table",
"(",
")",
"for",
"param_tab_name",
"in",
"self",
".",
"_pars_to_output",
".",
"keys",
"(",
")",
":",
"result_tab",
".",
"add_column",
"(",
"Column",
"(",... | Fit, as appropriate, a compound or single model to the given
``star_groups``. Groups are fitted sequentially from the
smallest to the biggest. In each iteration, ``image`` is
subtracted by the previous fitted group.
Parameters
----------
image : numpy.ndarray
... | [
"Fit",
"as",
"appropriate",
"a",
"compound",
"or",
"single",
"model",
"to",
"the",
"given",
"star_groups",
".",
"Groups",
"are",
"fitted",
"sequentially",
"from",
"the",
"smallest",
"to",
"the",
"biggest",
".",
"In",
"each",
"iteration",
"image",
"is",
"subt... | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/psf/photometry.py#L298-L375 |
10,537 | astropy/photutils | photutils/psf/photometry.py | BasicPSFPhotometry._get_uncertainties | def _get_uncertainties(self, star_group_size):
"""
Retrieve uncertainties on fitted parameters from the fitter
object.
Parameters
----------
star_group_size : int
Number of stars in the given group.
Returns
-------
unc_tab : `~astropy... | python | def _get_uncertainties(self, star_group_size):
"""
Retrieve uncertainties on fitted parameters from the fitter
object.
Parameters
----------
star_group_size : int
Number of stars in the given group.
Returns
-------
unc_tab : `~astropy... | [
"def",
"_get_uncertainties",
"(",
"self",
",",
"star_group_size",
")",
":",
"unc_tab",
"=",
"Table",
"(",
")",
"for",
"param_name",
"in",
"self",
".",
"psf_model",
".",
"param_names",
":",
"if",
"not",
"self",
".",
"psf_model",
".",
"fixed",
"[",
"param_na... | Retrieve uncertainties on fitted parameters from the fitter
object.
Parameters
----------
star_group_size : int
Number of stars in the given group.
Returns
-------
unc_tab : `~astropy.table.Table`
Table which contains uncertainties on the... | [
"Retrieve",
"uncertainties",
"on",
"fitted",
"parameters",
"from",
"the",
"fitter",
"object",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/psf/photometry.py#L403-L435 |
10,538 | astropy/photutils | photutils/psf/photometry.py | BasicPSFPhotometry._model_params2table | def _model_params2table(self, fit_model, star_group_size):
"""
Place fitted parameters into an astropy table.
Parameters
----------
fit_model : `astropy.modeling.Fittable2DModel` instance
PSF or PRF model to fit the data. Could be one of the models
in thi... | python | def _model_params2table(self, fit_model, star_group_size):
"""
Place fitted parameters into an astropy table.
Parameters
----------
fit_model : `astropy.modeling.Fittable2DModel` instance
PSF or PRF model to fit the data. Could be one of the models
in thi... | [
"def",
"_model_params2table",
"(",
"self",
",",
"fit_model",
",",
"star_group_size",
")",
":",
"param_tab",
"=",
"Table",
"(",
")",
"for",
"param_tab_name",
"in",
"self",
".",
"_pars_to_output",
".",
"keys",
"(",
")",
":",
"param_tab",
".",
"add_column",
"("... | Place fitted parameters into an astropy table.
Parameters
----------
fit_model : `astropy.modeling.Fittable2DModel` instance
PSF or PRF model to fit the data. Could be one of the models
in this package like `~photutils.psf.sandbox.DiscretePRF`,
`~photutils.ps... | [
"Place",
"fitted",
"parameters",
"into",
"an",
"astropy",
"table",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/psf/photometry.py#L437-L473 |
10,539 | astropy/photutils | photutils/psf/photometry.py | IterativelySubtractedPSFPhotometry._do_photometry | def _do_photometry(self, param_tab, n_start=1):
"""
Helper function which performs the iterations of the photometry
process.
Parameters
----------
param_names : list
Names of the columns which represent the initial guesses.
For example, ['x_0', '... | python | def _do_photometry(self, param_tab, n_start=1):
"""
Helper function which performs the iterations of the photometry
process.
Parameters
----------
param_names : list
Names of the columns which represent the initial guesses.
For example, ['x_0', '... | [
"def",
"_do_photometry",
"(",
"self",
",",
"param_tab",
",",
"n_start",
"=",
"1",
")",
":",
"output_table",
"=",
"Table",
"(",
")",
"self",
".",
"_define_fit_param_names",
"(",
")",
"for",
"(",
"init_parname",
",",
"fit_parname",
")",
"in",
"zip",
"(",
"... | Helper function which performs the iterations of the photometry
process.
Parameters
----------
param_names : list
Names of the columns which represent the initial guesses.
For example, ['x_0', 'y_0', 'flux_0'], for intial guesses on
the center positi... | [
"Helper",
"function",
"which",
"performs",
"the",
"iterations",
"of",
"the",
"photometry",
"process",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/psf/photometry.py#L666-L740 |
10,540 | astropy/photutils | photutils/utils/wcs_helpers.py | pixel_scale_angle_at_skycoord | def pixel_scale_angle_at_skycoord(skycoord, wcs, offset=1. * u.arcsec):
"""
Calculate the pixel scale and WCS rotation angle at the position of
a SkyCoord coordinate.
Parameters
----------
skycoord : `~astropy.coordinates.SkyCoord`
The SkyCoord coordinate.
wcs : `~astropy.wcs.WCS`
... | python | def pixel_scale_angle_at_skycoord(skycoord, wcs, offset=1. * u.arcsec):
"""
Calculate the pixel scale and WCS rotation angle at the position of
a SkyCoord coordinate.
Parameters
----------
skycoord : `~astropy.coordinates.SkyCoord`
The SkyCoord coordinate.
wcs : `~astropy.wcs.WCS`
... | [
"def",
"pixel_scale_angle_at_skycoord",
"(",
"skycoord",
",",
"wcs",
",",
"offset",
"=",
"1.",
"*",
"u",
".",
"arcsec",
")",
":",
"# We take a point directly \"above\" (in latitude) the input position",
"# and convert it to pixel coordinates, then we use the pixel deltas",
"# bet... | Calculate the pixel scale and WCS rotation angle at the position of
a SkyCoord coordinate.
Parameters
----------
skycoord : `~astropy.coordinates.SkyCoord`
The SkyCoord coordinate.
wcs : `~astropy.wcs.WCS`
The world coordinate system (WCS) transformation to use.
offset : `~astro... | [
"Calculate",
"the",
"pixel",
"scale",
"and",
"WCS",
"rotation",
"angle",
"at",
"the",
"position",
"of",
"a",
"SkyCoord",
"coordinate",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/utils/wcs_helpers.py#L9-L62 |
10,541 | astropy/photutils | photutils/utils/wcs_helpers.py | pixel_to_icrs_coords | def pixel_to_icrs_coords(x, y, wcs):
"""
Convert pixel coordinates to ICRS Right Ascension and Declination.
This is merely a convenience function to extract RA and Dec. from a
`~astropy.coordinates.SkyCoord` instance so they can be put in
separate columns in a `~astropy.table.Table`.
Parameter... | python | def pixel_to_icrs_coords(x, y, wcs):
"""
Convert pixel coordinates to ICRS Right Ascension and Declination.
This is merely a convenience function to extract RA and Dec. from a
`~astropy.coordinates.SkyCoord` instance so they can be put in
separate columns in a `~astropy.table.Table`.
Parameter... | [
"def",
"pixel_to_icrs_coords",
"(",
"x",
",",
"y",
",",
"wcs",
")",
":",
"icrs_coords",
"=",
"pixel_to_skycoord",
"(",
"x",
",",
"y",
",",
"wcs",
")",
".",
"icrs",
"icrs_ra",
"=",
"icrs_coords",
".",
"ra",
".",
"degree",
"*",
"u",
".",
"deg",
"icrs_d... | Convert pixel coordinates to ICRS Right Ascension and Declination.
This is merely a convenience function to extract RA and Dec. from a
`~astropy.coordinates.SkyCoord` instance so they can be put in
separate columns in a `~astropy.table.Table`.
Parameters
----------
x : float or array-like
... | [
"Convert",
"pixel",
"coordinates",
"to",
"ICRS",
"Right",
"Ascension",
"and",
"Declination",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/utils/wcs_helpers.py#L95-L129 |
10,542 | astropy/photutils | photutils/utils/convolution.py | filter_data | def filter_data(data, kernel, mode='constant', fill_value=0.0,
check_normalization=False):
"""
Convolve a 2D image with a 2D kernel.
The kernel may either be a 2D `~numpy.ndarray` or a
`~astropy.convolution.Kernel2D` object.
Parameters
----------
data : array_like
T... | python | def filter_data(data, kernel, mode='constant', fill_value=0.0,
check_normalization=False):
"""
Convolve a 2D image with a 2D kernel.
The kernel may either be a 2D `~numpy.ndarray` or a
`~astropy.convolution.Kernel2D` object.
Parameters
----------
data : array_like
T... | [
"def",
"filter_data",
"(",
"data",
",",
"kernel",
",",
"mode",
"=",
"'constant'",
",",
"fill_value",
"=",
"0.0",
",",
"check_normalization",
"=",
"False",
")",
":",
"from",
"scipy",
"import",
"ndimage",
"if",
"kernel",
"is",
"not",
"None",
":",
"if",
"is... | Convolve a 2D image with a 2D kernel.
The kernel may either be a 2D `~numpy.ndarray` or a
`~astropy.convolution.Kernel2D` object.
Parameters
----------
data : array_like
The 2D array of the image.
kernel : array-like (2D) or `~astropy.convolution.Kernel2D`
The 2D kernel used t... | [
"Convolve",
"a",
"2D",
"image",
"with",
"a",
"2D",
"kernel",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/utils/convolution.py#L13-L66 |
10,543 | astropy/photutils | photutils/psf/utils.py | prepare_psf_model | def prepare_psf_model(psfmodel, xname=None, yname=None, fluxname=None,
renormalize_psf=True):
"""
Convert a 2D PSF model to one suitable for use with
`BasicPSFPhotometry` or its subclasses.
The resulting model may be a composite model, but should have only
the x, y, and flux r... | python | def prepare_psf_model(psfmodel, xname=None, yname=None, fluxname=None,
renormalize_psf=True):
"""
Convert a 2D PSF model to one suitable for use with
`BasicPSFPhotometry` or its subclasses.
The resulting model may be a composite model, but should have only
the x, y, and flux r... | [
"def",
"prepare_psf_model",
"(",
"psfmodel",
",",
"xname",
"=",
"None",
",",
"yname",
"=",
"None",
",",
"fluxname",
"=",
"None",
",",
"renormalize_psf",
"=",
"True",
")",
":",
"if",
"xname",
"is",
"None",
":",
"xinmod",
"=",
"models",
".",
"Shift",
"("... | Convert a 2D PSF model to one suitable for use with
`BasicPSFPhotometry` or its subclasses.
The resulting model may be a composite model, but should have only
the x, y, and flux related parameters un-fixed.
Parameters
----------
psfmodel : a 2D model
The model to assume as representati... | [
"Convert",
"a",
"2D",
"PSF",
"model",
"to",
"one",
"suitable",
"for",
"use",
"with",
"BasicPSFPhotometry",
"or",
"its",
"subclasses",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/psf/utils.py#L15-L106 |
10,544 | astropy/photutils | photutils/psf/utils.py | get_grouped_psf_model | def get_grouped_psf_model(template_psf_model, star_group, pars_to_set):
"""
Construct a joint PSF model which consists of a sum of PSF's templated on
a specific model, but whose parameters are given by a table of objects.
Parameters
----------
template_psf_model : `astropy.modeling.Fittable2DMo... | python | def get_grouped_psf_model(template_psf_model, star_group, pars_to_set):
"""
Construct a joint PSF model which consists of a sum of PSF's templated on
a specific model, but whose parameters are given by a table of objects.
Parameters
----------
template_psf_model : `astropy.modeling.Fittable2DMo... | [
"def",
"get_grouped_psf_model",
"(",
"template_psf_model",
",",
"star_group",
",",
"pars_to_set",
")",
":",
"group_psf",
"=",
"None",
"for",
"star",
"in",
"star_group",
":",
"psf_to_add",
"=",
"template_psf_model",
".",
"copy",
"(",
")",
"for",
"param_tab_name",
... | Construct a joint PSF model which consists of a sum of PSF's templated on
a specific model, but whose parameters are given by a table of objects.
Parameters
----------
template_psf_model : `astropy.modeling.Fittable2DModel` instance
The model to use for *individual* objects. Must have paramete... | [
"Construct",
"a",
"joint",
"PSF",
"model",
"which",
"consists",
"of",
"a",
"sum",
"of",
"PSF",
"s",
"templated",
"on",
"a",
"specific",
"model",
"but",
"whose",
"parameters",
"are",
"given",
"by",
"a",
"table",
"of",
"objects",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/psf/utils.py#L109-L143 |
10,545 | astropy/photutils | photutils/psf/utils.py | _call_fitter | def _call_fitter(fitter, psf, x, y, data, weights):
"""
Not all fitters have to support a weight array. This function
includes the weight in the fitter call only if really needed.
"""
if np.all(weights == 1.):
return fitter(psf, x, y, data)
else:
return fitter(psf, x, y, data, w... | python | def _call_fitter(fitter, psf, x, y, data, weights):
"""
Not all fitters have to support a weight array. This function
includes the weight in the fitter call only if really needed.
"""
if np.all(weights == 1.):
return fitter(psf, x, y, data)
else:
return fitter(psf, x, y, data, w... | [
"def",
"_call_fitter",
"(",
"fitter",
",",
"psf",
",",
"x",
",",
"y",
",",
"data",
",",
"weights",
")",
":",
"if",
"np",
".",
"all",
"(",
"weights",
"==",
"1.",
")",
":",
"return",
"fitter",
"(",
"psf",
",",
"x",
",",
"y",
",",
"data",
")",
"... | Not all fitters have to support a weight array. This function
includes the weight in the fitter call only if really needed. | [
"Not",
"all",
"fitters",
"have",
"to",
"support",
"a",
"weight",
"array",
".",
"This",
"function",
"includes",
"the",
"weight",
"in",
"the",
"fitter",
"call",
"only",
"if",
"really",
"needed",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/psf/utils.py#L178-L187 |
10,546 | astropy/photutils | photutils/detection/core.py | detect_threshold | def detect_threshold(data, snr, background=None, error=None, mask=None,
mask_value=None, sigclip_sigma=3.0, sigclip_iters=None):
"""
Calculate a pixel-wise threshold image that can be used to detect
sources.
Parameters
----------
data : array_like
The 2D array of th... | python | def detect_threshold(data, snr, background=None, error=None, mask=None,
mask_value=None, sigclip_sigma=3.0, sigclip_iters=None):
"""
Calculate a pixel-wise threshold image that can be used to detect
sources.
Parameters
----------
data : array_like
The 2D array of th... | [
"def",
"detect_threshold",
"(",
"data",
",",
"snr",
",",
"background",
"=",
"None",
",",
"error",
"=",
"None",
",",
"mask",
"=",
"None",
",",
"mask_value",
"=",
"None",
",",
"sigclip_sigma",
"=",
"3.0",
",",
"sigclip_iters",
"=",
"None",
")",
":",
"if"... | Calculate a pixel-wise threshold image that can be used to detect
sources.
Parameters
----------
data : array_like
The 2D array of the image.
snr : float
The signal-to-noise ratio per pixel above the ``background`` for
which to consider a pixel as possibly being part of a s... | [
"Calculate",
"a",
"pixel",
"-",
"wise",
"threshold",
"image",
"that",
"can",
"be",
"used",
"to",
"detect",
"sources",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/detection/core.py#L18-L126 |
10,547 | astropy/photutils | ah_bootstrap.py | run_cmd | def run_cmd(cmd):
"""
Run a command in a subprocess, given as a list of command-line
arguments.
Returns a ``(returncode, stdout, stderr)`` tuple.
"""
try:
p = sp.Popen(cmd, stdout=sp.PIPE, stderr=sp.PIPE)
# XXX: May block if either stdout or stderr fill their buffers;
#... | python | def run_cmd(cmd):
"""
Run a command in a subprocess, given as a list of command-line
arguments.
Returns a ``(returncode, stdout, stderr)`` tuple.
"""
try:
p = sp.Popen(cmd, stdout=sp.PIPE, stderr=sp.PIPE)
# XXX: May block if either stdout or stderr fill their buffers;
#... | [
"def",
"run_cmd",
"(",
"cmd",
")",
":",
"try",
":",
"p",
"=",
"sp",
".",
"Popen",
"(",
"cmd",
",",
"stdout",
"=",
"sp",
".",
"PIPE",
",",
"stderr",
"=",
"sp",
".",
"PIPE",
")",
"# XXX: May block if either stdout or stderr fill their buffers;",
"# however for... | Run a command in a subprocess, given as a list of command-line
arguments.
Returns a ``(returncode, stdout, stderr)`` tuple. | [
"Run",
"a",
"command",
"in",
"a",
"subprocess",
"given",
"as",
"a",
"list",
"of",
"command",
"-",
"line",
"arguments",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/ah_bootstrap.py#L768-L812 |
10,548 | astropy/photutils | photutils/aperture/ellipse.py | EllipticalAperture.to_sky | def to_sky(self, wcs, mode='all'):
"""
Convert the aperture to a `SkyEllipticalAperture` object defined
in celestial coordinates.
Parameters
----------
wcs : `~astropy.wcs.WCS`
The world coordinate system (WCS) transformation to use.
mode : {'all', '... | python | def to_sky(self, wcs, mode='all'):
"""
Convert the aperture to a `SkyEllipticalAperture` object defined
in celestial coordinates.
Parameters
----------
wcs : `~astropy.wcs.WCS`
The world coordinate system (WCS) transformation to use.
mode : {'all', '... | [
"def",
"to_sky",
"(",
"self",
",",
"wcs",
",",
"mode",
"=",
"'all'",
")",
":",
"sky_params",
"=",
"self",
".",
"_to_sky_params",
"(",
"wcs",
",",
"mode",
"=",
"mode",
")",
"return",
"SkyEllipticalAperture",
"(",
"*",
"*",
"sky_params",
")"
] | Convert the aperture to a `SkyEllipticalAperture` object defined
in celestial coordinates.
Parameters
----------
wcs : `~astropy.wcs.WCS`
The world coordinate system (WCS) transformation to use.
mode : {'all', 'wcs'}, optional
Whether to do the transform... | [
"Convert",
"the",
"aperture",
"to",
"a",
"SkyEllipticalAperture",
"object",
"defined",
"in",
"celestial",
"coordinates",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/aperture/ellipse.py#L187-L209 |
10,549 | astropy/photutils | photutils/aperture/ellipse.py | EllipticalAnnulus.to_sky | def to_sky(self, wcs, mode='all'):
"""
Convert the aperture to a `SkyEllipticalAnnulus` object defined
in celestial coordinates.
Parameters
----------
wcs : `~astropy.wcs.WCS`
The world coordinate system (WCS) transformation to use.
mode : {'all', 'w... | python | def to_sky(self, wcs, mode='all'):
"""
Convert the aperture to a `SkyEllipticalAnnulus` object defined
in celestial coordinates.
Parameters
----------
wcs : `~astropy.wcs.WCS`
The world coordinate system (WCS) transformation to use.
mode : {'all', 'w... | [
"def",
"to_sky",
"(",
"self",
",",
"wcs",
",",
"mode",
"=",
"'all'",
")",
":",
"sky_params",
"=",
"self",
".",
"_to_sky_params",
"(",
"wcs",
",",
"mode",
"=",
"mode",
")",
"return",
"SkyEllipticalAnnulus",
"(",
"*",
"*",
"sky_params",
")"
] | Convert the aperture to a `SkyEllipticalAnnulus` object defined
in celestial coordinates.
Parameters
----------
wcs : `~astropy.wcs.WCS`
The world coordinate system (WCS) transformation to use.
mode : {'all', 'wcs'}, optional
Whether to do the transforma... | [
"Convert",
"the",
"aperture",
"to",
"a",
"SkyEllipticalAnnulus",
"object",
"defined",
"in",
"celestial",
"coordinates",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/aperture/ellipse.py#L318-L340 |
10,550 | astropy/photutils | photutils/aperture/ellipse.py | SkyEllipticalAperture.to_pixel | def to_pixel(self, wcs, mode='all'):
"""
Convert the aperture to an `EllipticalAperture` object defined
in pixel coordinates.
Parameters
----------
wcs : `~astropy.wcs.WCS`
The world coordinate system (WCS) transformation to use.
mode : {'all', 'wcs'... | python | def to_pixel(self, wcs, mode='all'):
"""
Convert the aperture to an `EllipticalAperture` object defined
in pixel coordinates.
Parameters
----------
wcs : `~astropy.wcs.WCS`
The world coordinate system (WCS) transformation to use.
mode : {'all', 'wcs'... | [
"def",
"to_pixel",
"(",
"self",
",",
"wcs",
",",
"mode",
"=",
"'all'",
")",
":",
"pixel_params",
"=",
"self",
".",
"_to_pixel_params",
"(",
"wcs",
",",
"mode",
"=",
"mode",
")",
"return",
"EllipticalAperture",
"(",
"*",
"*",
"pixel_params",
")"
] | Convert the aperture to an `EllipticalAperture` object defined
in pixel coordinates.
Parameters
----------
wcs : `~astropy.wcs.WCS`
The world coordinate system (WCS) transformation to use.
mode : {'all', 'wcs'}, optional
Whether to do the transformation ... | [
"Convert",
"the",
"aperture",
"to",
"an",
"EllipticalAperture",
"object",
"defined",
"in",
"pixel",
"coordinates",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/aperture/ellipse.py#L385-L407 |
10,551 | astropy/photutils | photutils/aperture/ellipse.py | SkyEllipticalAnnulus.to_pixel | def to_pixel(self, wcs, mode='all'):
"""
Convert the aperture to an `EllipticalAnnulus` object defined in
pixel coordinates.
Parameters
----------
wcs : `~astropy.wcs.WCS`
The world coordinate system (WCS) transformation to use.
mode : {'all', 'wcs'}... | python | def to_pixel(self, wcs, mode='all'):
"""
Convert the aperture to an `EllipticalAnnulus` object defined in
pixel coordinates.
Parameters
----------
wcs : `~astropy.wcs.WCS`
The world coordinate system (WCS) transformation to use.
mode : {'all', 'wcs'}... | [
"def",
"to_pixel",
"(",
"self",
",",
"wcs",
",",
"mode",
"=",
"'all'",
")",
":",
"pixel_params",
"=",
"self",
".",
"_to_pixel_params",
"(",
"wcs",
",",
"mode",
"=",
"mode",
")",
"return",
"EllipticalAnnulus",
"(",
"*",
"*",
"pixel_params",
")"
] | Convert the aperture to an `EllipticalAnnulus` object defined in
pixel coordinates.
Parameters
----------
wcs : `~astropy.wcs.WCS`
The world coordinate system (WCS) transformation to use.
mode : {'all', 'wcs'}, optional
Whether to do the transformation i... | [
"Convert",
"the",
"aperture",
"to",
"an",
"EllipticalAnnulus",
"object",
"defined",
"in",
"pixel",
"coordinates",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/aperture/ellipse.py#L465-L487 |
10,552 | astropy/photutils | photutils/isophote/geometry.py | _area | def _area(sma, eps, phi, r):
"""
Compute elliptical sector area.
"""
aux = r * math.cos(phi) / sma
signal = aux / abs(aux)
if abs(aux) >= 1.:
aux = signal
return abs(sma**2 * (1.-eps) / 2. * math.acos(aux)) | python | def _area(sma, eps, phi, r):
"""
Compute elliptical sector area.
"""
aux = r * math.cos(phi) / sma
signal = aux / abs(aux)
if abs(aux) >= 1.:
aux = signal
return abs(sma**2 * (1.-eps) / 2. * math.acos(aux)) | [
"def",
"_area",
"(",
"sma",
",",
"eps",
",",
"phi",
",",
"r",
")",
":",
"aux",
"=",
"r",
"*",
"math",
".",
"cos",
"(",
"phi",
")",
"/",
"sma",
"signal",
"=",
"aux",
"/",
"abs",
"(",
"aux",
")",
"if",
"abs",
"(",
"aux",
")",
">=",
"1.",
":... | Compute elliptical sector area. | [
"Compute",
"elliptical",
"sector",
"area",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/isophote/geometry.py#L50-L59 |
10,553 | astropy/photutils | photutils/isophote/geometry.py | EllipseGeometry.find_center | def find_center(self, image, threshold=0.1, verbose=True):
"""
Find the center of a galaxy.
If the algorithm is successful the (x, y) coordinates in this
`~photutils.isophote.EllipseGeometry` (i.e. the ``x0`` and
``y0`` attributes) instance will be modified.
The isophot... | python | def find_center(self, image, threshold=0.1, verbose=True):
"""
Find the center of a galaxy.
If the algorithm is successful the (x, y) coordinates in this
`~photutils.isophote.EllipseGeometry` (i.e. the ``x0`` and
``y0`` attributes) instance will be modified.
The isophot... | [
"def",
"find_center",
"(",
"self",
",",
"image",
",",
"threshold",
"=",
"0.1",
",",
"verbose",
"=",
"True",
")",
":",
"self",
".",
"_centerer_mask_half_size",
"=",
"len",
"(",
"IN_MASK",
")",
"/",
"2",
"self",
".",
"centerer_threshold",
"=",
"threshold",
... | Find the center of a galaxy.
If the algorithm is successful the (x, y) coordinates in this
`~photutils.isophote.EllipseGeometry` (i.e. the ``x0`` and
``y0`` attributes) instance will be modified.
The isophote fit algorithm requires an initial guess for the
galaxy center (x, y) ... | [
"Find",
"the",
"center",
"of",
"a",
"galaxy",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/isophote/geometry.py#L133-L254 |
10,554 | astropy/photutils | photutils/isophote/geometry.py | EllipseGeometry.radius | def radius(self, angle):
"""
Calculate the polar radius for a given polar angle.
Parameters
----------
angle : float
The polar angle (radians).
Returns
-------
radius : float
The polar radius (pixels).
"""
return ... | python | def radius(self, angle):
"""
Calculate the polar radius for a given polar angle.
Parameters
----------
angle : float
The polar angle (radians).
Returns
-------
radius : float
The polar radius (pixels).
"""
return ... | [
"def",
"radius",
"(",
"self",
",",
"angle",
")",
":",
"return",
"(",
"self",
".",
"sma",
"*",
"(",
"1.",
"-",
"self",
".",
"eps",
")",
"/",
"np",
".",
"sqrt",
"(",
"(",
"(",
"1.",
"-",
"self",
".",
"eps",
")",
"*",
"np",
".",
"cos",
"(",
... | Calculate the polar radius for a given polar angle.
Parameters
----------
angle : float
The polar angle (radians).
Returns
-------
radius : float
The polar radius (pixels). | [
"Calculate",
"the",
"polar",
"radius",
"for",
"a",
"given",
"polar",
"angle",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/isophote/geometry.py#L256-L273 |
10,555 | astropy/photutils | photutils/isophote/geometry.py | EllipseGeometry.initialize_sector_geometry | def initialize_sector_geometry(self, phi):
"""
Initialize geometry attributes associated with an elliptical
sector at the given polar angle ``phi``.
This function computes:
* the four vertices that define the elliptical sector on the
pixel array.
* the sector ... | python | def initialize_sector_geometry(self, phi):
"""
Initialize geometry attributes associated with an elliptical
sector at the given polar angle ``phi``.
This function computes:
* the four vertices that define the elliptical sector on the
pixel array.
* the sector ... | [
"def",
"initialize_sector_geometry",
"(",
"self",
",",
"phi",
")",
":",
"# These polar radii bound the region between the inner",
"# and outer ellipses that define the sector.",
"sma1",
",",
"sma2",
"=",
"self",
".",
"bounding_ellipses",
"(",
")",
"eps_",
"=",
"1.",
"-",
... | Initialize geometry attributes associated with an elliptical
sector at the given polar angle ``phi``.
This function computes:
* the four vertices that define the elliptical sector on the
pixel array.
* the sector area (saved in the ``sector_area`` attribute)
* the sec... | [
"Initialize",
"geometry",
"attributes",
"associated",
"with",
"an",
"elliptical",
"sector",
"at",
"the",
"given",
"polar",
"angle",
"phi",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/isophote/geometry.py#L275-L344 |
10,556 | astropy/photutils | photutils/isophote/geometry.py | EllipseGeometry.bounding_ellipses | def bounding_ellipses(self):
"""
Compute the semimajor axis of the two ellipses that bound the
annulus where integrations take place.
Returns
-------
sma1, sma2 : float
The smaller and larger values of semimajor axis length that
define the annulus... | python | def bounding_ellipses(self):
"""
Compute the semimajor axis of the two ellipses that bound the
annulus where integrations take place.
Returns
-------
sma1, sma2 : float
The smaller and larger values of semimajor axis length that
define the annulus... | [
"def",
"bounding_ellipses",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"linear_growth",
")",
":",
"a1",
"=",
"self",
".",
"sma",
"-",
"self",
".",
"astep",
"/",
"2.",
"a2",
"=",
"self",
".",
"sma",
"+",
"self",
".",
"astep",
"/",
"2.",
"else"... | Compute the semimajor axis of the two ellipses that bound the
annulus where integrations take place.
Returns
-------
sma1, sma2 : float
The smaller and larger values of semimajor axis length that
define the annulus bounding ellipses. | [
"Compute",
"the",
"semimajor",
"axis",
"of",
"the",
"two",
"ellipses",
"that",
"bound",
"the",
"annulus",
"where",
"integrations",
"take",
"place",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/isophote/geometry.py#L346-L365 |
10,557 | astropy/photutils | photutils/isophote/geometry.py | EllipseGeometry.update_sma | def update_sma(self, step):
"""
Calculate an updated value for the semimajor axis, given the
current value and the step value.
The step value must be managed by the caller to support both
modes: grow outwards and shrink inwards.
Parameters
----------
ste... | python | def update_sma(self, step):
"""
Calculate an updated value for the semimajor axis, given the
current value and the step value.
The step value must be managed by the caller to support both
modes: grow outwards and shrink inwards.
Parameters
----------
ste... | [
"def",
"update_sma",
"(",
"self",
",",
"step",
")",
":",
"if",
"self",
".",
"linear_growth",
":",
"sma",
"=",
"self",
".",
"sma",
"+",
"step",
"else",
":",
"sma",
"=",
"self",
".",
"sma",
"*",
"(",
"1.",
"+",
"step",
")",
"return",
"sma"
] | Calculate an updated value for the semimajor axis, given the
current value and the step value.
The step value must be managed by the caller to support both
modes: grow outwards and shrink inwards.
Parameters
----------
step : float
The step value.
R... | [
"Calculate",
"an",
"updated",
"value",
"for",
"the",
"semimajor",
"axis",
"given",
"the",
"current",
"value",
"and",
"the",
"step",
"value",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/isophote/geometry.py#L484-L507 |
10,558 | astropy/photutils | photutils/isophote/geometry.py | EllipseGeometry.reset_sma | def reset_sma(self, step):
"""
Change the direction of semimajor axis growth, from outwards to
inwards.
Parameters
----------
step : float
The current step value.
Returns
-------
sma, new_step : float
The new semimajor axi... | python | def reset_sma(self, step):
"""
Change the direction of semimajor axis growth, from outwards to
inwards.
Parameters
----------
step : float
The current step value.
Returns
-------
sma, new_step : float
The new semimajor axi... | [
"def",
"reset_sma",
"(",
"self",
",",
"step",
")",
":",
"if",
"self",
".",
"linear_growth",
":",
"sma",
"=",
"self",
".",
"sma",
"-",
"step",
"step",
"=",
"-",
"step",
"else",
":",
"aux",
"=",
"1.",
"/",
"(",
"1.",
"+",
"step",
")",
"sma",
"=",... | Change the direction of semimajor axis growth, from outwards to
inwards.
Parameters
----------
step : float
The current step value.
Returns
-------
sma, new_step : float
The new semimajor axis length and the new step value to
... | [
"Change",
"the",
"direction",
"of",
"semimajor",
"axis",
"growth",
"from",
"outwards",
"to",
"inwards",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/isophote/geometry.py#L509-L537 |
10,559 | astropy/photutils | photutils/psf/matching/fourier.py | resize_psf | def resize_psf(psf, input_pixel_scale, output_pixel_scale, order=3):
"""
Resize a PSF using spline interpolation of the requested order.
Parameters
----------
psf : 2D `~numpy.ndarray`
The 2D data array of the PSF.
input_pixel_scale : float
The pixel scale of the input ``psf``.... | python | def resize_psf(psf, input_pixel_scale, output_pixel_scale, order=3):
"""
Resize a PSF using spline interpolation of the requested order.
Parameters
----------
psf : 2D `~numpy.ndarray`
The 2D data array of the PSF.
input_pixel_scale : float
The pixel scale of the input ``psf``.... | [
"def",
"resize_psf",
"(",
"psf",
",",
"input_pixel_scale",
",",
"output_pixel_scale",
",",
"order",
"=",
"3",
")",
":",
"from",
"scipy",
".",
"ndimage",
"import",
"zoom",
"ratio",
"=",
"input_pixel_scale",
"/",
"output_pixel_scale",
"return",
"zoom",
"(",
"psf... | Resize a PSF using spline interpolation of the requested order.
Parameters
----------
psf : 2D `~numpy.ndarray`
The 2D data array of the PSF.
input_pixel_scale : float
The pixel scale of the input ``psf``. The units must
match ``output_pixel_scale``.
output_pixel_scale : ... | [
"Resize",
"a",
"PSF",
"using",
"spline",
"interpolation",
"of",
"the",
"requested",
"order",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/psf/matching/fourier.py#L13-L42 |
10,560 | astropy/photutils | photutils/background/background_2d.py | Background2D._select_meshes | def _select_meshes(self, data):
"""
Define the x and y indices with respect to the low-resolution
mesh image of the meshes to use for the background
interpolation.
The ``exclude_percentile`` keyword determines which meshes are
not used for the background interpolation.
... | python | def _select_meshes(self, data):
"""
Define the x and y indices with respect to the low-resolution
mesh image of the meshes to use for the background
interpolation.
The ``exclude_percentile`` keyword determines which meshes are
not used for the background interpolation.
... | [
"def",
"_select_meshes",
"(",
"self",
",",
"data",
")",
":",
"# the number of masked pixels in each mesh",
"nmasked",
"=",
"np",
".",
"ma",
".",
"count_masked",
"(",
"data",
",",
"axis",
"=",
"1",
")",
"# meshes that contain more than ``exclude_percentile`` percent",
... | Define the x and y indices with respect to the low-resolution
mesh image of the meshes to use for the background
interpolation.
The ``exclude_percentile`` keyword determines which meshes are
not used for the background interpolation.
Parameters
----------
data :... | [
"Define",
"the",
"x",
"and",
"y",
"indices",
"with",
"respect",
"to",
"the",
"low",
"-",
"resolution",
"mesh",
"image",
"of",
"the",
"meshes",
"to",
"use",
"for",
"the",
"background",
"interpolation",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/background/background_2d.py#L412-L453 |
10,561 | astropy/photutils | photutils/background/background_2d.py | Background2D._prepare_data | def _prepare_data(self):
"""
Prepare the data.
First, pad or crop the 2D data array so that there are an
integer number of meshes in both dimensions, creating a masked
array.
Then reshape into a different 2D masked array where each row
represents the data in a s... | python | def _prepare_data(self):
"""
Prepare the data.
First, pad or crop the 2D data array so that there are an
integer number of meshes in both dimensions, creating a masked
array.
Then reshape into a different 2D masked array where each row
represents the data in a s... | [
"def",
"_prepare_data",
"(",
"self",
")",
":",
"self",
".",
"nyboxes",
"=",
"self",
".",
"data",
".",
"shape",
"[",
"0",
"]",
"//",
"self",
".",
"box_size",
"[",
"0",
"]",
"self",
".",
"nxboxes",
"=",
"self",
".",
"data",
".",
"shape",
"[",
"1",
... | Prepare the data.
First, pad or crop the 2D data array so that there are an
integer number of meshes in both dimensions, creating a masked
array.
Then reshape into a different 2D masked array where each row
represents the data in a single mesh. This method also performs
... | [
"Prepare",
"the",
"data",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/background/background_2d.py#L455-L499 |
10,562 | astropy/photutils | photutils/background/background_2d.py | Background2D._make_2d_array | def _make_2d_array(self, data):
"""
Convert a 1D array of mesh values to a masked 2D mesh array
given the 1D mesh indices ``mesh_idx``.
Parameters
----------
data : 1D `~numpy.ndarray`
A 1D array of mesh values.
Returns
-------
result... | python | def _make_2d_array(self, data):
"""
Convert a 1D array of mesh values to a masked 2D mesh array
given the 1D mesh indices ``mesh_idx``.
Parameters
----------
data : 1D `~numpy.ndarray`
A 1D array of mesh values.
Returns
-------
result... | [
"def",
"_make_2d_array",
"(",
"self",
",",
"data",
")",
":",
"if",
"data",
".",
"shape",
"!=",
"self",
".",
"mesh_idx",
".",
"shape",
":",
"raise",
"ValueError",
"(",
"'data and mesh_idx must have the same shape'",
")",
"if",
"np",
".",
"ma",
".",
"is_masked... | Convert a 1D array of mesh values to a masked 2D mesh array
given the 1D mesh indices ``mesh_idx``.
Parameters
----------
data : 1D `~numpy.ndarray`
A 1D array of mesh values.
Returns
-------
result : 2D `~numpy.ma.MaskedArray`
A 2D maske... | [
"Convert",
"a",
"1D",
"array",
"of",
"mesh",
"values",
"to",
"a",
"masked",
"2D",
"mesh",
"array",
"given",
"the",
"1D",
"mesh",
"indices",
"mesh_idx",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/background/background_2d.py#L501-L535 |
10,563 | astropy/photutils | photutils/background/background_2d.py | Background2D._interpolate_meshes | def _interpolate_meshes(self, data, n_neighbors=10, eps=0., power=1.,
reg=0.):
"""
Use IDW interpolation to fill in any masked pixels in the
low-resolution 2D mesh background and background RMS images.
This is required to use a regular-grid interpolator to ex... | python | def _interpolate_meshes(self, data, n_neighbors=10, eps=0., power=1.,
reg=0.):
"""
Use IDW interpolation to fill in any masked pixels in the
low-resolution 2D mesh background and background RMS images.
This is required to use a regular-grid interpolator to ex... | [
"def",
"_interpolate_meshes",
"(",
"self",
",",
"data",
",",
"n_neighbors",
"=",
"10",
",",
"eps",
"=",
"0.",
",",
"power",
"=",
"1.",
",",
"reg",
"=",
"0.",
")",
":",
"yx",
"=",
"np",
".",
"column_stack",
"(",
"[",
"self",
".",
"mesh_yidx",
",",
... | Use IDW interpolation to fill in any masked pixels in the
low-resolution 2D mesh background and background RMS images.
This is required to use a regular-grid interpolator to expand
the low-resolution image to the full size image.
Parameters
----------
data : 1D `~numpy.... | [
"Use",
"IDW",
"interpolation",
"to",
"fill",
"in",
"any",
"masked",
"pixels",
"in",
"the",
"low",
"-",
"resolution",
"2D",
"mesh",
"background",
"and",
"background",
"RMS",
"images",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/background/background_2d.py#L537-L584 |
10,564 | astropy/photutils | photutils/background/background_2d.py | Background2D._selective_filter | def _selective_filter(self, data, indices):
"""
Selectively filter only pixels above ``filter_threshold`` in the
background mesh.
The same pixels are filtered in both the background and
background RMS meshes.
Parameters
----------
data : 2D `~numpy.ndarr... | python | def _selective_filter(self, data, indices):
"""
Selectively filter only pixels above ``filter_threshold`` in the
background mesh.
The same pixels are filtered in both the background and
background RMS meshes.
Parameters
----------
data : 2D `~numpy.ndarr... | [
"def",
"_selective_filter",
"(",
"self",
",",
"data",
",",
"indices",
")",
":",
"data_out",
"=",
"np",
".",
"copy",
"(",
"data",
")",
"for",
"i",
",",
"j",
"in",
"zip",
"(",
"*",
"indices",
")",
":",
"yfs",
",",
"xfs",
"=",
"self",
".",
"filter_s... | Selectively filter only pixels above ``filter_threshold`` in the
background mesh.
The same pixels are filtered in both the background and
background RMS meshes.
Parameters
----------
data : 2D `~numpy.ndarray`
A 2D array of mesh values.
indices : 2 ... | [
"Selectively",
"filter",
"only",
"pixels",
"above",
"filter_threshold",
"in",
"the",
"background",
"mesh",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/background/background_2d.py#L586-L617 |
10,565 | astropy/photutils | photutils/background/background_2d.py | Background2D._filter_meshes | def _filter_meshes(self):
"""
Apply a 2D median filter to the low-resolution 2D mesh,
including only pixels inside the image at the borders.
"""
from scipy.ndimage import generic_filter
try:
nanmedian_func = np.nanmedian # numpy >= 1.9
except Attri... | python | def _filter_meshes(self):
"""
Apply a 2D median filter to the low-resolution 2D mesh,
including only pixels inside the image at the borders.
"""
from scipy.ndimage import generic_filter
try:
nanmedian_func = np.nanmedian # numpy >= 1.9
except Attri... | [
"def",
"_filter_meshes",
"(",
"self",
")",
":",
"from",
"scipy",
".",
"ndimage",
"import",
"generic_filter",
"try",
":",
"nanmedian_func",
"=",
"np",
".",
"nanmedian",
"# numpy >= 1.9",
"except",
"AttributeError",
":",
"# pragma: no cover",
"from",
"scipy",
".",
... | Apply a 2D median filter to the low-resolution 2D mesh,
including only pixels inside the image at the borders. | [
"Apply",
"a",
"2D",
"median",
"filter",
"to",
"the",
"low",
"-",
"resolution",
"2D",
"mesh",
"including",
"only",
"pixels",
"inside",
"the",
"image",
"at",
"the",
"borders",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/background/background_2d.py#L619-L648 |
10,566 | astropy/photutils | photutils/background/background_2d.py | Background2D._calc_bkg_bkgrms | def _calc_bkg_bkgrms(self):
"""
Calculate the background and background RMS estimate in each of
the meshes.
Both meshes are computed at the same time here method because
the filtering of both depends on the background mesh.
The ``background_mesh`` and ``background_rms_m... | python | def _calc_bkg_bkgrms(self):
"""
Calculate the background and background RMS estimate in each of
the meshes.
Both meshes are computed at the same time here method because
the filtering of both depends on the background mesh.
The ``background_mesh`` and ``background_rms_m... | [
"def",
"_calc_bkg_bkgrms",
"(",
"self",
")",
":",
"if",
"self",
".",
"sigma_clip",
"is",
"not",
"None",
":",
"data_sigclip",
"=",
"self",
".",
"sigma_clip",
"(",
"self",
".",
"_mesh_data",
",",
"axis",
"=",
"1",
")",
"else",
":",
"data_sigclip",
"=",
"... | Calculate the background and background RMS estimate in each of
the meshes.
Both meshes are computed at the same time here method because
the filtering of both depends on the background mesh.
The ``background_mesh`` and ``background_rms_mesh`` images are
equivalent to the low-r... | [
"Calculate",
"the",
"background",
"and",
"background",
"RMS",
"estimate",
"in",
"each",
"of",
"the",
"meshes",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/background/background_2d.py#L650-L703 |
10,567 | astropy/photutils | photutils/background/background_2d.py | Background2D._calc_coordinates | def _calc_coordinates(self):
"""
Calculate the coordinates to use when calling an interpolator.
These are needed for `Background2D` and `BackgroundIDW2D`.
Regular-grid interpolators require a 2D array of values. Some
require a 2D meshgrid of x and y. Other require a strictly
... | python | def _calc_coordinates(self):
"""
Calculate the coordinates to use when calling an interpolator.
These are needed for `Background2D` and `BackgroundIDW2D`.
Regular-grid interpolators require a 2D array of values. Some
require a 2D meshgrid of x and y. Other require a strictly
... | [
"def",
"_calc_coordinates",
"(",
"self",
")",
":",
"# the position coordinates used to initialize an interpolation",
"self",
".",
"y",
"=",
"(",
"self",
".",
"mesh_yidx",
"*",
"self",
".",
"box_size",
"[",
"0",
"]",
"+",
"(",
"self",
".",
"box_size",
"[",
"0",... | Calculate the coordinates to use when calling an interpolator.
These are needed for `Background2D` and `BackgroundIDW2D`.
Regular-grid interpolators require a 2D array of values. Some
require a 2D meshgrid of x and y. Other require a strictly
increasing 1D array of the x and y ranges... | [
"Calculate",
"the",
"coordinates",
"to",
"use",
"when",
"calling",
"an",
"interpolator",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/background/background_2d.py#L705-L725 |
10,568 | astropy/photutils | photutils/background/background_2d.py | Background2D.plot_meshes | def plot_meshes(self, ax=None, marker='+', color='blue', outlines=False,
**kwargs):
"""
Plot the low-resolution mesh boxes on a matplotlib Axes
instance.
Parameters
----------
ax : `matplotlib.axes.Axes` instance, optional
If `None`, then ... | python | def plot_meshes(self, ax=None, marker='+', color='blue', outlines=False,
**kwargs):
"""
Plot the low-resolution mesh boxes on a matplotlib Axes
instance.
Parameters
----------
ax : `matplotlib.axes.Axes` instance, optional
If `None`, then ... | [
"def",
"plot_meshes",
"(",
"self",
",",
"ax",
"=",
"None",
",",
"marker",
"=",
"'+'",
",",
"color",
"=",
"'blue'",
",",
"outlines",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"kwargs",
"[",
... | Plot the low-resolution mesh boxes on a matplotlib Axes
instance.
Parameters
----------
ax : `matplotlib.axes.Axes` instance, optional
If `None`, then the current ``Axes`` instance is used.
marker : str, optional
The marker to use to mark the center of t... | [
"Plot",
"the",
"low",
"-",
"resolution",
"mesh",
"boxes",
"on",
"a",
"matplotlib",
"Axes",
"instance",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/background/background_2d.py#L798-L839 |
10,569 | astropy/photutils | photutils/isophote/sample.py | EllipseSample.extract | def extract(self):
"""
Extract sample data by scanning an elliptical path over the
image array.
Returns
-------
result : 2D `~numpy.ndarray`
The rows of the array contain the angles, radii, and
extracted intensity values, respectively.
"""... | python | def extract(self):
"""
Extract sample data by scanning an elliptical path over the
image array.
Returns
-------
result : 2D `~numpy.ndarray`
The rows of the array contain the angles, radii, and
extracted intensity values, respectively.
"""... | [
"def",
"extract",
"(",
"self",
")",
":",
"# the sample values themselves are kept cached to prevent",
"# multiple calls to the integrator code.",
"if",
"self",
".",
"values",
"is",
"not",
"None",
":",
"return",
"self",
".",
"values",
"else",
":",
"s",
"=",
"self",
"... | Extract sample data by scanning an elliptical path over the
image array.
Returns
-------
result : 2D `~numpy.ndarray`
The rows of the array contain the angles, radii, and
extracted intensity values, respectively. | [
"Extract",
"sample",
"data",
"by",
"scanning",
"an",
"elliptical",
"path",
"over",
"the",
"image",
"array",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/isophote/sample.py#L133-L152 |
10,570 | astropy/photutils | photutils/isophote/sample.py | EllipseSample.update | def update(self):
"""
Update this `~photutils.isophote.EllipseSample` instance.
This method calls the
:meth:`~photutils.isophote.EllipseSample.extract` method to get
the values that match the current ``geometry`` attribute, and
then computes the the mean intensity, local... | python | def update(self):
"""
Update this `~photutils.isophote.EllipseSample` instance.
This method calls the
:meth:`~photutils.isophote.EllipseSample.extract` method to get
the values that match the current ``geometry`` attribute, and
then computes the the mean intensity, local... | [
"def",
"update",
"(",
"self",
")",
":",
"step",
"=",
"self",
".",
"geometry",
".",
"astep",
"# Update the mean value first, using extraction from main sample.",
"s",
"=",
"self",
".",
"extract",
"(",
")",
"self",
".",
"mean",
"=",
"np",
".",
"mean",
"(",
"s"... | Update this `~photutils.isophote.EllipseSample` instance.
This method calls the
:meth:`~photutils.isophote.EllipseSample.extract` method to get
the values that match the current ``geometry`` attribute, and
then computes the the mean intensity, local gradient, and other
associate... | [
"Update",
"this",
"~photutils",
".",
"isophote",
".",
"EllipseSample",
"instance",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/isophote/sample.py#L279-L327 |
10,571 | astropy/photutils | photutils/isophote/fitter.py | EllipseFitter.fit | def fit(self, conver=DEFAULT_CONVERGENCE, minit=DEFAULT_MINIT,
maxit=DEFAULT_MAXIT, fflag=DEFAULT_FFLAG, maxgerr=DEFAULT_MAXGERR,
going_inwards=False):
"""
Fit an elliptical isophote.
Parameters
----------
conver : float, optional
The main con... | python | def fit(self, conver=DEFAULT_CONVERGENCE, minit=DEFAULT_MINIT,
maxit=DEFAULT_MAXIT, fflag=DEFAULT_FFLAG, maxgerr=DEFAULT_MAXGERR,
going_inwards=False):
"""
Fit an elliptical isophote.
Parameters
----------
conver : float, optional
The main con... | [
"def",
"fit",
"(",
"self",
",",
"conver",
"=",
"DEFAULT_CONVERGENCE",
",",
"minit",
"=",
"DEFAULT_MINIT",
",",
"maxit",
"=",
"DEFAULT_MAXIT",
",",
"fflag",
"=",
"DEFAULT_FFLAG",
",",
"maxgerr",
"=",
"DEFAULT_MAXGERR",
",",
"going_inwards",
"=",
"False",
")",
... | Fit an elliptical isophote.
Parameters
----------
conver : float, optional
The main convergence criterion. Iterations stop when the
largest harmonic amplitude becomes smaller (in absolute
value) than ``conver`` times the harmonic fit rms. The
def... | [
"Fit",
"an",
"elliptical",
"isophote",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/isophote/fitter.py#L41-L217 |
10,572 | astropy/photutils | photutils/psf/epsf_stars.py | _extract_stars | def _extract_stars(data, catalog, size=(11, 11), use_xy=True):
"""
Extract cutout images from a single image centered on stars defined
in the single input catalog.
Parameters
----------
data : `~astropy.nddata.NDData`
A `~astropy.nddata.NDData` object containing the 2D image from
... | python | def _extract_stars(data, catalog, size=(11, 11), use_xy=True):
"""
Extract cutout images from a single image centered on stars defined
in the single input catalog.
Parameters
----------
data : `~astropy.nddata.NDData`
A `~astropy.nddata.NDData` object containing the 2D image from
... | [
"def",
"_extract_stars",
"(",
"data",
",",
"catalog",
",",
"size",
"=",
"(",
"11",
",",
"11",
")",
",",
"use_xy",
"=",
"True",
")",
":",
"colnames",
"=",
"catalog",
".",
"colnames",
"if",
"(",
"'x'",
"not",
"in",
"colnames",
"or",
"'y'",
"not",
"in... | Extract cutout images from a single image centered on stars defined
in the single input catalog.
Parameters
----------
data : `~astropy.nddata.NDData`
A `~astropy.nddata.NDData` object containing the 2D image from
which to extract the stars. If the input ``catalog`` contains
on... | [
"Extract",
"cutout",
"images",
"from",
"a",
"single",
"image",
"centered",
"on",
"stars",
"defined",
"in",
"the",
"single",
"input",
"catalog",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/psf/epsf_stars.py#L687-L777 |
10,573 | astropy/photutils | photutils/psf/epsf_stars.py | EPSFStar.estimate_flux | def estimate_flux(self):
"""
Estimate the star's flux by summing values in the input cutout
array.
Missing data is filled in by interpolation to better estimate
the total flux.
"""
from .epsf import _interpolate_missing_data
if np.any(self.mask):
... | python | def estimate_flux(self):
"""
Estimate the star's flux by summing values in the input cutout
array.
Missing data is filled in by interpolation to better estimate
the total flux.
"""
from .epsf import _interpolate_missing_data
if np.any(self.mask):
... | [
"def",
"estimate_flux",
"(",
"self",
")",
":",
"from",
".",
"epsf",
"import",
"_interpolate_missing_data",
"if",
"np",
".",
"any",
"(",
"self",
".",
"mask",
")",
":",
"data_interp",
"=",
"_interpolate_missing_data",
"(",
"self",
".",
"data",
",",
"method",
... | Estimate the star's flux by summing values in the input cutout
array.
Missing data is filled in by interpolation to better estimate
the total flux. | [
"Estimate",
"the",
"star",
"s",
"flux",
"by",
"summing",
"values",
"in",
"the",
"input",
"cutout",
"array",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/psf/epsf_stars.py#L158-L180 |
10,574 | astropy/photutils | photutils/psf/epsf_stars.py | EPSFStar._xy_idx | def _xy_idx(self):
"""
1D arrays of x and y indices of unmasked pixels in the cutout
reference frame.
"""
yidx, xidx = np.indices(self._data.shape)
return xidx[~self.mask].ravel(), yidx[~self.mask].ravel() | python | def _xy_idx(self):
"""
1D arrays of x and y indices of unmasked pixels in the cutout
reference frame.
"""
yidx, xidx = np.indices(self._data.shape)
return xidx[~self.mask].ravel(), yidx[~self.mask].ravel() | [
"def",
"_xy_idx",
"(",
"self",
")",
":",
"yidx",
",",
"xidx",
"=",
"np",
".",
"indices",
"(",
"self",
".",
"_data",
".",
"shape",
")",
"return",
"xidx",
"[",
"~",
"self",
".",
"mask",
"]",
".",
"ravel",
"(",
")",
",",
"yidx",
"[",
"~",
"self",
... | 1D arrays of x and y indices of unmasked pixels in the cutout
reference frame. | [
"1D",
"arrays",
"of",
"x",
"and",
"y",
"indices",
"of",
"unmasked",
"pixels",
"in",
"the",
"cutout",
"reference",
"frame",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/psf/epsf_stars.py#L223-L230 |
10,575 | astropy/photutils | photutils/psf/groupstars.py | DAOGroup.find_group | def find_group(self, star, starlist):
"""
Find the ids of those stars in ``starlist`` which are at a
distance less than ``crit_separation`` from ``star``.
Parameters
----------
star : `~astropy.table.Row`
Star which will be either the head of a cluster or an
... | python | def find_group(self, star, starlist):
"""
Find the ids of those stars in ``starlist`` which are at a
distance less than ``crit_separation`` from ``star``.
Parameters
----------
star : `~astropy.table.Row`
Star which will be either the head of a cluster or an
... | [
"def",
"find_group",
"(",
"self",
",",
"star",
",",
"starlist",
")",
":",
"star_distance",
"=",
"np",
".",
"hypot",
"(",
"star",
"[",
"'x_0'",
"]",
"-",
"starlist",
"[",
"'x_0'",
"]",
",",
"star",
"[",
"'y_0'",
"]",
"-",
"starlist",
"[",
"'y_0'",
"... | Find the ids of those stars in ``starlist`` which are at a
distance less than ``crit_separation`` from ``star``.
Parameters
----------
star : `~astropy.table.Row`
Star which will be either the head of a cluster or an
isolated one.
starlist : `~astropy.tab... | [
"Find",
"the",
"ids",
"of",
"those",
"stars",
"in",
"starlist",
"which",
"are",
"at",
"a",
"distance",
"less",
"than",
"crit_separation",
"from",
"star",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/psf/groupstars.py#L152-L176 |
10,576 | astropy/photutils | photutils/aperture/bounding_box.py | BoundingBox._from_float | def _from_float(cls, xmin, xmax, ymin, ymax):
"""
Return the smallest bounding box that fully contains a given
rectangle defined by float coordinate values.
Following the pixel index convention, an integer index
corresponds to the center of a pixel and the pixel edges span
... | python | def _from_float(cls, xmin, xmax, ymin, ymax):
"""
Return the smallest bounding box that fully contains a given
rectangle defined by float coordinate values.
Following the pixel index convention, an integer index
corresponds to the center of a pixel and the pixel edges span
... | [
"def",
"_from_float",
"(",
"cls",
",",
"xmin",
",",
"xmax",
",",
"ymin",
",",
"ymax",
")",
":",
"ixmin",
"=",
"int",
"(",
"np",
".",
"floor",
"(",
"xmin",
"+",
"0.5",
")",
")",
"ixmax",
"=",
"int",
"(",
"np",
".",
"ceil",
"(",
"xmax",
"+",
"0... | Return the smallest bounding box that fully contains a given
rectangle defined by float coordinate values.
Following the pixel index convention, an integer index
corresponds to the center of a pixel and the pixel edges span
from (index - 0.5) to (index + 0.5). For example, the pixel
... | [
"Return",
"the",
"smallest",
"bounding",
"box",
"that",
"fully",
"contains",
"a",
"given",
"rectangle",
"defined",
"by",
"float",
"coordinate",
"values",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/aperture/bounding_box.py#L73-L119 |
10,577 | astropy/photutils | photutils/aperture/bounding_box.py | BoundingBox.slices | def slices(self):
"""
The bounding box as a tuple of `slice` objects.
The slice tuple is in numpy axis order (i.e. ``(y, x)``) and
therefore can be used to slice numpy arrays.
"""
return (slice(self.iymin, self.iymax), slice(self.ixmin, self.ixmax)) | python | def slices(self):
"""
The bounding box as a tuple of `slice` objects.
The slice tuple is in numpy axis order (i.e. ``(y, x)``) and
therefore can be used to slice numpy arrays.
"""
return (slice(self.iymin, self.iymax), slice(self.ixmin, self.ixmax)) | [
"def",
"slices",
"(",
"self",
")",
":",
"return",
"(",
"slice",
"(",
"self",
".",
"iymin",
",",
"self",
".",
"iymax",
")",
",",
"slice",
"(",
"self",
".",
"ixmin",
",",
"self",
".",
"ixmax",
")",
")"
] | The bounding box as a tuple of `slice` objects.
The slice tuple is in numpy axis order (i.e. ``(y, x)``) and
therefore can be used to slice numpy arrays. | [
"The",
"bounding",
"box",
"as",
"a",
"tuple",
"of",
"slice",
"objects",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/aperture/bounding_box.py#L149-L157 |
10,578 | astropy/photutils | photutils/aperture/bounding_box.py | BoundingBox.as_patch | def as_patch(self, **kwargs):
"""
Return a `matplotlib.patches.Rectangle` that represents the
bounding box.
Parameters
----------
kwargs
Any keyword arguments accepted by
`matplotlib.patches.Patch`.
Returns
-------
result ... | python | def as_patch(self, **kwargs):
"""
Return a `matplotlib.patches.Rectangle` that represents the
bounding box.
Parameters
----------
kwargs
Any keyword arguments accepted by
`matplotlib.patches.Patch`.
Returns
-------
result ... | [
"def",
"as_patch",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"matplotlib",
".",
"patches",
"import",
"Rectangle",
"return",
"Rectangle",
"(",
"xy",
"=",
"(",
"self",
".",
"extent",
"[",
"0",
"]",
",",
"self",
".",
"extent",
"[",
"2",
... | Return a `matplotlib.patches.Rectangle` that represents the
bounding box.
Parameters
----------
kwargs
Any keyword arguments accepted by
`matplotlib.patches.Patch`.
Returns
-------
result : `matplotlib.patches.Rectangle`
A mat... | [
"Return",
"a",
"matplotlib",
".",
"patches",
".",
"Rectangle",
"that",
"represents",
"the",
"bounding",
"box",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/aperture/bounding_box.py#L180-L216 |
10,579 | astropy/photutils | photutils/aperture/bounding_box.py | BoundingBox.to_aperture | def to_aperture(self):
"""
Return a `~photutils.aperture.RectangularAperture` that
represents the bounding box.
"""
from .rectangle import RectangularAperture
xpos = (self.extent[1] + self.extent[0]) / 2.
ypos = (self.extent[3] + self.extent[2]) / 2.
xyp... | python | def to_aperture(self):
"""
Return a `~photutils.aperture.RectangularAperture` that
represents the bounding box.
"""
from .rectangle import RectangularAperture
xpos = (self.extent[1] + self.extent[0]) / 2.
ypos = (self.extent[3] + self.extent[2]) / 2.
xyp... | [
"def",
"to_aperture",
"(",
"self",
")",
":",
"from",
".",
"rectangle",
"import",
"RectangularAperture",
"xpos",
"=",
"(",
"self",
".",
"extent",
"[",
"1",
"]",
"+",
"self",
".",
"extent",
"[",
"0",
"]",
")",
"/",
"2.",
"ypos",
"=",
"(",
"self",
"."... | Return a `~photutils.aperture.RectangularAperture` that
represents the bounding box. | [
"Return",
"a",
"~photutils",
".",
"aperture",
".",
"RectangularAperture",
"that",
"represents",
"the",
"bounding",
"box",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/aperture/bounding_box.py#L218-L231 |
10,580 | astropy/photutils | photutils/aperture/bounding_box.py | BoundingBox.plot | def plot(self, origin=(0, 0), ax=None, fill=False, **kwargs):
"""
Plot the `BoundingBox` on a matplotlib `~matplotlib.axes.Axes`
instance.
Parameters
----------
origin : array_like, optional
The ``(x, y)`` position of the origin of the displayed
i... | python | def plot(self, origin=(0, 0), ax=None, fill=False, **kwargs):
"""
Plot the `BoundingBox` on a matplotlib `~matplotlib.axes.Axes`
instance.
Parameters
----------
origin : array_like, optional
The ``(x, y)`` position of the origin of the displayed
i... | [
"def",
"plot",
"(",
"self",
",",
"origin",
"=",
"(",
"0",
",",
"0",
")",
",",
"ax",
"=",
"None",
",",
"fill",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"aper",
"=",
"self",
".",
"to_aperture",
"(",
")",
"aper",
".",
"plot",
"(",
"origi... | Plot the `BoundingBox` on a matplotlib `~matplotlib.axes.Axes`
instance.
Parameters
----------
origin : array_like, optional
The ``(x, y)`` position of the origin of the displayed
image.
ax : `matplotlib.axes.Axes` instance, optional
If `None... | [
"Plot",
"the",
"BoundingBox",
"on",
"a",
"matplotlib",
"~matplotlib",
".",
"axes",
".",
"Axes",
"instance",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/aperture/bounding_box.py#L233-L257 |
10,581 | astropy/photutils | photutils/detection/findstars.py | _find_stars | def _find_stars(data, kernel, threshold_eff, min_separation=None,
mask=None, exclude_border=False):
"""
Find stars in an image.
Parameters
----------
data : 2D array_like
The 2D array of the image.
kernel : `_StarFinderKernel`
The convolution kernel.
thresh... | python | def _find_stars(data, kernel, threshold_eff, min_separation=None,
mask=None, exclude_border=False):
"""
Find stars in an image.
Parameters
----------
data : 2D array_like
The 2D array of the image.
kernel : `_StarFinderKernel`
The convolution kernel.
thresh... | [
"def",
"_find_stars",
"(",
"data",
",",
"kernel",
",",
"threshold_eff",
",",
"min_separation",
"=",
"None",
",",
"mask",
"=",
"None",
",",
"exclude_border",
"=",
"False",
")",
":",
"convolved_data",
"=",
"filter_data",
"(",
"data",
",",
"kernel",
".",
"dat... | Find stars in an image.
Parameters
----------
data : 2D array_like
The 2D array of the image.
kernel : `_StarFinderKernel`
The convolution kernel.
threshold_eff : float
The absolute image value above which to select sources. This
threshold should be the threshold ... | [
"Find",
"stars",
"in",
"an",
"image",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/detection/findstars.py#L595-L704 |
10,582 | astropy/photutils | photutils/detection/findstars.py | _DAOFind_Properties.roundness2 | def roundness2(self):
"""
The star roundness.
This roundness parameter represents the ratio of the difference
in the height of the best fitting Gaussian function in x minus
the best fitting Gaussian function in y, divided by the average
of the best fitting Gaussian funct... | python | def roundness2(self):
"""
The star roundness.
This roundness parameter represents the ratio of the difference
in the height of the best fitting Gaussian function in x minus
the best fitting Gaussian function in y, divided by the average
of the best fitting Gaussian funct... | [
"def",
"roundness2",
"(",
"self",
")",
":",
"if",
"np",
".",
"isnan",
"(",
"self",
".",
"hx",
")",
"or",
"np",
".",
"isnan",
"(",
"self",
".",
"hy",
")",
":",
"return",
"np",
".",
"nan",
"else",
":",
"return",
"2.0",
"*",
"(",
"self",
".",
"h... | The star roundness.
This roundness parameter represents the ratio of the difference
in the height of the best fitting Gaussian function in x minus
the best fitting Gaussian function in y, divided by the average
of the best fitting Gaussian functions in x and y. A circular
sourc... | [
"The",
"star",
"roundness",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/detection/findstars.py#L426-L441 |
10,583 | astropy/photutils | photutils/segmentation/detect.py | detect_sources | def detect_sources(data, threshold, npixels, filter_kernel=None,
connectivity=8, mask=None):
"""
Detect sources above a specified threshold value in an image and
return a `~photutils.segmentation.SegmentationImage` object.
Detected sources must have ``npixels`` connected pixels that ... | python | def detect_sources(data, threshold, npixels, filter_kernel=None,
connectivity=8, mask=None):
"""
Detect sources above a specified threshold value in an image and
return a `~photutils.segmentation.SegmentationImage` object.
Detected sources must have ``npixels`` connected pixels that ... | [
"def",
"detect_sources",
"(",
"data",
",",
"threshold",
",",
"npixels",
",",
"filter_kernel",
"=",
"None",
",",
"connectivity",
"=",
"8",
",",
"mask",
"=",
"None",
")",
":",
"from",
"scipy",
"import",
"ndimage",
"if",
"(",
"npixels",
"<=",
"0",
")",
"o... | Detect sources above a specified threshold value in an image and
return a `~photutils.segmentation.SegmentationImage` object.
Detected sources must have ``npixels`` connected pixels that are
each greater than the ``threshold`` value. If the filtering option
is used, then the ``threshold`` is applied t... | [
"Detect",
"sources",
"above",
"a",
"specified",
"threshold",
"value",
"in",
"an",
"image",
"and",
"return",
"a",
"~photutils",
".",
"segmentation",
".",
"SegmentationImage",
"object",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/detect.py#L18-L167 |
10,584 | astropy/photutils | photutils/segmentation/detect.py | make_source_mask | def make_source_mask(data, snr, npixels, mask=None, mask_value=None,
filter_fwhm=None, filter_size=3, filter_kernel=None,
sigclip_sigma=3.0, sigclip_iters=5, dilate_size=11):
"""
Make a source mask using source segmentation and binary dilation.
Parameters
-----... | python | def make_source_mask(data, snr, npixels, mask=None, mask_value=None,
filter_fwhm=None, filter_size=3, filter_kernel=None,
sigclip_sigma=3.0, sigclip_iters=5, dilate_size=11):
"""
Make a source mask using source segmentation and binary dilation.
Parameters
-----... | [
"def",
"make_source_mask",
"(",
"data",
",",
"snr",
",",
"npixels",
",",
"mask",
"=",
"None",
",",
"mask_value",
"=",
"None",
",",
"filter_fwhm",
"=",
"None",
",",
"filter_size",
"=",
"3",
",",
"filter_kernel",
"=",
"None",
",",
"sigclip_sigma",
"=",
"3.... | Make a source mask using source segmentation and binary dilation.
Parameters
----------
data : array_like
The 2D array of the image.
snr : float
The signal-to-noise ratio per pixel above the ``background`` for
which to consider a pixel as possibly being part of a source.
n... | [
"Make",
"a",
"source",
"mask",
"using",
"source",
"segmentation",
"and",
"binary",
"dilation",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/detect.py#L170-L258 |
10,585 | astropy/photutils | photutils/segmentation/core.py | Segment.data_ma | def data_ma(self):
"""
A 2D `~numpy.ma.MaskedArray` cutout image of the segment using
the minimal bounding box.
The mask is `True` for pixels outside of the source segment
(i.e. neighboring segments within the rectangular cutout image
are masked).
"""
ma... | python | def data_ma(self):
"""
A 2D `~numpy.ma.MaskedArray` cutout image of the segment using
the minimal bounding box.
The mask is `True` for pixels outside of the source segment
(i.e. neighboring segments within the rectangular cutout image
are masked).
"""
ma... | [
"def",
"data_ma",
"(",
"self",
")",
":",
"mask",
"=",
"(",
"self",
".",
"_segment_img",
"[",
"self",
".",
"slices",
"]",
"!=",
"self",
".",
"label",
")",
"return",
"np",
".",
"ma",
".",
"masked_array",
"(",
"self",
".",
"_segment_img",
"[",
"self",
... | A 2D `~numpy.ma.MaskedArray` cutout image of the segment using
the minimal bounding box.
The mask is `True` for pixels outside of the source segment
(i.e. neighboring segments within the rectangular cutout image
are masked). | [
"A",
"2D",
"~numpy",
".",
"ma",
".",
"MaskedArray",
"cutout",
"image",
"of",
"the",
"segment",
"using",
"the",
"minimal",
"bounding",
"box",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/core.py#L85-L96 |
10,586 | astropy/photutils | photutils/segmentation/core.py | SegmentationImage._reset_lazy_properties | def _reset_lazy_properties(self):
"""Reset all lazy properties."""
for key, value in self.__class__.__dict__.items():
if isinstance(value, lazyproperty):
self.__dict__.pop(key, None) | python | def _reset_lazy_properties(self):
"""Reset all lazy properties."""
for key, value in self.__class__.__dict__.items():
if isinstance(value, lazyproperty):
self.__dict__.pop(key, None) | [
"def",
"_reset_lazy_properties",
"(",
"self",
")",
":",
"for",
"key",
",",
"value",
"in",
"self",
".",
"__class__",
".",
"__dict__",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"lazyproperty",
")",
":",
"self",
".",
"__dict__",
... | Reset all lazy properties. | [
"Reset",
"all",
"lazy",
"properties",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/core.py#L200-L205 |
10,587 | astropy/photutils | photutils/segmentation/core.py | SegmentationImage.segments | def segments(self):
"""
A list of `Segment` objects.
The list starts with the *non-zero* label. The returned list
has a length equal to the number of labels and matches the order
of the ``labels`` attribute.
"""
segments = []
for label, slc in zip(self.... | python | def segments(self):
"""
A list of `Segment` objects.
The list starts with the *non-zero* label. The returned list
has a length equal to the number of labels and matches the order
of the ``labels`` attribute.
"""
segments = []
for label, slc in zip(self.... | [
"def",
"segments",
"(",
"self",
")",
":",
"segments",
"=",
"[",
"]",
"for",
"label",
",",
"slc",
"in",
"zip",
"(",
"self",
".",
"labels",
",",
"self",
".",
"slices",
")",
":",
"segments",
".",
"append",
"(",
"Segment",
"(",
"self",
".",
"data",
"... | A list of `Segment` objects.
The list starts with the *non-zero* label. The returned list
has a length equal to the number of labels and matches the order
of the ``labels`` attribute. | [
"A",
"list",
"of",
"Segment",
"objects",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/core.py#L258-L271 |
10,588 | astropy/photutils | photutils/segmentation/core.py | SegmentationImage.get_index | def get_index(self, label):
"""
Find the index of the input ``label``.
Parameters
----------
labels : int
The label numbers to find.
Returns
-------
index : int
The array index.
Raises
------
ValueError
... | python | def get_index(self, label):
"""
Find the index of the input ``label``.
Parameters
----------
labels : int
The label numbers to find.
Returns
-------
index : int
The array index.
Raises
------
ValueError
... | [
"def",
"get_index",
"(",
"self",
",",
"label",
")",
":",
"self",
".",
"check_labels",
"(",
"label",
")",
"return",
"np",
".",
"searchsorted",
"(",
"self",
".",
"labels",
",",
"label",
")"
] | Find the index of the input ``label``.
Parameters
----------
labels : int
The label numbers to find.
Returns
-------
index : int
The array index.
Raises
------
ValueError
If ``label`` is invalid. | [
"Find",
"the",
"index",
"of",
"the",
"input",
"label",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/core.py#L333-L354 |
10,589 | astropy/photutils | photutils/segmentation/core.py | SegmentationImage.get_indices | def get_indices(self, labels):
"""
Find the indices of the input ``labels``.
Parameters
----------
labels : int, array-like (1D, int)
The label numbers(s) to find.
Returns
-------
indices : int `~numpy.ndarray`
An integer array of... | python | def get_indices(self, labels):
"""
Find the indices of the input ``labels``.
Parameters
----------
labels : int, array-like (1D, int)
The label numbers(s) to find.
Returns
-------
indices : int `~numpy.ndarray`
An integer array of... | [
"def",
"get_indices",
"(",
"self",
",",
"labels",
")",
":",
"self",
".",
"check_labels",
"(",
"labels",
")",
"return",
"np",
".",
"searchsorted",
"(",
"self",
".",
"labels",
",",
"labels",
")"
] | Find the indices of the input ``labels``.
Parameters
----------
labels : int, array-like (1D, int)
The label numbers(s) to find.
Returns
-------
indices : int `~numpy.ndarray`
An integer array of indices with the same shape as
``label... | [
"Find",
"the",
"indices",
"of",
"the",
"input",
"labels",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/core.py#L356-L379 |
10,590 | astropy/photutils | photutils/segmentation/core.py | SegmentationImage.slices | def slices(self):
"""
A list of tuples, where each tuple contains two slices
representing the minimal box that contains the labeled region.
The list starts with the *non-zero* label. The returned list
has a length equal to the number of labels and matches the order
of t... | python | def slices(self):
"""
A list of tuples, where each tuple contains two slices
representing the minimal box that contains the labeled region.
The list starts with the *non-zero* label. The returned list
has a length equal to the number of labels and matches the order
of t... | [
"def",
"slices",
"(",
"self",
")",
":",
"from",
"scipy",
".",
"ndimage",
"import",
"find_objects",
"return",
"[",
"slc",
"for",
"slc",
"in",
"find_objects",
"(",
"self",
".",
"_data",
")",
"if",
"slc",
"is",
"not",
"None",
"]"
] | A list of tuples, where each tuple contains two slices
representing the minimal box that contains the labeled region.
The list starts with the *non-zero* label. The returned list
has a length equal to the number of labels and matches the order
of the ``labels`` attribute. | [
"A",
"list",
"of",
"tuples",
"where",
"each",
"tuple",
"contains",
"two",
"slices",
"representing",
"the",
"minimal",
"box",
"that",
"contains",
"the",
"labeled",
"region",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/core.py#L382-L394 |
10,591 | astropy/photutils | photutils/segmentation/core.py | SegmentationImage.missing_labels | def missing_labels(self):
"""
A 1D `~numpy.ndarray` of the sorted non-zero labels that are
missing in the consecutive sequence from zero to the maximum
label number.
"""
return np.array(sorted(set(range(0, self.max_label + 1)).
difference(n... | python | def missing_labels(self):
"""
A 1D `~numpy.ndarray` of the sorted non-zero labels that are
missing in the consecutive sequence from zero to the maximum
label number.
"""
return np.array(sorted(set(range(0, self.max_label + 1)).
difference(n... | [
"def",
"missing_labels",
"(",
"self",
")",
":",
"return",
"np",
".",
"array",
"(",
"sorted",
"(",
"set",
"(",
"range",
"(",
"0",
",",
"self",
".",
"max_label",
"+",
"1",
")",
")",
".",
"difference",
"(",
"np",
".",
"insert",
"(",
"self",
".",
"la... | A 1D `~numpy.ndarray` of the sorted non-zero labels that are
missing in the consecutive sequence from zero to the maximum
label number. | [
"A",
"1D",
"~numpy",
".",
"ndarray",
"of",
"the",
"sorted",
"non",
"-",
"zero",
"labels",
"that",
"are",
"missing",
"in",
"the",
"consecutive",
"sequence",
"from",
"zero",
"to",
"the",
"maximum",
"label",
"number",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/core.py#L466-L474 |
10,592 | astropy/photutils | photutils/segmentation/core.py | SegmentationImage.reassign_label | def reassign_label(self, label, new_label, relabel=False):
"""
Reassign a label number to a new number.
If ``new_label`` is already present in the segmentation image,
then it will be combined with the input ``label`` number.
Parameters
----------
labels : int
... | python | def reassign_label(self, label, new_label, relabel=False):
"""
Reassign a label number to a new number.
If ``new_label`` is already present in the segmentation image,
then it will be combined with the input ``label`` number.
Parameters
----------
labels : int
... | [
"def",
"reassign_label",
"(",
"self",
",",
"label",
",",
"new_label",
",",
"relabel",
"=",
"False",
")",
":",
"self",
".",
"reassign_labels",
"(",
"label",
",",
"new_label",
",",
"relabel",
"=",
"relabel",
")"
] | Reassign a label number to a new number.
If ``new_label`` is already present in the segmentation image,
then it will be combined with the input ``label`` number.
Parameters
----------
labels : int
The label number to reassign.
new_label : int
Th... | [
"Reassign",
"a",
"label",
"number",
"to",
"a",
"new",
"number",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/core.py#L611-L680 |
10,593 | astropy/photutils | photutils/segmentation/core.py | SegmentationImage.reassign_labels | def reassign_labels(self, labels, new_label, relabel=False):
"""
Reassign one or more label numbers.
Multiple input ``labels`` will all be reassigned to the same
``new_label`` number. If ``new_label`` is already present in
the segmentation image, then it will be combined with t... | python | def reassign_labels(self, labels, new_label, relabel=False):
"""
Reassign one or more label numbers.
Multiple input ``labels`` will all be reassigned to the same
``new_label`` number. If ``new_label`` is already present in
the segmentation image, then it will be combined with t... | [
"def",
"reassign_labels",
"(",
"self",
",",
"labels",
",",
"new_label",
",",
"relabel",
"=",
"False",
")",
":",
"self",
".",
"check_labels",
"(",
"labels",
")",
"labels",
"=",
"np",
".",
"atleast_1d",
"(",
"labels",
")",
"if",
"len",
"(",
"labels",
")"... | Reassign one or more label numbers.
Multiple input ``labels`` will all be reassigned to the same
``new_label`` number. If ``new_label`` is already present in
the segmentation image, then it will be combined with the input
``labels``.
Parameters
----------
label... | [
"Reassign",
"one",
"or",
"more",
"label",
"numbers",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/core.py#L682-L767 |
10,594 | astropy/photutils | photutils/segmentation/core.py | SegmentationImage.relabel_consecutive | def relabel_consecutive(self, start_label=1):
"""
Reassign the label numbers consecutively, such that there are no
missing label numbers.
Parameters
----------
start_label : int, optional
The starting label number, which should be a positive
integ... | python | def relabel_consecutive(self, start_label=1):
"""
Reassign the label numbers consecutively, such that there are no
missing label numbers.
Parameters
----------
start_label : int, optional
The starting label number, which should be a positive
integ... | [
"def",
"relabel_consecutive",
"(",
"self",
",",
"start_label",
"=",
"1",
")",
":",
"if",
"start_label",
"<=",
"0",
":",
"raise",
"ValueError",
"(",
"'start_label must be > 0.'",
")",
"if",
"self",
".",
"is_consecutive",
"and",
"(",
"self",
".",
"labels",
"["... | Reassign the label numbers consecutively, such that there are no
missing label numbers.
Parameters
----------
start_label : int, optional
The starting label number, which should be a positive
integer. The default is 1.
Examples
--------
... | [
"Reassign",
"the",
"label",
"numbers",
"consecutively",
"such",
"that",
"there",
"are",
"no",
"missing",
"label",
"numbers",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/core.py#L769-L807 |
10,595 | astropy/photutils | photutils/segmentation/core.py | SegmentationImage.keep_label | def keep_label(self, label, relabel=False):
"""
Keep only the specified label.
Parameters
----------
label : int
The label number to keep.
relabel : bool, optional
If `True`, then the single segment will be assigned a label
value of 1... | python | def keep_label(self, label, relabel=False):
"""
Keep only the specified label.
Parameters
----------
label : int
The label number to keep.
relabel : bool, optional
If `True`, then the single segment will be assigned a label
value of 1... | [
"def",
"keep_label",
"(",
"self",
",",
"label",
",",
"relabel",
"=",
"False",
")",
":",
"self",
".",
"keep_labels",
"(",
"label",
",",
"relabel",
"=",
"relabel",
")"
] | Keep only the specified label.
Parameters
----------
label : int
The label number to keep.
relabel : bool, optional
If `True`, then the single segment will be assigned a label
value of 1.
Examples
--------
>>> from photutils ... | [
"Keep",
"only",
"the",
"specified",
"label",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/core.py#L809-L856 |
10,596 | astropy/photutils | photutils/segmentation/core.py | SegmentationImage.keep_labels | def keep_labels(self, labels, relabel=False):
"""
Keep only the specified labels.
Parameters
----------
labels : int, array-like (1D, int)
The label number(s) to keep.
relabel : bool, optional
If `True`, then the segmentation image will be relabe... | python | def keep_labels(self, labels, relabel=False):
"""
Keep only the specified labels.
Parameters
----------
labels : int, array-like (1D, int)
The label number(s) to keep.
relabel : bool, optional
If `True`, then the segmentation image will be relabe... | [
"def",
"keep_labels",
"(",
"self",
",",
"labels",
",",
"relabel",
"=",
"False",
")",
":",
"self",
".",
"check_labels",
"(",
"labels",
")",
"labels",
"=",
"np",
".",
"atleast_1d",
"(",
"labels",
")",
"labels_tmp",
"=",
"list",
"(",
"set",
"(",
"self",
... | Keep only the specified labels.
Parameters
----------
labels : int, array-like (1D, int)
The label number(s) to keep.
relabel : bool, optional
If `True`, then the segmentation image will be relabeled
such that the labels are in consecutive order star... | [
"Keep",
"only",
"the",
"specified",
"labels",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/core.py#L858-L910 |
10,597 | astropy/photutils | photutils/segmentation/core.py | SegmentationImage.remove_label | def remove_label(self, label, relabel=False):
"""
Remove the label number.
The removed label is assigned a value of zero (i.e.,
background).
Parameters
----------
label : int
The label number to remove.
relabel : bool, optional
I... | python | def remove_label(self, label, relabel=False):
"""
Remove the label number.
The removed label is assigned a value of zero (i.e.,
background).
Parameters
----------
label : int
The label number to remove.
relabel : bool, optional
I... | [
"def",
"remove_label",
"(",
"self",
",",
"label",
",",
"relabel",
"=",
"False",
")",
":",
"self",
".",
"remove_labels",
"(",
"label",
",",
"relabel",
"=",
"relabel",
")"
] | Remove the label number.
The removed label is assigned a value of zero (i.e.,
background).
Parameters
----------
label : int
The label number to remove.
relabel : bool, optional
If `True`, then the segmentation image will be relabeled
... | [
"Remove",
"the",
"label",
"number",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/core.py#L912-L963 |
10,598 | astropy/photutils | photutils/segmentation/core.py | SegmentationImage.remove_labels | def remove_labels(self, labels, relabel=False):
"""
Remove one or more labels.
Removed labels are assigned a value of zero (i.e., background).
Parameters
----------
labels : int, array-like (1D, int)
The label number(s) to remove.
relabel : bool, op... | python | def remove_labels(self, labels, relabel=False):
"""
Remove one or more labels.
Removed labels are assigned a value of zero (i.e., background).
Parameters
----------
labels : int, array-like (1D, int)
The label number(s) to remove.
relabel : bool, op... | [
"def",
"remove_labels",
"(",
"self",
",",
"labels",
",",
"relabel",
"=",
"False",
")",
":",
"self",
".",
"check_labels",
"(",
"labels",
")",
"self",
".",
"reassign_label",
"(",
"labels",
",",
"new_label",
"=",
"0",
")",
"if",
"relabel",
":",
"self",
".... | Remove one or more labels.
Removed labels are assigned a value of zero (i.e., background).
Parameters
----------
labels : int, array-like (1D, int)
The label number(s) to remove.
relabel : bool, optional
If `True`, then the segmentation image will be re... | [
"Remove",
"one",
"or",
"more",
"labels",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/core.py#L965-L1019 |
10,599 | astropy/photutils | photutils/segmentation/core.py | SegmentationImage.remove_border_labels | def remove_border_labels(self, border_width, partial_overlap=True,
relabel=False):
"""
Remove labeled segments near the image border.
Labels within the defined border region will be removed.
Parameters
----------
border_width : int
... | python | def remove_border_labels(self, border_width, partial_overlap=True,
relabel=False):
"""
Remove labeled segments near the image border.
Labels within the defined border region will be removed.
Parameters
----------
border_width : int
... | [
"def",
"remove_border_labels",
"(",
"self",
",",
"border_width",
",",
"partial_overlap",
"=",
"True",
",",
"relabel",
"=",
"False",
")",
":",
"if",
"border_width",
">=",
"min",
"(",
"self",
".",
"shape",
")",
"/",
"2",
":",
"raise",
"ValueError",
"(",
"'... | Remove labeled segments near the image border.
Labels within the defined border region will be removed.
Parameters
----------
border_width : int
The width of the border region in pixels.
partial_overlap : bool, optional
If this is set to `True` (the def... | [
"Remove",
"labeled",
"segments",
"near",
"the",
"image",
"border",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/core.py#L1021-L1088 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.