Fields of View (m4opt.fov)#

This module provides functions to compute the footprint of the field of view of a detector on the sky when oriented toward arbitrary coordinates. We provide two functions: footprint() which transforms the field of view to any sky coordinate (and optional positional angle), and footprint_healpix() which computes the HEALPix pixels contained within the field of view.

Supported region types#

You supply the field of view of the detector using Astropy regions. The following region types are supported: CircleSkyRegion, PointSkyRegion, PolygonSkyRegion, RectangleSkyRegion, and any Regions object consisting regions of the aforementioned types.

Note

All of these region types are treated as true spherical geometry. CircleSkyRegion is treated as a spherical cap. PolygonSkyRegion and RectangleSkyRegion are treated as spherical polygons whose edges are great circles.

Some other astronomy software (for example, DS9) does not distinguish between planar and spherical geometry, and the Astropy regions package itself has some ambiguity here as well (see astropy/regions#276).

(Source code)

../_images/fov-1.svg

Gallery of supported region types#

Regions from files#

You can also read field of view shapes from common region files using regions.Regions.read(). For example, here is a DS9 region file describing the field of view of the Wide-Field Instrument on the Nancy Grace Roman Space Telescope:

roman_wfi.ds9#
# Region file format: DS9 astropy/regions
icrs
polygon(0.44918069,-0.26546774,0.38636350,-0.37345125,0.27960162,-0.31264720,0.34266154,-0.20403581)
polygon(0.57456967,-0.33829497,0.51217048,-0.44534616,0.40760248,-0.38604417,0.47035207,-0.27820859)
polygon(0.68646806,-0.40333012,0.62454323,-0.50936617,0.52243242,-0.45168898,0.58480139,-0.34472797)
polygon(0.35839452,-0.36949868,0.29518298,-0.47668262,0.18801533,-0.41636469,0.25128431,-0.30850470)
polygon(0.48419286,-0.44258028,0.42118481,-0.54876655,0.31598062,-0.49007870,0.37916569,-0.38305916)
polygon(0.59600444,-0.50741371,0.53329718,-0.61254258,0.43035014,-0.55557033,0.49334266,-0.44948403)
polygon(0.23425290,-0.45430158,0.17108331,-0.56041748,0.06340790,-0.50021657,0.12642378,-0.39342972)
polygon(0.36090875,-0.52791410,0.29768278,-0.63301888,0.19158861,-0.57449079,0.25478248,-0.46855606)
polygon(0.47147272,-0.59323361,0.40832704,-0.69727778,0.30413378,-0.64049057,0.36735538,-0.53549735)
polygon(0.51649483,-0.14805607,0.45437256,-0.25645505,0.34788280,-0.19497679,0.41040731,-0.08604617)
polygon(0.64171849,-0.22100010,0.58019011,-0.32856993,0.47601301,-0.26841138,0.53803787,-0.16013910)
polygon(0.75338420,-0.28625854,0.69248829,-0.39290465,0.59086760,-0.33421549,0.65234194,-0.22671823)
polygon(0.56032374,-0.01744176,0.49908358,-0.12581692,0.39266300,-0.06360469,0.45444575,0.04516636)
polygon(0.68581160,-0.09047794,0.62532618,-0.19816700,0.52122939,-0.13702903,0.58234295,-0.02875815)
polygon(0.79715253,-0.15562731,0.73742221,-0.26252554,0.63588849,-0.20262664,0.69629666,-0.09499784)
polygon(0.57079989,0.13195201,0.51045890,0.02411332,0.40377149,0.08703013,0.46476673,0.19507258)
polygon(0.69704617,0.05864008,0.63759259,-0.04872413,0.53307557,0.01346540,0.59325279,0.12121928)
polygon(0.80808906,-0.00499348,0.74950655,-0.11176072,0.64739486,-0.05049899,0.70674778,0.05680731)

The following example code reads the region file and plots a grid of footprints:

from astropy.coordinates import SkyCoord
from astropy import units as u
import ligo.skymap.plot
from matplotlib import pyplot as plt
from m4opt.fov import footprint
import numpy as np
from regions import Regions

# Read shapes from a DS9 region file
roman_wfi = Regions.read('roman_wfi.ds9')

# Create a grid of target coordinates
ra, dec = np.meshgrid(
    np.linspace(-1.5, 0.5, 4) * u.deg,
    np.linspace(-1, 1, 3) * u.deg
)
target_coords = SkyCoord(ra, dec).ravel()

# Transform shapes to target coordinates
footprints = footprint(roman_wfi, target_coords, -30 * u.deg)

# Plot footprints
ax = plt.axes(
    projection='astro zoom',
    center=SkyCoord(0 * u.deg, 0 * u.deg),
    radius=2 * u.deg)
for regions in footprints:
    for region in regions:
        ax.add_patch(region.to_pixel(ax.wcs).as_artist())
ax.grid()

(Source code)

../_images/fov-3.svg

m4opt.fov Package#

Functions#

contains(region, target_coord)

Test if a region contains a given sky coordinate.

footprint(region, target_coord[, rotation])

Transform a region to the desired target coordinate and optional rotation.

footprint_healpix(hpx, region[, ...])

Calculate the HEALPix pixels inside an observing footprint.