add more docstringa
@@ -74,7 +74,14 @@ class RegionGeom(Geom):
@property
def width(self):
- """Width of bounding box of the region"""
+ """Width of bounding box of the region.
+
+ Returns
+ -------
+ width : `~astropy.units.Quantity`
+ Dimensions of the region in both spatial dimensions.
+ Units: ``deg``
+ """
if self.region is None:
raise ValueError("Region definition required.")
@@ -96,10 +103,12 @@ class RegionGeom(Geom):
@property
def axes(self):
+ """List of non-spatial axes."""
return self._axes
@property
def wcs(self):
+ """WCS projection object."""
return self._wcs
@property
@@ -114,7 +123,7 @@ class RegionGeom(Geom):
@property
def center_skydir(self):
- """Center skydir"""
+ """Sky coordinate of the center of the region"""
if self.region is None:
return SkyCoord(np.nan * u.deg, np.nan * u.deg)
try:
@@ -124,7 +133,7 @@ class RegionGeom(Geom):
return SkyCoord.from_pixel(xp=xp, yp=yp, wcs=self.wcs)
def contains(self, coords):
- """Check if the input coordinates are inside the region.
+ """Check if a given map coordinate is contained in the region.
Requires the `.region` attribute to be set.
Parameters
@@ -167,6 +176,10 @@ class RegionGeom(Geom):
@property
def _shape(self):
+ """Number of bins in each dimension.
+ The spatial dimension is always (1, 1), as a
+ `RegionGeom` is not pixelized further
+ """
return tuple((1, 1) + self.axes.shape)
def get_coord(self, frame=None):
@@ -202,6 +215,14 @@ class RegionGeom(Geom):
raise NotImplementedError("Cropping of `RegionGeom` not supported")
def solid_angle(self):
+ """Get solid angle of the region.
+
+ Returns
+ -------
+ angle : `~astropy.units.Quantity`
+ Solid angle of the region. In sr.
+ Units: ``sr``
+ """
if self.region is None:
raise ValueError("Region definition required.")
@@ -210,6 +231,15 @@ class RegionGeom(Geom):
return solid_angle.to("sr")
def bin_volume(self):
+ """If the RegionGeom has a non-spatial axis, it
+ returns the volume of the region. If not, it
+ just retuns the solid angle size.
+
+ Returns
+ -------
+ volume : `~astropy.units.Quantity`
+ Volume of the region.
+ """
bin_volume = self.solid_angle() * np.ones(self.data_shape)
for idx, ax in enumerate(self.axes):
@@ -245,8 +275,7 @@ class RegionGeom(Geom):
return wcs_geom
def get_wcs_coord(self):
- """Get the array of coordinates that define
- the region.
+ """Get the array of coordinates that define the region.
Returns
-------
@@ -264,10 +293,24 @@ class RegionGeom(Geom):
return self
def to_cube(self, axes):
+ """Append non-spatial axes to create a higher-dimensional geometry.
+
+ Returns
+ -------
+ region : `~RegionGeom`
+ RegionGeom with the added axes.
+ """
axes = copy.deepcopy(self.axes) + axes
return self._init_copy(axes=axes)
def to_image(self):
+ """Remove non-spatial axes to create a 2D region.
+
+ Returns
+ -------
+ region : `~RegionGeom`
+ RegionGeom without any non-spatial axes.
+ """
return self._init_copy(axes=None)
def upsample(self, factor, axis_name):
