diff --git a/bin/pycbc_make_sky_grid b/bin/pycbc_make_sky_grid index e59e6fc9f4f..663de80a43a 100644 --- a/bin/pycbc_make_sky_grid +++ b/bin/pycbc_make_sky_grid @@ -18,7 +18,6 @@ from scipy.spatial.transform import Rotation as R import pycbc from pycbc.detector import Detector -from pycbc.io.hdf import HFile from pycbc.types import angle_as_radians from pycbc.tmpltbank import sky_grid diff --git a/pycbc/tmpltbank/sky_grid.py b/pycbc/tmpltbank/sky_grid.py index 31b9fe9bdd6..224a585a883 100644 --- a/pycbc/tmpltbank/sky_grid.py +++ b/pycbc/tmpltbank/sky_grid.py @@ -8,7 +8,7 @@ import h5py from pycbc.detector import Detector - +from pycbc.conversion import ensurearray class SkyGrid: def __init__(self, ra, dec, detectors, ref_gps_time): @@ -34,9 +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(): + ra, dec, _ = ensurearray(ra,dec) + if (ra < 0).any() or (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(): + if (dec < -np.pi/2).any() or (dec > 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)