-
-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce SkyRegion.solid_angle #434
Comments
I guess technically this might not be simple to achieve. While of course for some regions once can rely on analytical expressions, one would still need a numerical approximations in other situations. In any case https://mathworld.wolfram.com/LHuiliersTheorem.html is useful... |
I'm not sure how this would work because the sky-based regions are simple representations that preserve the shape. They aren't shapes in spherical coordinates, but more like cartesian shapes in a tangent plane (a circle in pixel coordinates converts to a circle in sky coordinates based only on the pixel scale). Does a solid angle make sense for non-spherical coordinates? |
Thanks for the feedback @larrybradley! Yes, I now remember that methods like
def solid_angle(self, wcs, mode):
"""Solid angle enclosed by the region (`astropy.units.Quantity`)"""
region_pix = self.to_pix(wcs=wcs)
mask = region_pix.to_mask(mode="exact")
solid_angle_array = compute_solid_angle_array_from_wcs(wcs, shape=mask.data.shape)
return np.sum(mask.data * solid_angle_array) |
I would be very curious to see how this progresses. Is there a currently utility to compute the area of a pixel for some arbitary position anywhere? I know of something in astropy wcs, but that performs this at the reference pixel exclusively. I'd would try to help out but not really sure where to start. |
@tjgalvin We have something like this in from gammapy.maps import WcsGeom
from astropy import units as u
from astropy.coordinates import SkyCoord
center = SkyCoord("0d", "0d", frame="galactic")
geom = WcsGeom.create(
skydir=center,
binsz=0.1,
width=[10, 8] * u.deg
)
geom.solid_angle() Which returns an array of solid angle per pixel, computed using L'Huilllers theorem. |
The
PixelRegion
already defines an.area
property. It would be nice to see the equivalentSkyRegion.solid_angle
property.The text was updated successfully, but these errors were encountered: