CompoundSphericalSkyRegion#
- class regions.CompoundSphericalSkyRegion(region1, region2, operator, meta=None, visual=None)[source]#
Bases:
SphericalSkyRegionA class that represents the logical combination of two regions in spherical sky coordinates.
- Parameters:
- region1
SphericalSkyRegion First spherical sky region.
- region2
SphericalSkyRegion Second spherical sky region.
- operatorcallable
A callable binary operator.
- meta
RegionMeta, optional A dictionary that stores the meta attributes of this region.
- visual
RegionVisual, optional A dictionary that stores the visual meta attributes of this region.
- region1
Attributes Summary
Bounding circle for the spherical sky region.
Bounding longitude and latitude of the spherical sky region, in the region's frame.
Coordinate frame of the region.
region1()region2()Methods Summary
contains(coord)Check whether a sky coordinate falls inside the spherical sky region, excluding the boundary.
covers(coord)Check whether a sky coordinate falls inside the spherical sky region, including the boundary.
discretize_boundary([n_points])Discretize the boundary into a
PolygonSphericalSkyRegion, as an approximation where all sides follow great circles.to_pixel(wcs[, ...])Convert to a planar
PixelRegion.to_sky([wcs, include_boundary_distortions, ...])Convert to a planar
SkyRegion.transform_to(frame[, merge_attributes])Transform the
SphericalSkyRegioninstance into another instance with a different coordinate reference frame.Attributes Documentation
- bounding_circle#
- bounding_lonlat#
- frame#
- operator#
- region1#
- region2#
Methods Documentation
- contains(coord)[source]#
Check whether a sky coordinate falls inside the spherical sky region, excluding the boundary.
This method considers points on the boundary as outside the region, consistent with Shapely’s
containsfunction and DE-9IM semantics.- Parameters:
- coord
SkyCoord The position or positions to check.
- coord
See also
coversCheck if points are inside or on the boundary.
- covers(coord)[source]#
Check whether a sky coordinate falls inside the spherical sky region, including the boundary.
This method considers points on the boundary as inside the region, consistent with Shapely’s
coversfunction and DE-9IM semantics.- Parameters:
- coord
SkyCoord The position or positions to check.
- coord
See also
containsCheck if points are strictly inside (excludes boundary).
- discretize_boundary(n_points=100)[source]#
Discretize the boundary into a
PolygonSphericalSkyRegion, as an approximation where all sides follow great circles.- Parameters:
- n_pointsint, optional
Number of points along the region’s boundary. Default is 100.
- Returns:
- poly_sky_region:
PolygonSphericalSkyRegion Spherical sky polygon object.
- poly_sky_region:
- to_pixel(wcs, include_boundary_distortions=False, n_points=None)[source]#
Convert to a planar
PixelRegion.- Parameters:
- wcs
WCS The world coordinate system transformation to use to convert between sky and pixel coordinates.
- include_boundary_distortionsbool, optional
If True, accounts for boundary distortions in spherical to planar conversions, by discretizing the boundary and converting the boundary polygon. Default is False, which converts to an equivalent idealized shape.
- n_pointsint, optional
The number of polygon vertices for boundary discretization. This keyword will have no effect unless
include_boundary_distortions=True. Default is 100.
- wcs
- Returns:
- pixel_region
PixelRegion A pixel region, with an equivalent shape (if
include_boundary_distortionsis False), or a discretized polygon of the boundary (ifinclude_boundary_distortionsis True).
- pixel_region
- to_sky(wcs=None, include_boundary_distortions=False, n_points=None)[source]#
Convert to a planar
SkyRegion.- Parameters:
- wcs
WCS, optional The world coordinate system transformation to use to convert between sky and pixel coordinates. Required if transforming with boundary distortions (if
include_boundary_distortionsis True). Ignored if boundary distortions not included.- include_boundary_distortionsbool, optional
If True, accounts for boundary distortions in spherical to planar conversions, by discretizing the boundary and converting the boundary polygon. Default is False, which converts to an equivalent idealized shape.
- n_pointsint, optional
The number of polygon vertices for boundary discretization. This keyword will have no effect unless
include_boundary_distortions=True. Default is 100.
- wcs
- Returns:
- sky_region
SkyRegion A planar sky region, with an equivalent shape (if
include_boundary_distortionsis False), or a discretized polygon of the boundary (ifinclude_boundary_distortionsis True).
- sky_region
- transform_to(frame, merge_attributes=True)[source]#
Transform the
SphericalSkyRegioninstance into another instance with a different coordinate reference frame.The precise frame transformed to depends on
merge_attributes. IfFalse, the destination frame is used exactly as passed in. But this is often not quite what one wants. E.g., suppose one wants to transform an ICRS coordinate that has an obstime attribute to FK4; in this case, one likely would want to use this information. Thus, the default formerge_attributesisTrue, in which the precedence is as follows: (1) explicitly set (i.e., non-default) values in the destination frame; (2) explicitly set values in the source; (3) default value in the destination frame.Note that in either case, any explicitly set attributes on the source
astropy.coordinates.SkyCoordthat are not part of the destination frame’s definition are kept (stored on the resultingastropy.coordinates.SkyCoord), and thus one can round-trip (e.g., from FK4 to ICRS to FK4 without losing obstime).- Parameters:
- framestr, or
BaseCoordinateFrameclass or instance The frame to transform this coordinate into.
- merge_attributesbool, optional
Whether the default attributes in the destination frame are allowed to be overridden by explicitly set attributes in the source (see note above; default:
True).
- framestr, or
- Returns:
- sph_sky_region
SphericalSkyRegion A new spherical sky region represented in the
frameframe.
- sph_sky_region