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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
astropy/photutils | photutils/segmentation/core.py | SegmentationImage.remove_masked_labels | def remove_masked_labels(self, mask, partial_overlap=True,
relabel=False):
"""
Remove labeled segments located within a masked region.
Parameters
----------
mask : array_like (bool)
A boolean mask, with the same shape as the segmentation
... | python | def remove_masked_labels(self, mask, partial_overlap=True,
relabel=False):
"""
Remove labeled segments located within a masked region.
Parameters
----------
mask : array_like (bool)
A boolean mask, with the same shape as the segmentation
... | [
"def",
"remove_masked_labels",
"(",
"self",
",",
"mask",
",",
"partial_overlap",
"=",
"True",
",",
"relabel",
"=",
"False",
")",
":",
"if",
"mask",
".",
"shape",
"!=",
"self",
".",
"shape",
":",
"raise",
"ValueError",
"(",
"'mask must have the same shape as th... | Remove labeled segments located within a masked region.
Parameters
----------
mask : array_like (bool)
A boolean mask, with the same shape as the segmentation
image, where `True` values indicate masked pixels.
partial_overlap : bool, optional
If this... | [
"Remove",
"labeled",
"segments",
"located",
"within",
"a",
"masked",
"region",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/core.py#L1090-L1155 | train |
astropy/photutils | photutils/segmentation/core.py | SegmentationImage.outline_segments | def outline_segments(self, mask_background=False):
"""
Outline the labeled segments.
The "outlines" represent the pixels *just inside* the segments,
leaving the background pixels unmodified.
Parameters
----------
mask_background : bool, optional
Set ... | python | def outline_segments(self, mask_background=False):
"""
Outline the labeled segments.
The "outlines" represent the pixels *just inside* the segments,
leaving the background pixels unmodified.
Parameters
----------
mask_background : bool, optional
Set ... | [
"def",
"outline_segments",
"(",
"self",
",",
"mask_background",
"=",
"False",
")",
":",
"from",
"scipy",
".",
"ndimage",
"import",
"grey_erosion",
",",
"grey_dilation",
"# mode='constant' ensures outline is included on the image borders",
"selem",
"=",
"np",
".",
"array... | Outline the labeled segments.
The "outlines" represent the pixels *just inside* the segments,
leaving the background pixels unmodified.
Parameters
----------
mask_background : bool, optional
Set to `True` to mask the background pixels (labels = 0) in
the... | [
"Outline",
"the",
"labeled",
"segments",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/core.py#L1157-L1213 | train |
astropy/photutils | photutils/aperture/mask.py | ApertureMask._overlap_slices | def _overlap_slices(self, shape):
"""
Calculate the slices for the overlapping part of the bounding
box and an array of the given shape.
Parameters
----------
shape : tuple of int
The ``(ny, nx)`` shape of array where the slices are to be
applied.... | python | def _overlap_slices(self, shape):
"""
Calculate the slices for the overlapping part of the bounding
box and an array of the given shape.
Parameters
----------
shape : tuple of int
The ``(ny, nx)`` shape of array where the slices are to be
applied.... | [
"def",
"_overlap_slices",
"(",
"self",
",",
"shape",
")",
":",
"if",
"len",
"(",
"shape",
")",
"!=",
"2",
":",
"raise",
"ValueError",
"(",
"'input shape must have 2 elements.'",
")",
"xmin",
"=",
"self",
".",
"bbox",
".",
"ixmin",
"xmax",
"=",
"self",
".... | Calculate the slices for the overlapping part of the bounding
box and an array of the given shape.
Parameters
----------
shape : tuple of int
The ``(ny, nx)`` shape of array where the slices are to be
applied.
Returns
-------
slices_large... | [
"Calculate",
"the",
"slices",
"for",
"the",
"overlapping",
"part",
"of",
"the",
"bounding",
"box",
"and",
"an",
"array",
"of",
"the",
"given",
"shape",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/aperture/mask.py#L49-L93 | train |
astropy/photutils | photutils/aperture/mask.py | ApertureMask.to_image | def to_image(self, shape):
"""
Return an image of the mask in a 2D array of the given shape,
taking any edge effects into account.
Parameters
----------
shape : tuple of int
The ``(ny, nx)`` shape of the output array.
Returns
-------
... | python | def to_image(self, shape):
"""
Return an image of the mask in a 2D array of the given shape,
taking any edge effects into account.
Parameters
----------
shape : tuple of int
The ``(ny, nx)`` shape of the output array.
Returns
-------
... | [
"def",
"to_image",
"(",
"self",
",",
"shape",
")",
":",
"if",
"len",
"(",
"shape",
")",
"!=",
"2",
":",
"raise",
"ValueError",
"(",
"'input shape must have 2 elements.'",
")",
"image",
"=",
"np",
".",
"zeros",
"(",
"shape",
")",
"if",
"self",
".",
"bbo... | Return an image of the mask in a 2D array of the given shape,
taking any edge effects into account.
Parameters
----------
shape : tuple of int
The ``(ny, nx)`` shape of the output array.
Returns
-------
result : `~numpy.ndarray`
A 2D arra... | [
"Return",
"an",
"image",
"of",
"the",
"mask",
"in",
"a",
"2D",
"array",
"of",
"the",
"given",
"shape",
"taking",
"any",
"edge",
"effects",
"into",
"account",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/aperture/mask.py#L112-L141 | train |
astropy/photutils | photutils/aperture/mask.py | ApertureMask.cutout | def cutout(self, data, fill_value=0., copy=False):
"""
Create a cutout from the input data over the mask bounding box,
taking any edge effects into account.
Parameters
----------
data : array_like
A 2D array on which to apply the aperture mask.
fill_... | python | def cutout(self, data, fill_value=0., copy=False):
"""
Create a cutout from the input data over the mask bounding box,
taking any edge effects into account.
Parameters
----------
data : array_like
A 2D array on which to apply the aperture mask.
fill_... | [
"def",
"cutout",
"(",
"self",
",",
"data",
",",
"fill_value",
"=",
"0.",
",",
"copy",
"=",
"False",
")",
":",
"data",
"=",
"np",
".",
"asanyarray",
"(",
"data",
")",
"if",
"data",
".",
"ndim",
"!=",
"2",
":",
"raise",
"ValueError",
"(",
"'data must... | Create a cutout from the input data over the mask bounding box,
taking any edge effects into account.
Parameters
----------
data : array_like
A 2D array on which to apply the aperture mask.
fill_value : float, optional
The value is used to fill pixels wh... | [
"Create",
"a",
"cutout",
"from",
"the",
"input",
"data",
"over",
"the",
"mask",
"bounding",
"box",
"taking",
"any",
"edge",
"effects",
"into",
"account",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/aperture/mask.py#L143-L208 | train |
astropy/photutils | photutils/aperture/mask.py | ApertureMask.multiply | def multiply(self, data, fill_value=0.):
"""
Multiply the aperture mask with the input data, taking any edge
effects into account.
The result is a mask-weighted cutout from the data.
Parameters
----------
data : array_like or `~astropy.units.Quantity`
... | python | def multiply(self, data, fill_value=0.):
"""
Multiply the aperture mask with the input data, taking any edge
effects into account.
The result is a mask-weighted cutout from the data.
Parameters
----------
data : array_like or `~astropy.units.Quantity`
... | [
"def",
"multiply",
"(",
"self",
",",
"data",
",",
"fill_value",
"=",
"0.",
")",
":",
"cutout",
"=",
"self",
".",
"cutout",
"(",
"data",
",",
"fill_value",
"=",
"fill_value",
")",
"if",
"cutout",
"is",
"None",
":",
"return",
"None",
"else",
":",
"retu... | Multiply the aperture mask with the input data, taking any edge
effects into account.
The result is a mask-weighted cutout from the data.
Parameters
----------
data : array_like or `~astropy.units.Quantity`
The 2D array to multiply with the aperture mask.
f... | [
"Multiply",
"the",
"aperture",
"mask",
"with",
"the",
"input",
"data",
"taking",
"any",
"edge",
"effects",
"into",
"account",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/aperture/mask.py#L210-L241 | train |
astropy/photutils | photutils/segmentation/deblend.py | deblend_sources | def deblend_sources(data, segment_img, npixels, filter_kernel=None,
labels=None, nlevels=32, contrast=0.001,
mode='exponential', connectivity=8, relabel=True):
"""
Deblend overlapping sources labeled in a segmentation image.
Sources are deblended using a combination ... | python | def deblend_sources(data, segment_img, npixels, filter_kernel=None,
labels=None, nlevels=32, contrast=0.001,
mode='exponential', connectivity=8, relabel=True):
"""
Deblend overlapping sources labeled in a segmentation image.
Sources are deblended using a combination ... | [
"def",
"deblend_sources",
"(",
"data",
",",
"segment_img",
",",
"npixels",
",",
"filter_kernel",
"=",
"None",
",",
"labels",
"=",
"None",
",",
"nlevels",
"=",
"32",
",",
"contrast",
"=",
"0.001",
",",
"mode",
"=",
"'exponential'",
",",
"connectivity",
"=",... | Deblend overlapping sources labeled in a segmentation image.
Sources are deblended using a combination of multi-thresholding and
`watershed segmentation
<https://en.wikipedia.org/wiki/Watershed_(image_processing)>`_. In
order to deblend sources, they must be separated enough such that
there is a s... | [
"Deblend",
"overlapping",
"sources",
"labeled",
"in",
"a",
"segmentation",
"image",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/deblend.py#L18-L147 | train |
astropy/photutils | photutils/utils/_moments.py | _moments_central | def _moments_central(data, center=None, order=1):
"""
Calculate the central image moments up to the specified order.
Parameters
----------
data : 2D array-like
The input 2D array.
center : tuple of two floats or `None`, optional
The ``(x, y)`` center position. If `None` it wil... | python | def _moments_central(data, center=None, order=1):
"""
Calculate the central image moments up to the specified order.
Parameters
----------
data : 2D array-like
The input 2D array.
center : tuple of two floats or `None`, optional
The ``(x, y)`` center position. If `None` it wil... | [
"def",
"_moments_central",
"(",
"data",
",",
"center",
"=",
"None",
",",
"order",
"=",
"1",
")",
":",
"data",
"=",
"np",
".",
"asarray",
"(",
"data",
")",
".",
"astype",
"(",
"float",
")",
"if",
"data",
".",
"ndim",
"!=",
"2",
":",
"raise",
"Valu... | Calculate the central image moments up to the specified order.
Parameters
----------
data : 2D array-like
The input 2D array.
center : tuple of two floats or `None`, optional
The ``(x, y)`` center position. If `None` it will calculated as
the "center of mass" of the input ``da... | [
"Calculate",
"the",
"central",
"image",
"moments",
"up",
"to",
"the",
"specified",
"order",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/utils/_moments.py#L9-L44 | train |
astropy/photutils | photutils/isophote/harmonics.py | first_and_second_harmonic_function | def first_and_second_harmonic_function(phi, c):
"""
Compute the harmonic function value used to calculate the
corrections for ellipse fitting.
This function includes simultaneously both the first and second
order harmonics:
.. math::
f(phi) = c[0] + c[1]*\\sin(phi) + c[2]*\\cos(phi) +... | python | def first_and_second_harmonic_function(phi, c):
"""
Compute the harmonic function value used to calculate the
corrections for ellipse fitting.
This function includes simultaneously both the first and second
order harmonics:
.. math::
f(phi) = c[0] + c[1]*\\sin(phi) + c[2]*\\cos(phi) +... | [
"def",
"first_and_second_harmonic_function",
"(",
"phi",
",",
"c",
")",
":",
"return",
"(",
"c",
"[",
"0",
"]",
"+",
"c",
"[",
"1",
"]",
"*",
"np",
".",
"sin",
"(",
"phi",
")",
"+",
"c",
"[",
"2",
"]",
"*",
"np",
".",
"cos",
"(",
"phi",
")",
... | Compute the harmonic function value used to calculate the
corrections for ellipse fitting.
This function includes simultaneously both the first and second
order harmonics:
.. math::
f(phi) = c[0] + c[1]*\\sin(phi) + c[2]*\\cos(phi) +
c[3]*\\sin(2*phi) + c[4]*\\cos(2*phi)
... | [
"Compute",
"the",
"harmonic",
"function",
"value",
"used",
"to",
"calculate",
"the",
"corrections",
"for",
"ellipse",
"fitting",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/isophote/harmonics.py#L23-L53 | train |
astropy/photutils | photutils/psf/matching/windows.py | _radial_distance | def _radial_distance(shape):
"""
Return an array where each value is the Euclidean distance from the
array center.
Parameters
----------
shape : tuple of int
The size of the output array along each axis.
Returns
-------
result : `~numpy.ndarray`
An array containing ... | python | def _radial_distance(shape):
"""
Return an array where each value is the Euclidean distance from the
array center.
Parameters
----------
shape : tuple of int
The size of the output array along each axis.
Returns
-------
result : `~numpy.ndarray`
An array containing ... | [
"def",
"_radial_distance",
"(",
"shape",
")",
":",
"if",
"len",
"(",
"shape",
")",
"!=",
"2",
":",
"raise",
"ValueError",
"(",
"'shape must have only 2 elements'",
")",
"position",
"=",
"(",
"np",
".",
"asarray",
"(",
"shape",
")",
"-",
"1",
")",
"/",
... | Return an array where each value is the Euclidean distance from the
array center.
Parameters
----------
shape : tuple of int
The size of the output array along each axis.
Returns
-------
result : `~numpy.ndarray`
An array containing the Euclidian radial distances from the
... | [
"Return",
"an",
"array",
"where",
"each",
"value",
"is",
"the",
"Euclidean",
"distance",
"from",
"the",
"array",
"center",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/psf/matching/windows.py#L13-L36 | train |
astropy/photutils | photutils/datasets/load.py | load_spitzer_image | def load_spitzer_image(show_progress=False): # pragma: no cover
"""
Load a 4.5 micron Spitzer image.
The catalog for this image is returned by
:func:`load_spitzer_catalog`.
Parameters
----------
show_progress : bool, optional
Whether to display a progress bar during the download... | python | def load_spitzer_image(show_progress=False): # pragma: no cover
"""
Load a 4.5 micron Spitzer image.
The catalog for this image is returned by
:func:`load_spitzer_catalog`.
Parameters
----------
show_progress : bool, optional
Whether to display a progress bar during the download... | [
"def",
"load_spitzer_image",
"(",
"show_progress",
"=",
"False",
")",
":",
"# pragma: no cover",
"path",
"=",
"get_path",
"(",
"'spitzer_example_image.fits'",
",",
"location",
"=",
"'remote'",
",",
"show_progress",
"=",
"show_progress",
")",
"hdu",
"=",
"fits",
".... | Load a 4.5 micron Spitzer image.
The catalog for this image is returned by
:func:`load_spitzer_catalog`.
Parameters
----------
show_progress : bool, optional
Whether to display a progress bar during the download (default
is `False`).
Returns
-------
hdu : `~astropy.io.... | [
"Load",
"a",
"4",
".",
"5",
"micron",
"Spitzer",
"image",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/datasets/load.py#L73-L109 | train |
astropy/photutils | photutils/datasets/load.py | load_spitzer_catalog | def load_spitzer_catalog(show_progress=False): # pragma: no cover
"""
Load a 4.5 micron Spitzer catalog.
The image from which this catalog was derived is returned by
:func:`load_spitzer_image`.
Parameters
----------
show_progress : bool, optional
Whether to display a progress ba... | python | def load_spitzer_catalog(show_progress=False): # pragma: no cover
"""
Load a 4.5 micron Spitzer catalog.
The image from which this catalog was derived is returned by
:func:`load_spitzer_image`.
Parameters
----------
show_progress : bool, optional
Whether to display a progress ba... | [
"def",
"load_spitzer_catalog",
"(",
"show_progress",
"=",
"False",
")",
":",
"# pragma: no cover",
"path",
"=",
"get_path",
"(",
"'spitzer_example_catalog.xml'",
",",
"location",
"=",
"'remote'",
",",
"show_progress",
"=",
"show_progress",
")",
"table",
"=",
"Table"... | Load a 4.5 micron Spitzer catalog.
The image from which this catalog was derived is returned by
:func:`load_spitzer_image`.
Parameters
----------
show_progress : bool, optional
Whether to display a progress bar during the download (default
is `False`).
Returns
-------
... | [
"Load",
"a",
"4",
".",
"5",
"micron",
"Spitzer",
"catalog",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/datasets/load.py#L112-L152 | train |
astropy/photutils | photutils/datasets/load.py | load_irac_psf | def load_irac_psf(channel, show_progress=False): # pragma: no cover
"""
Load a Spitzer IRAC PSF image.
Parameters
----------
channel : int (1-4)
The IRAC channel number:
* Channel 1: 3.6 microns
* Channel 2: 4.5 microns
* Channel 3: 5.8 microns
... | python | def load_irac_psf(channel, show_progress=False): # pragma: no cover
"""
Load a Spitzer IRAC PSF image.
Parameters
----------
channel : int (1-4)
The IRAC channel number:
* Channel 1: 3.6 microns
* Channel 2: 4.5 microns
* Channel 3: 5.8 microns
... | [
"def",
"load_irac_psf",
"(",
"channel",
",",
"show_progress",
"=",
"False",
")",
":",
"# pragma: no cover",
"channel",
"=",
"int",
"(",
"channel",
")",
"if",
"channel",
"<",
"1",
"or",
"channel",
">",
"4",
":",
"raise",
"ValueError",
"(",
"'channel must be 1... | Load a Spitzer IRAC PSF image.
Parameters
----------
channel : int (1-4)
The IRAC channel number:
* Channel 1: 3.6 microns
* Channel 2: 4.5 microns
* Channel 3: 5.8 microns
* Channel 4: 8.0 microns
show_progress : bool, optional
Whether to d... | [
"Load",
"a",
"Spitzer",
"IRAC",
"PSF",
"image",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/datasets/load.py#L155-L217 | train |
astropy/photutils | photutils/isophote/ellipse.py | Ellipse.fit_image | def fit_image(self, sma0=None, minsma=0., maxsma=None, step=0.1,
conver=DEFAULT_CONVERGENCE, minit=DEFAULT_MINIT,
maxit=DEFAULT_MAXIT, fflag=DEFAULT_FFLAG,
maxgerr=DEFAULT_MAXGERR, sclip=3., nclip=0,
integrmode=BILINEAR, linear=False, maxrit=None):... | python | def fit_image(self, sma0=None, minsma=0., maxsma=None, step=0.1,
conver=DEFAULT_CONVERGENCE, minit=DEFAULT_MINIT,
maxit=DEFAULT_MAXIT, fflag=DEFAULT_FFLAG,
maxgerr=DEFAULT_MAXGERR, sclip=3., nclip=0,
integrmode=BILINEAR, linear=False, maxrit=None):... | [
"def",
"fit_image",
"(",
"self",
",",
"sma0",
"=",
"None",
",",
"minsma",
"=",
"0.",
",",
"maxsma",
"=",
"None",
",",
"step",
"=",
"0.1",
",",
"conver",
"=",
"DEFAULT_CONVERGENCE",
",",
"minit",
"=",
"DEFAULT_MINIT",
",",
"maxit",
"=",
"DEFAULT_MAXIT",
... | Fit multiple isophotes to the image array.
This method loops over each value of the semimajor axis (sma)
length (constructed from the input parameters), fitting a single
isophote at each sma. The entire set of isophotes is returned
in an `~photutils.isophote.IsophoteList` instance.
... | [
"Fit",
"multiple",
"isophotes",
"to",
"the",
"image",
"array",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/isophote/ellipse.py#L199-L449 | train |
astropy/photutils | photutils/isophote/ellipse.py | Ellipse.fit_isophote | def fit_isophote(self, sma, step=0.1, conver=DEFAULT_CONVERGENCE,
minit=DEFAULT_MINIT, maxit=DEFAULT_MAXIT,
fflag=DEFAULT_FFLAG, maxgerr=DEFAULT_MAXGERR,
sclip=3., nclip=0, integrmode=BILINEAR,
linear=False, maxrit=None, noniterate=Fals... | python | def fit_isophote(self, sma, step=0.1, conver=DEFAULT_CONVERGENCE,
minit=DEFAULT_MINIT, maxit=DEFAULT_MAXIT,
fflag=DEFAULT_FFLAG, maxgerr=DEFAULT_MAXGERR,
sclip=3., nclip=0, integrmode=BILINEAR,
linear=False, maxrit=None, noniterate=Fals... | [
"def",
"fit_isophote",
"(",
"self",
",",
"sma",
",",
"step",
"=",
"0.1",
",",
"conver",
"=",
"DEFAULT_CONVERGENCE",
",",
"minit",
"=",
"DEFAULT_MINIT",
",",
"maxit",
"=",
"DEFAULT_MAXIT",
",",
"fflag",
"=",
"DEFAULT_FFLAG",
",",
"maxgerr",
"=",
"DEFAULT_MAXG... | Fit a single isophote with a given semimajor axis length.
The ``step`` and ``linear`` parameters are not used to actually
grow or shrink the current fitting semimajor axis length. They
are necessary so the sampling algorithm can know where to start
the gradient computation and also how... | [
"Fit",
"a",
"single",
"isophote",
"with",
"a",
"given",
"semimajor",
"axis",
"length",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/isophote/ellipse.py#L451-L579 | train |
astropy/photutils | photutils/aperture/circle.py | CircularAperture.to_sky | def to_sky(self, wcs, mode='all'):
"""
Convert the aperture to a `SkyCircularAperture` object defined
in celestial coordinates.
Parameters
----------
wcs : `~astropy.wcs.WCS`
The world coordinate system (WCS) transformation to use.
mode : {'all', 'wc... | python | def to_sky(self, wcs, mode='all'):
"""
Convert the aperture to a `SkyCircularAperture` object defined
in celestial coordinates.
Parameters
----------
wcs : `~astropy.wcs.WCS`
The world coordinate system (WCS) transformation to use.
mode : {'all', 'wc... | [
"def",
"to_sky",
"(",
"self",
",",
"wcs",
",",
"mode",
"=",
"'all'",
")",
":",
"sky_params",
"=",
"self",
".",
"_to_sky_params",
"(",
"wcs",
",",
"mode",
"=",
"mode",
")",
"return",
"SkyCircularAperture",
"(",
"*",
"*",
"sky_params",
")"
] | Convert the aperture to a `SkyCircularAperture` 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 transformat... | [
"Convert",
"the",
"aperture",
"to",
"a",
"SkyCircularAperture",
"object",
"defined",
"in",
"celestial",
"coordinates",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/aperture/circle.py#L157-L179 | train |
astropy/photutils | photutils/aperture/circle.py | CircularAnnulus.to_sky | def to_sky(self, wcs, mode='all'):
"""
Convert the aperture to a `SkyCircularAnnulus` object defined
in celestial coordinates.
Parameters
----------
wcs : `~astropy.wcs.WCS`
The world coordinate system (WCS) transformation to use.
mode : {'all', 'wcs... | python | def to_sky(self, wcs, mode='all'):
"""
Convert the aperture to a `SkyCircularAnnulus` object defined
in celestial coordinates.
Parameters
----------
wcs : `~astropy.wcs.WCS`
The world coordinate system (WCS) transformation to use.
mode : {'all', 'wcs... | [
"def",
"to_sky",
"(",
"self",
",",
"wcs",
",",
"mode",
"=",
"'all'",
")",
":",
"sky_params",
"=",
"self",
".",
"_to_sky_params",
"(",
"wcs",
",",
"mode",
"=",
"mode",
")",
"return",
"SkyCircularAnnulus",
"(",
"*",
"*",
"sky_params",
")"
] | Convert the aperture to a `SkyCircularAnnulus` 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 transformati... | [
"Convert",
"the",
"aperture",
"to",
"a",
"SkyCircularAnnulus",
"object",
"defined",
"in",
"celestial",
"coordinates",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/aperture/circle.py#L254-L276 | train |
astropy/photutils | photutils/aperture/circle.py | SkyCircularAperture.to_pixel | def to_pixel(self, wcs, mode='all'):
"""
Convert the aperture to a `CircularAperture` 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 a `CircularAperture` 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",
"CircularAperture",
"(",
"*",
"*",
"pixel_params",
")"
] | Convert the aperture to a `CircularAperture` 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 inc... | [
"Convert",
"the",
"aperture",
"to",
"a",
"CircularAperture",
"object",
"defined",
"in",
"pixel",
"coordinates",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/aperture/circle.py#L303-L325 | train |
astropy/photutils | photutils/aperture/circle.py | SkyCircularAnnulus.to_pixel | def to_pixel(self, wcs, mode='all'):
"""
Convert the aperture to a `CircularAnnulus` object defined in
pixel coordinates.
Parameters
----------
wcs : `~astropy.wcs.WCS`
The world coordinate system (WCS) transformation to use.
mode : {'all', 'wcs'}, o... | python | def to_pixel(self, wcs, mode='all'):
"""
Convert the aperture to a `CircularAnnulus` object defined in
pixel coordinates.
Parameters
----------
wcs : `~astropy.wcs.WCS`
The world coordinate system (WCS) transformation to use.
mode : {'all', 'wcs'}, o... | [
"def",
"to_pixel",
"(",
"self",
",",
"wcs",
",",
"mode",
"=",
"'all'",
")",
":",
"pixel_params",
"=",
"self",
".",
"_to_pixel_params",
"(",
"wcs",
",",
"mode",
"=",
"mode",
")",
"return",
"CircularAnnulus",
"(",
"*",
"*",
"pixel_params",
")"
] | Convert the aperture to a `CircularAnnulus` 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 incl... | [
"Convert",
"the",
"aperture",
"to",
"a",
"CircularAnnulus",
"object",
"defined",
"in",
"pixel",
"coordinates",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/aperture/circle.py#L364-L386 | train |
astropy/photutils | photutils/datasets/make.py | apply_poisson_noise | def apply_poisson_noise(data, random_state=None):
"""
Apply Poisson noise to an array, where the value of each element in
the input array represents the expected number of counts.
Each pixel in the output array is generated by drawing a random
sample from a Poisson distribution whose expectation va... | python | def apply_poisson_noise(data, random_state=None):
"""
Apply Poisson noise to an array, where the value of each element in
the input array represents the expected number of counts.
Each pixel in the output array is generated by drawing a random
sample from a Poisson distribution whose expectation va... | [
"def",
"apply_poisson_noise",
"(",
"data",
",",
"random_state",
"=",
"None",
")",
":",
"data",
"=",
"np",
".",
"asanyarray",
"(",
"data",
")",
"if",
"np",
".",
"any",
"(",
"data",
"<",
"0",
")",
":",
"raise",
"ValueError",
"(",
"'data must not contain an... | Apply Poisson noise to an array, where the value of each element in
the input array represents the expected number of counts.
Each pixel in the output array is generated by drawing a random
sample from a Poisson distribution whose expectation value is given
by the pixel value in the input array.
P... | [
"Apply",
"Poisson",
"noise",
"to",
"an",
"array",
"where",
"the",
"value",
"of",
"each",
"element",
"in",
"the",
"input",
"array",
"represents",
"the",
"expected",
"number",
"of",
"counts",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/datasets/make.py#L26-L78 | train |
astropy/photutils | photutils/datasets/make.py | make_noise_image | def make_noise_image(shape, type='gaussian', mean=None, stddev=None,
random_state=None):
"""
Make a noise image containing Gaussian or Poisson noise.
Parameters
----------
shape : 2-tuple of int
The shape of the output 2D image.
type : {'gaussian', 'poisson'}
... | python | def make_noise_image(shape, type='gaussian', mean=None, stddev=None,
random_state=None):
"""
Make a noise image containing Gaussian or Poisson noise.
Parameters
----------
shape : 2-tuple of int
The shape of the output 2D image.
type : {'gaussian', 'poisson'}
... | [
"def",
"make_noise_image",
"(",
"shape",
",",
"type",
"=",
"'gaussian'",
",",
"mean",
"=",
"None",
",",
"stddev",
"=",
"None",
",",
"random_state",
"=",
"None",
")",
":",
"if",
"mean",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'\"mean\" must be input... | Make a noise image containing Gaussian or Poisson noise.
Parameters
----------
shape : 2-tuple of int
The shape of the output 2D image.
type : {'gaussian', 'poisson'}
The distribution used to generate the random noise:
* ``'gaussian'``: Gaussian distributed noise.
... | [
"Make",
"a",
"noise",
"image",
"containing",
"Gaussian",
"or",
"Poisson",
"noise",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/datasets/make.py#L81-L156 | train |
astropy/photutils | photutils/datasets/make.py | make_random_models_table | def make_random_models_table(n_sources, param_ranges, random_state=None):
"""
Make a `~astropy.table.Table` containing randomly generated
parameters for an Astropy model to simulate a set of sources.
Each row of the table corresponds to a source whose parameters are
defined by the column names. Th... | python | def make_random_models_table(n_sources, param_ranges, random_state=None):
"""
Make a `~astropy.table.Table` containing randomly generated
parameters for an Astropy model to simulate a set of sources.
Each row of the table corresponds to a source whose parameters are
defined by the column names. Th... | [
"def",
"make_random_models_table",
"(",
"n_sources",
",",
"param_ranges",
",",
"random_state",
"=",
"None",
")",
":",
"prng",
"=",
"check_random_state",
"(",
"random_state",
")",
"sources",
"=",
"Table",
"(",
")",
"for",
"param_name",
",",
"(",
"lower",
",",
... | Make a `~astropy.table.Table` containing randomly generated
parameters for an Astropy model to simulate a set of sources.
Each row of the table corresponds to a source whose parameters are
defined by the column names. The parameters are drawn from a
uniform distribution over the specified input ranges... | [
"Make",
"a",
"~astropy",
".",
"table",
".",
"Table",
"containing",
"randomly",
"generated",
"parameters",
"for",
"an",
"Astropy",
"model",
"to",
"simulate",
"a",
"set",
"of",
"sources",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/datasets/make.py#L159-L237 | train |
astropy/photutils | photutils/datasets/make.py | make_random_gaussians_table | def make_random_gaussians_table(n_sources, param_ranges, random_state=None):
"""
Make a `~astropy.table.Table` containing randomly generated
parameters for 2D Gaussian sources.
Each row of the table corresponds to a Gaussian source whose
parameters are defined by the column names. The parameters a... | python | def make_random_gaussians_table(n_sources, param_ranges, random_state=None):
"""
Make a `~astropy.table.Table` containing randomly generated
parameters for 2D Gaussian sources.
Each row of the table corresponds to a Gaussian source whose
parameters are defined by the column names. The parameters a... | [
"def",
"make_random_gaussians_table",
"(",
"n_sources",
",",
"param_ranges",
",",
"random_state",
"=",
"None",
")",
":",
"sources",
"=",
"make_random_models_table",
"(",
"n_sources",
",",
"param_ranges",
",",
"random_state",
"=",
"random_state",
")",
"# convert Gaussi... | Make a `~astropy.table.Table` containing randomly generated
parameters for 2D Gaussian sources.
Each row of the table corresponds to a Gaussian source whose
parameters are defined by the column names. The parameters are
drawn from a uniform distribution over the specified input ranges.
The output... | [
"Make",
"a",
"~astropy",
".",
"table",
".",
"Table",
"containing",
"randomly",
"generated",
"parameters",
"for",
"2D",
"Gaussian",
"sources",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/datasets/make.py#L240-L363 | train |
astropy/photutils | photutils/datasets/make.py | make_model_sources_image | def make_model_sources_image(shape, model, source_table, oversample=1):
"""
Make an image containing sources generated from a user-specified
model.
Parameters
----------
shape : 2-tuple of int
The shape of the output 2D image.
model : 2D astropy.modeling.models object
The m... | python | def make_model_sources_image(shape, model, source_table, oversample=1):
"""
Make an image containing sources generated from a user-specified
model.
Parameters
----------
shape : 2-tuple of int
The shape of the output 2D image.
model : 2D astropy.modeling.models object
The m... | [
"def",
"make_model_sources_image",
"(",
"shape",
",",
"model",
",",
"source_table",
",",
"oversample",
"=",
"1",
")",
":",
"image",
"=",
"np",
".",
"zeros",
"(",
"shape",
",",
"dtype",
"=",
"np",
".",
"float64",
")",
"y",
",",
"x",
"=",
"np",
".",
... | Make an image containing sources generated from a user-specified
model.
Parameters
----------
shape : 2-tuple of int
The shape of the output 2D image.
model : 2D astropy.modeling.models object
The model to be used for rendering the sources.
source_table : `~astropy.table.Table... | [
"Make",
"an",
"image",
"containing",
"sources",
"generated",
"from",
"a",
"user",
"-",
"specified",
"model",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/datasets/make.py#L366-L460 | train |
astropy/photutils | photutils/datasets/make.py | make_4gaussians_image | def make_4gaussians_image(noise=True):
"""
Make an example image containing four 2D Gaussians plus a constant
background.
The background has a mean of 5.
If ``noise`` is `True`, then Gaussian noise with a mean of 0 and a
standard deviation of 5 is added to the output image.
Parameters
... | python | def make_4gaussians_image(noise=True):
"""
Make an example image containing four 2D Gaussians plus a constant
background.
The background has a mean of 5.
If ``noise`` is `True`, then Gaussian noise with a mean of 0 and a
standard deviation of 5 is added to the output image.
Parameters
... | [
"def",
"make_4gaussians_image",
"(",
"noise",
"=",
"True",
")",
":",
"table",
"=",
"Table",
"(",
")",
"table",
"[",
"'amplitude'",
"]",
"=",
"[",
"50",
",",
"70",
",",
"150",
",",
"210",
"]",
"table",
"[",
"'x_mean'",
"]",
"=",
"[",
"160",
",",
"... | Make an example image containing four 2D Gaussians plus a constant
background.
The background has a mean of 5.
If ``noise`` is `True`, then Gaussian noise with a mean of 0 and a
standard deviation of 5 is added to the output image.
Parameters
----------
noise : bool, optional
Whet... | [
"Make",
"an",
"example",
"image",
"containing",
"four",
"2D",
"Gaussians",
"plus",
"a",
"constant",
"background",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/datasets/make.py#L638-L688 | train |
astropy/photutils | photutils/datasets/make.py | make_100gaussians_image | def make_100gaussians_image(noise=True):
"""
Make an example image containing 100 2D Gaussians plus a constant
background.
The background has a mean of 5.
If ``noise`` is `True`, then Gaussian noise with a mean of 0 and a
standard deviation of 2 is added to the output image.
Parameters
... | python | def make_100gaussians_image(noise=True):
"""
Make an example image containing 100 2D Gaussians plus a constant
background.
The background has a mean of 5.
If ``noise`` is `True`, then Gaussian noise with a mean of 0 and a
standard deviation of 2 is added to the output image.
Parameters
... | [
"def",
"make_100gaussians_image",
"(",
"noise",
"=",
"True",
")",
":",
"n_sources",
"=",
"100",
"flux_range",
"=",
"[",
"500",
",",
"1000",
"]",
"xmean_range",
"=",
"[",
"0",
",",
"500",
"]",
"ymean_range",
"=",
"[",
"0",
",",
"300",
"]",
"xstddev_rang... | Make an example image containing 100 2D Gaussians plus a constant
background.
The background has a mean of 5.
If ``noise`` is `True`, then Gaussian noise with a mean of 0 and a
standard deviation of 2 is added to the output image.
Parameters
----------
noise : bool, optional
Wheth... | [
"Make",
"an",
"example",
"image",
"containing",
"100",
"2D",
"Gaussians",
"plus",
"a",
"constant",
"background",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/datasets/make.py#L691-L749 | train |
astropy/photutils | photutils/datasets/make.py | make_wcs | def make_wcs(shape, galactic=False):
"""
Create a simple celestial WCS object in either the ICRS or Galactic
coordinate frame.
Parameters
----------
shape : 2-tuple of int
The shape of the 2D array to be used with the output
`~astropy.wcs.WCS` object.
galactic : bool, optio... | python | def make_wcs(shape, galactic=False):
"""
Create a simple celestial WCS object in either the ICRS or Galactic
coordinate frame.
Parameters
----------
shape : 2-tuple of int
The shape of the 2D array to be used with the output
`~astropy.wcs.WCS` object.
galactic : bool, optio... | [
"def",
"make_wcs",
"(",
"shape",
",",
"galactic",
"=",
"False",
")",
":",
"wcs",
"=",
"WCS",
"(",
"naxis",
"=",
"2",
")",
"rho",
"=",
"np",
".",
"pi",
"/",
"3.",
"scale",
"=",
"0.1",
"/",
"3600.",
"if",
"astropy_version",
"<",
"'3.1'",
":",
"wcs"... | Create a simple celestial WCS object in either the ICRS or Galactic
coordinate frame.
Parameters
----------
shape : 2-tuple of int
The shape of the 2D array to be used with the output
`~astropy.wcs.WCS` object.
galactic : bool, optional
If `True`, then the output WCS will b... | [
"Create",
"a",
"simple",
"celestial",
"WCS",
"object",
"in",
"either",
"the",
"ICRS",
"or",
"Galactic",
"coordinate",
"frame",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/datasets/make.py#L752-L809 | train |
astropy/photutils | photutils/datasets/make.py | make_imagehdu | def make_imagehdu(data, wcs=None):
"""
Create a FITS `~astropy.io.fits.ImageHDU` containing the input 2D
image.
Parameters
----------
data : 2D array-like
The input 2D data.
wcs : `~astropy.wcs.WCS`, optional
The world coordinate system (WCS) transformation to include in
... | python | def make_imagehdu(data, wcs=None):
"""
Create a FITS `~astropy.io.fits.ImageHDU` containing the input 2D
image.
Parameters
----------
data : 2D array-like
The input 2D data.
wcs : `~astropy.wcs.WCS`, optional
The world coordinate system (WCS) transformation to include in
... | [
"def",
"make_imagehdu",
"(",
"data",
",",
"wcs",
"=",
"None",
")",
":",
"data",
"=",
"np",
".",
"asanyarray",
"(",
"data",
")",
"if",
"data",
".",
"ndim",
"!=",
"2",
":",
"raise",
"ValueError",
"(",
"'data must be a 2D array'",
")",
"if",
"wcs",
"is",
... | Create a FITS `~astropy.io.fits.ImageHDU` containing the input 2D
image.
Parameters
----------
data : 2D array-like
The input 2D data.
wcs : `~astropy.wcs.WCS`, optional
The world coordinate system (WCS) transformation to include in
the output FITS header.
Returns
... | [
"Create",
"a",
"FITS",
"~astropy",
".",
"io",
".",
"fits",
".",
"ImageHDU",
"containing",
"the",
"input",
"2D",
"image",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/datasets/make.py#L812-L855 | train |
astropy/photutils | photutils/centroids/core.py | centroid_com | def centroid_com(data, mask=None):
"""
Calculate the centroid of an n-dimensional array as its "center of
mass" determined from moments.
Invalid values (e.g. NaNs or infs) in the ``data`` array are
automatically masked.
Parameters
----------
data : array_like
The input n-dimens... | python | def centroid_com(data, mask=None):
"""
Calculate the centroid of an n-dimensional array as its "center of
mass" determined from moments.
Invalid values (e.g. NaNs or infs) in the ``data`` array are
automatically masked.
Parameters
----------
data : array_like
The input n-dimens... | [
"def",
"centroid_com",
"(",
"data",
",",
"mask",
"=",
"None",
")",
":",
"data",
"=",
"data",
".",
"astype",
"(",
"np",
".",
"float",
")",
"if",
"mask",
"is",
"not",
"None",
"and",
"mask",
"is",
"not",
"np",
".",
"ma",
".",
"nomask",
":",
"mask",
... | Calculate the centroid of an n-dimensional array as its "center of
mass" determined from moments.
Invalid values (e.g. NaNs or infs) in the ``data`` array are
automatically masked.
Parameters
----------
data : array_like
The input n-dimensional array.
mask : array_like (bool), opt... | [
"Calculate",
"the",
"centroid",
"of",
"an",
"n",
"-",
"dimensional",
"array",
"as",
"its",
"center",
"of",
"mass",
"determined",
"from",
"moments",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/centroids/core.py#L74-L117 | train |
astropy/photutils | photutils/centroids/core.py | gaussian1d_moments | def gaussian1d_moments(data, mask=None):
"""
Estimate 1D Gaussian parameters from the moments of 1D data.
This function can be useful for providing initial parameter values
when fitting a 1D Gaussian to the ``data``.
Parameters
----------
data : array_like (1D)
The 1D array.
m... | python | def gaussian1d_moments(data, mask=None):
"""
Estimate 1D Gaussian parameters from the moments of 1D data.
This function can be useful for providing initial parameter values
when fitting a 1D Gaussian to the ``data``.
Parameters
----------
data : array_like (1D)
The 1D array.
m... | [
"def",
"gaussian1d_moments",
"(",
"data",
",",
"mask",
"=",
"None",
")",
":",
"if",
"np",
".",
"any",
"(",
"~",
"np",
".",
"isfinite",
"(",
"data",
")",
")",
":",
"data",
"=",
"np",
".",
"ma",
".",
"masked_invalid",
"(",
"data",
")",
"warnings",
... | Estimate 1D Gaussian parameters from the moments of 1D data.
This function can be useful for providing initial parameter values
when fitting a 1D Gaussian to the ``data``.
Parameters
----------
data : array_like (1D)
The 1D array.
mask : array_like (1D bool), optional
A boolea... | [
"Estimate",
"1D",
"Gaussian",
"parameters",
"from",
"the",
"moments",
"of",
"1D",
"data",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/centroids/core.py#L120-L163 | train |
astropy/photutils | photutils/centroids/core.py | fit_2dgaussian | def fit_2dgaussian(data, error=None, mask=None):
"""
Fit a 2D Gaussian plus a constant to a 2D image.
Invalid values (e.g. NaNs or infs) in the ``data`` or ``error``
arrays are automatically masked. The mask for invalid values
represents the combination of the invalid-value masks for the
``dat... | python | def fit_2dgaussian(data, error=None, mask=None):
"""
Fit a 2D Gaussian plus a constant to a 2D image.
Invalid values (e.g. NaNs or infs) in the ``data`` or ``error``
arrays are automatically masked. The mask for invalid values
represents the combination of the invalid-value masks for the
``dat... | [
"def",
"fit_2dgaussian",
"(",
"data",
",",
"error",
"=",
"None",
",",
"mask",
"=",
"None",
")",
":",
"from",
".",
".",
"morphology",
"import",
"data_properties",
"# prevent circular imports",
"data",
"=",
"np",
".",
"ma",
".",
"asanyarray",
"(",
"data",
")... | Fit a 2D Gaussian plus a constant to a 2D image.
Invalid values (e.g. NaNs or infs) in the ``data`` or ``error``
arrays are automatically masked. The mask for invalid values
represents the combination of the invalid-value masks for the
``data`` and ``error`` arrays.
Parameters
----------
... | [
"Fit",
"a",
"2D",
"Gaussian",
"plus",
"a",
"constant",
"to",
"a",
"2D",
"image",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/centroids/core.py#L166-L247 | train |
astropy/photutils | photutils/centroids/core.py | centroid_1dg | def centroid_1dg(data, error=None, mask=None):
"""
Calculate the centroid of a 2D array by fitting 1D Gaussians to the
marginal ``x`` and ``y`` distributions of the array.
Invalid values (e.g. NaNs or infs) in the ``data`` or ``error``
arrays are automatically masked. The mask for invalid values
... | python | def centroid_1dg(data, error=None, mask=None):
"""
Calculate the centroid of a 2D array by fitting 1D Gaussians to the
marginal ``x`` and ``y`` distributions of the array.
Invalid values (e.g. NaNs or infs) in the ``data`` or ``error``
arrays are automatically masked. The mask for invalid values
... | [
"def",
"centroid_1dg",
"(",
"data",
",",
"error",
"=",
"None",
",",
"mask",
"=",
"None",
")",
":",
"data",
"=",
"np",
".",
"ma",
".",
"asanyarray",
"(",
"data",
")",
"if",
"mask",
"is",
"not",
"None",
"and",
"mask",
"is",
"not",
"np",
".",
"ma",
... | Calculate the centroid of a 2D array by fitting 1D Gaussians to the
marginal ``x`` and ``y`` distributions of the array.
Invalid values (e.g. NaNs or infs) in the ``data`` or ``error``
arrays are automatically masked. The mask for invalid values
represents the combination of the invalid-value masks fo... | [
"Calculate",
"the",
"centroid",
"of",
"a",
"2D",
"array",
"by",
"fitting",
"1D",
"Gaussians",
"to",
"the",
"marginal",
"x",
"and",
"y",
"distributions",
"of",
"the",
"array",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/centroids/core.py#L250-L322 | train |
astropy/photutils | photutils/centroids/core.py | centroid_sources | def centroid_sources(data, xpos, ypos, box_size=11, footprint=None,
error=None, mask=None, centroid_func=centroid_com):
"""
Calculate the centroid of sources at the defined positions.
A cutout image centered on each input position will be used to
calculate the centroid position. T... | python | def centroid_sources(data, xpos, ypos, box_size=11, footprint=None,
error=None, mask=None, centroid_func=centroid_com):
"""
Calculate the centroid of sources at the defined positions.
A cutout image centered on each input position will be used to
calculate the centroid position. T... | [
"def",
"centroid_sources",
"(",
"data",
",",
"xpos",
",",
"ypos",
",",
"box_size",
"=",
"11",
",",
"footprint",
"=",
"None",
",",
"error",
"=",
"None",
",",
"mask",
"=",
"None",
",",
"centroid_func",
"=",
"centroid_com",
")",
":",
"xpos",
"=",
"np",
... | Calculate the centroid of sources at the defined positions.
A cutout image centered on each input position will be used to
calculate the centroid position. The cutout image is defined either
using the ``box_size`` or ``footprint`` keyword. The ``footprint``
keyword can be used to create a non-rectang... | [
"Calculate",
"the",
"centroid",
"of",
"sources",
"at",
"the",
"defined",
"positions",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/centroids/core.py#L358-L481 | train |
astropy/photutils | photutils/centroids/core.py | GaussianConst2D.evaluate | def evaluate(x, y, constant, amplitude, x_mean, y_mean, x_stddev,
y_stddev, theta):
"""Two dimensional Gaussian plus constant function."""
model = Const2D(constant)(x, y) + Gaussian2D(amplitude, x_mean,
y_mean, x_stddev,
... | python | def evaluate(x, y, constant, amplitude, x_mean, y_mean, x_stddev,
y_stddev, theta):
"""Two dimensional Gaussian plus constant function."""
model = Const2D(constant)(x, y) + Gaussian2D(amplitude, x_mean,
y_mean, x_stddev,
... | [
"def",
"evaluate",
"(",
"x",
",",
"y",
",",
"constant",
",",
"amplitude",
",",
"x_mean",
",",
"y_mean",
",",
"x_stddev",
",",
"y_stddev",
",",
"theta",
")",
":",
"model",
"=",
"Const2D",
"(",
"constant",
")",
"(",
"x",
",",
"y",
")",
"+",
"Gaussian... | Two dimensional Gaussian plus constant function. | [
"Two",
"dimensional",
"Gaussian",
"plus",
"constant",
"function",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/centroids/core.py#L61-L68 | train |
astropy/photutils | photutils/psf/sandbox.py | DiscretePRF.evaluate | def evaluate(self, x, y, flux, x_0, y_0):
"""
Discrete PRF model evaluation.
Given a certain position and flux the corresponding image of
the PSF is chosen and scaled to the flux. If x and y are
outside the boundaries of the image, zero will be returned.
Parameters
... | python | def evaluate(self, x, y, flux, x_0, y_0):
"""
Discrete PRF model evaluation.
Given a certain position and flux the corresponding image of
the PSF is chosen and scaled to the flux. If x and y are
outside the boundaries of the image, zero will be returned.
Parameters
... | [
"def",
"evaluate",
"(",
"self",
",",
"x",
",",
"y",
",",
"flux",
",",
"x_0",
",",
"y_0",
")",
":",
"# Convert x and y to index arrays",
"x",
"=",
"(",
"x",
"-",
"x_0",
"+",
"0.5",
"+",
"self",
".",
"prf_shape",
"[",
"1",
"]",
"//",
"2",
")",
".",... | Discrete PRF model evaluation.
Given a certain position and flux the corresponding image of
the PSF is chosen and scaled to the flux. If x and y are
outside the boundaries of the image, zero will be returned.
Parameters
----------
x : float
x coordinate arra... | [
"Discrete",
"PRF",
"model",
"evaluation",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/psf/sandbox.py#L104-L145 | train |
astropy/photutils | photutils/psf/sandbox.py | Reproject._reproject | def _reproject(wcs1, wcs2):
"""
Perform the forward transformation of ``wcs1`` followed by the
inverse transformation of ``wcs2``.
Parameters
----------
wcs1, wcs2 : `~astropy.wcs.WCS` or `~gwcs.wcs.WCS`
The WCS objects.
Returns
-------
... | python | def _reproject(wcs1, wcs2):
"""
Perform the forward transformation of ``wcs1`` followed by the
inverse transformation of ``wcs2``.
Parameters
----------
wcs1, wcs2 : `~astropy.wcs.WCS` or `~gwcs.wcs.WCS`
The WCS objects.
Returns
-------
... | [
"def",
"_reproject",
"(",
"wcs1",
",",
"wcs2",
")",
":",
"import",
"gwcs",
"forward_origin",
"=",
"[",
"]",
"if",
"isinstance",
"(",
"wcs1",
",",
"fitswcs",
".",
"WCS",
")",
":",
"forward",
"=",
"wcs1",
".",
"all_pix2world",
"forward_origin",
"=",
"[",
... | Perform the forward transformation of ``wcs1`` followed by the
inverse transformation of ``wcs2``.
Parameters
----------
wcs1, wcs2 : `~astropy.wcs.WCS` or `~gwcs.wcs.WCS`
The WCS objects.
Returns
-------
result : func
Function to compute... | [
"Perform",
"the",
"forward",
"transformation",
"of",
"wcs1",
"followed",
"by",
"the",
"inverse",
"transformation",
"of",
"wcs2",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/psf/sandbox.py#L316-L363 | train |
astropy/photutils | photutils/utils/misc.py | get_version_info | def get_version_info():
"""
Return astropy and photutils versions.
Returns
-------
result : str
The astropy and photutils versions.
"""
from astropy import __version__
astropy_version = __version__
from photutils import __version__
photutils_version = __version__
... | python | def get_version_info():
"""
Return astropy and photutils versions.
Returns
-------
result : str
The astropy and photutils versions.
"""
from astropy import __version__
astropy_version = __version__
from photutils import __version__
photutils_version = __version__
... | [
"def",
"get_version_info",
"(",
")",
":",
"from",
"astropy",
"import",
"__version__",
"astropy_version",
"=",
"__version__",
"from",
"photutils",
"import",
"__version__",
"photutils_version",
"=",
"__version__",
"return",
"'astropy: {0}, photutils: {1}'",
".",
"format",
... | Return astropy and photutils versions.
Returns
-------
result : str
The astropy and photutils versions. | [
"Return",
"astropy",
"and",
"photutils",
"versions",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/utils/misc.py#L15-L32 | train |
astropy/photutils | photutils/utils/errors.py | calc_total_error | def calc_total_error(data, bkg_error, effective_gain):
"""
Calculate a total error array, combining a background-only error
array with the Poisson noise of sources.
Parameters
----------
data : array_like or `~astropy.units.Quantity`
The data array.
bkg_error : array_like or `~astr... | python | def calc_total_error(data, bkg_error, effective_gain):
"""
Calculate a total error array, combining a background-only error
array with the Poisson noise of sources.
Parameters
----------
data : array_like or `~astropy.units.Quantity`
The data array.
bkg_error : array_like or `~astr... | [
"def",
"calc_total_error",
"(",
"data",
",",
"bkg_error",
",",
"effective_gain",
")",
":",
"data",
"=",
"np",
".",
"asanyarray",
"(",
"data",
")",
"bkg_error",
"=",
"np",
".",
"asanyarray",
"(",
"bkg_error",
")",
"inputs",
"=",
"[",
"data",
",",
"bkg_err... | Calculate a total error array, combining a background-only error
array with the Poisson noise of sources.
Parameters
----------
data : array_like or `~astropy.units.Quantity`
The data array.
bkg_error : array_like or `~astropy.units.Quantity`
The pixel-wise Gaussian 1-sigma backgro... | [
"Calculate",
"a",
"total",
"error",
"array",
"combining",
"a",
"background",
"-",
"only",
"error",
"array",
"with",
"the",
"Poisson",
"noise",
"of",
"sources",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/utils/errors.py#L11-L132 | train |
astropy/photutils | photutils/aperture/rectangle.py | RectangularAperture.to_sky | def to_sky(self, wcs, mode='all'):
"""
Convert the aperture to a `SkyRectangularAperture` 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 `SkyRectangularAperture` 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",
"SkyRectangularAperture",
"(",
"*",
"*",
"sky_params",
")"
] | Convert the aperture to a `SkyRectangularAperture` 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 transfor... | [
"Convert",
"the",
"aperture",
"to",
"a",
"SkyRectangularAperture",
"object",
"defined",
"in",
"celestial",
"coordinates",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/aperture/rectangle.py#L200-L222 | train |
astropy/photutils | photutils/aperture/rectangle.py | RectangularAnnulus.to_sky | def to_sky(self, wcs, mode='all'):
"""
Convert the aperture to a `SkyRectangularAnnulus` 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 `SkyRectangularAnnulus` 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",
"SkyRectangularAnnulus",
"(",
"*",
"*",
"sky_params",
")"
] | Convert the aperture to a `SkyRectangularAnnulus` 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",
"SkyRectangularAnnulus",
"object",
"defined",
"in",
"celestial",
"coordinates",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/aperture/rectangle.py#L354-L376 | train |
astropy/photutils | photutils/aperture/rectangle.py | SkyRectangularAperture.to_pixel | def to_pixel(self, wcs, mode='all'):
"""
Convert the aperture to a `RectangularAperture` 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 a `RectangularAperture` 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",
"RectangularAperture",
"(",
"*",
"*",
"pixel_params",
")"
] | Convert the aperture to a `RectangularAperture` 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",
"a",
"RectangularAperture",
"object",
"defined",
"in",
"pixel",
"coordinates",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/aperture/rectangle.py#L425-L447 | train |
astropy/photutils | photutils/aperture/rectangle.py | SkyRectangularAnnulus.to_pixel | def to_pixel(self, wcs, mode='all'):
"""
Convert the aperture to a `RectangularAnnulus` 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 a `RectangularAnnulus` 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",
"RectangularAnnulus",
"(",
"*",
"*",
"pixel_params",
")"
] | Convert the aperture to a `RectangularAnnulus` 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",
"a",
"RectangularAnnulus",
"object",
"defined",
"in",
"pixel",
"coordinates",
"."
] | cc9bb4534ab76bac98cb5f374a348a2573d10401 | https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/aperture/rectangle.py#L511-L533 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.