Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
wcs : WCS object
A world coordinate system (WCS) transformation that supports
the `astropy shared interface for WCS
`_ (e.g.
`astropy.wcs.WCS`, `gwcs.wcs.WCS`).
Returns
-------
aperture : `RectangularAperture` object
A `RectangularAperture` object.
"""
return RectangularAperture(**self._to_pixel_params(wcs))
class SkyRectangularAnnulus(SkyAperture):
"""
A rectangular annulus aperture defined in sky coordinates.
The aperture has a single fixed size/shape, but it can have multiple
positions (see the ``positions`` input).
Parameters
----------
positions : `~astropy.coordinates.SkyCoord`
The celestial coordinates of the aperture center(s). This can be
either scalar coordinates or an array of coordinates.
w_in : scalar `~astropy.units.Quantity`
The inner full width of the rectangular annulus, either in
angular or pixel units. For ``theta=0`` the width side is along
the North-South axis.
# handle data, error, and unit inputs
# output data and error are ndarray without units
data, error, unit = _handle_units(data, error, unit)
# compute variance and apply input mask
data, variance = _prepare_photometry_data(data, error, mask)
single_aperture = False
if isinstance(apertures, Aperture):
single_aperture = True
apertures = (apertures,)
# convert sky to pixel apertures
skyaper = False
if isinstance(apertures[0], SkyAperture):
if wcs is None:
raise ValueError('A WCS transform must be defined by the input '
'data or the wcs keyword when using a '
'SkyAperture object.')
# used to include SkyCoord position in the output table
skyaper = True
skycoord_pos = apertures[0].positions
apertures = [aper.to_pixel(wcs) for aper in apertures]
# compare positions in pixels to avoid comparing SkyCoord objects
positions = apertures[0].positions
for aper in apertures[1:]:
if not np.array_equal(aper.positions, positions):
raise ValueError('Input apertures must all have identical '
wcs : WCS object
A world coordinate system (WCS) transformation that supports
the `astropy shared interface for WCS
`_ (e.g.
`astropy.wcs.WCS`, `gwcs.wcs.WCS`).
Returns
-------
aperture : `SkyCircularAnnulus` object
A `SkyCircularAnnulus` object.
"""
return SkyCircularAnnulus(**self._to_sky_params(wcs))
class SkyCircularAperture(SkyAperture):
"""
A circular aperture defined in sky coordinates.
The aperture has a single fixed size/shape, but it can have multiple
positions (see the ``positions`` input).
Parameters
----------
positions : `~astropy.coordinates.SkyCoord`
The celestial coordinates of the aperture center(s). This can be
either scalar coordinates or an array of coordinates.
r : scalar `~astropy.units.Quantity`
The radius of the circle, either in angular or pixel units.
Examples
wcs : WCS object
A world coordinate system (WCS) transformation that supports
the `astropy shared interface for WCS
`_ (e.g.
`astropy.wcs.WCS`, `gwcs.wcs.WCS`).
Returns
-------
aperture : `EllipticalAperture` object
An `EllipticalAperture` object.
"""
return EllipticalAperture(**self._to_pixel_params(wcs))
class SkyEllipticalAnnulus(SkyAperture):
"""
An elliptical annulus aperture defined in sky coordinates.
The aperture has a single fixed size/shape, but it can have multiple
positions (see the ``positions`` input).
Parameters
----------
positions : `~astropy.coordinates.SkyCoord`
The celestial coordinates of the aperture center(s). This can be
either scalar coordinates or an array of coordinates.
a_in : scalar `~astropy.units.Quantity`
The inner semimajor axis, either in angular or pixel units.
a_out : scalar `~astropy.units.Quantity`
wcs : WCS object
A world coordinate system (WCS) transformation that supports
the `astropy shared interface for WCS
`_ (e.g.
`astropy.wcs.WCS`, `gwcs.wcs.WCS`).
Returns
-------
aperture : `CircularAperture` object
A `CircularAperture` object.
"""
return CircularAperture(**self._to_pixel_params(wcs))
class SkyCircularAnnulus(SkyAperture):
"""
A circular annulus aperture defined in sky coordinates.
The aperture has a single fixed size/shape, but it can have multiple
positions (see the ``positions`` input).
Parameters
----------
positions : `~astropy.coordinates.SkyCoord`
The celestial coordinates of the aperture center(s). This can be
either scalar coordinates or an array of coordinates.
r_in : scalar `~astropy.units.Quantity`
The inner radius of the circular annulus, either in angular or
pixel units.
wcs : WCS object
A world coordinate system (WCS) transformation that supports
the `astropy shared interface for WCS
`_ (e.g.
`astropy.wcs.WCS`, `gwcs.wcs.WCS`).
Returns
-------
aperture : `SkyRectangularAnnulus` object
A `SkyRectangularAnnulus` object.
"""
return SkyRectangularAnnulus(**self._to_sky_params(wcs))
class SkyRectangularAperture(SkyAperture):
"""
A rectangular aperture defined in sky coordinates.
The aperture has a single fixed size/shape, but it can have multiple
positions (see the ``positions`` input).
Parameters
----------
positions : `~astropy.coordinates.SkyCoord`
The celestial coordinates of the aperture center(s). This can be
either scalar coordinates or an array of coordinates.
w : scalar `~astropy.units.Quantity`
The full width of the rectangle, either in angular or pixel
units. For ``theta=0`` the width side is along the North-South
axis.
wcs : WCS object
A world coordinate system (WCS) transformation that supports
the `astropy shared interface for WCS
`_ (e.g.
`astropy.wcs.WCS`, `gwcs.wcs.WCS`).
Returns
-------
aperture : `SkyEllipticalAnnulus` object
A `SkyEllipticalAnnulus` object.
"""
return SkyEllipticalAnnulus(**self._to_sky_params(wcs))
class SkyEllipticalAperture(SkyAperture):
"""
An elliptical aperture defined in sky coordinates.
The aperture has a single fixed size/shape, but it can have multiple
positions (see the ``positions`` input).
Parameters
----------
positions : `~astropy.coordinates.SkyCoord`
The celestial coordinates of the aperture center(s). This can be
either scalar coordinates or an array of coordinates.
a : scalar `~astropy.units.Quantity`
The semimajor axis of the ellipse, either in angular or pixel
units.