Skip to content

Commit

Permalink
Add sanity checks on RA and DEC
Browse files Browse the repository at this point in the history
  • Loading branch information
jacquot committed Jan 9, 2025
1 parent b46cb90 commit 6b653a4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pycbc/tmpltbank/sky_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ def __init__(self, ra, dec, detectors, ref_gps_time):
# We store the points in a 2D array internally, first dimension runs
# over the list of points, second dimension is RA/dec.
# Question: should we use Astropy sky positions instead?
if (self.ra < 0).any() or (self.ra > 2 * np.pi).any():
raise ValueError('RA must be in the range [0,2π]')
if (self.dec < -np.pi/2).any() or (ra > np.pi/2).any():
raise ValueError('DEC must be in the range [-π/2, π/2]')
self.positions = np.vstack([ra, dec]).T
self.detectors = sorted(detectors)
self.ref_gps_time = ref_gps_time
Expand Down

0 comments on commit 6b653a4

Please sign in to comment.