This repository has been archived by the owner on Oct 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor and clean up GROWTH tiling schemes
- Move functions to the dorado.scheduling.tesselation module. - Clean up existing GROWTH methods. - Update all methods to take a single resolution parameter, area. - Convert docstrings to Numpydoc format. - Add example code. - Add to Sphinx project documentation. - Use Astropy quantities for angle arguments. - Write output in ECSV format. - Remove logger.
- Loading branch information
Showing
6 changed files
with
169 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# | ||
# Copyright © 2020 United States Government as represented by the Administrator | ||
# of the National Aeronautics and Space Administration. No copyright is claimed | ||
# in the United States under Title 17, U.S. Code. All Other Rights Reserved. | ||
# | ||
# SPDX-License-Identifier: NASA-1.3 | ||
# | ||
from astropy.coordinates import SkyCoord | ||
from astropy import units as u | ||
import numpy as np | ||
|
||
|
||
def sinusoidal(area): | ||
"""Generate a uniform grid on a sinusoidal equal area projection. | ||
This is similar to what was used for GRANDMA follow-up in LIGO/Virgo | ||
Observing Run 3 (O3). See :doi:`10.3847/2041-8213/ab3399`. | ||
Parameters | ||
---------- | ||
area : :class:`astropy.units.Quantity` | ||
The average area per tile in any Astropy solid angle units: | ||
for example, :samp:`10 * astropy.units.deg**2` or | ||
:samp:`0.1 * astropy.units.steradian`. | ||
Returns | ||
------- | ||
coords : :class:`astropy.coordinates.SkyCoord` | ||
The coordinates of the tiles. | ||
See also | ||
-------- | ||
<https://en.wikipedia.org/wiki/Sinusoidal_projection> | ||
Example | ||
------- | ||
.. plot:: | ||
from astropy import units as u | ||
from matplotlib import pyplot as plt | ||
import ligo.skymap.plot | ||
from dorado.scheduling import tesselation | ||
vertices = tesselation.sinusoidal(100 * u.deg**2) | ||
ax = plt.axes(projection='astro globe', center='0d 25d') | ||
ax.set_title('Sinusoidal projection grid') | ||
ax.plot_coord(vertices, '.') | ||
ax.grid() | ||
""" | ||
# Diameter of the field of view | ||
diameter = 2 * np.sqrt(area.to_value(u.sr) / np.pi) | ||
|
||
# Declinations of equal-declination strips | ||
n_decs = int(np.ceil(np.pi / diameter)) + 1 | ||
decs = np.linspace(-0.5 * np.pi, 0.5 * np.pi, n_decs) | ||
|
||
# Number of RA steps in each equal-declination strip | ||
n_ras = np.ceil(2 * np.pi * np.cos(decs) / diameter).astype(int) | ||
n_ras = np.maximum(1, n_ras) | ||
|
||
ras = np.concatenate([np.linspace(0, 2 * np.pi, n, endpoint=False) | ||
for n in n_ras]) | ||
decs = np.concatenate([np.repeat(dec, n) for n, dec in zip(n_ras, decs)]) | ||
return SkyCoord(ras * u.rad, decs * u.rad) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# | ||
# Copyright © 2020 United States Government as represented by the Administrator | ||
# of the National Aeronautics and Space Administration. No copyright is claimed | ||
# in the United States under Title 17, U.S. Code. All Other Rights Reserved. | ||
# | ||
# SPDX-License-Identifier: NASA-1.3 | ||
# | ||
from astropy.coordinates import SkyCoord | ||
from astropy import units as u | ||
import numpy as np | ||
|
||
GOLDEN_ANGLE = np.pi * (3 - np.sqrt(5)) * u.rad | ||
|
||
|
||
def golden_angle_spiral(area): | ||
"""Generate a tile grid from a spiral employing the golden angle. | ||
This is a spiral-based spherical packing scheme that was used by GRANDMA | ||
during LIGO/Virgo O3 (see :doi:`10.1093/mnras/staa1846`). | ||
Parameters | ||
---------- | ||
area : :class:`astropy.units.Quantity` | ||
The average area per tile in any Astropy solid angle units: | ||
for example, :samp:`10 * astropy.units.deg**2` or | ||
:samp:`0.1 * astropy.units.steradian`. | ||
Returns | ||
------- | ||
coords : :class:`astropy.coordinates.SkyCoord` | ||
The coordinates of the tiles. | ||
See also | ||
-------- | ||
<https://en.wikipedia.org/wiki/Golden_angle> | ||
Example | ||
------- | ||
.. plot:: | ||
from astropy import units as u | ||
from matplotlib import pyplot as plt | ||
import ligo.skymap.plot | ||
from dorado.scheduling import tesselation | ||
vertices = tesselation.golden_angle_spiral(100 * u.deg**2) | ||
ax = plt.axes(projection='astro globe', center='0d 25d') | ||
ax.set_title('Golden angle spiral') | ||
ax.plot_coord(vertices, '.') | ||
ax.grid() | ||
""" | ||
n = int(np.ceil(1 / area.to_value(u.spat))) | ||
ra = GOLDEN_ANGLE * np.arange(n) | ||
dec = np.arcsin(np.linspace(1 - 1.0 / n, 1.0 / n - 1, n)) * u.rad | ||
return SkyCoord(ra, dec) |