Spherical Polygons (ligo.skymap.plot.poly
)¶
Plotting tools for drawing polygons.
- ligo.skymap.plot.poly.cut_dateline(vertices)[source]¶
Cut a polygon across the dateline, possibly splitting it into multiple polygons. Vertices consist of (longitude, latitude) pairs where longitude is always given in terms of a reference angle (between -π and π).
This routine is not meant to cover all possible cases; it will only work for convex polygons that extend over less than a hemisphere.
Examples
>>> cut_dateline(np.asarray([[3, 0.1], ... [4, 0.1], ... [4, -0.1], ... [3, -0.1], ... [3, 0.1]])) [array([[-2.28318531, 0.1 ], [-2.28318531, -0.1 ], [-3.14159265, -0.1 ], [-3.14159265, 0.1 ], [-2.28318531, 0.1 ]]), array([[ 3.14159265, 0.1 ], [ 3.14159265, -0.1 ], [ 3. , -0.1 ], [ 3. , 0.1 ], [ 3.14159265, 0.1 ]])]
- ligo.skymap.plot.poly.cut_prime_meridian(vertices)[source]¶
Cut a polygon across the prime meridian, possibly splitting it into multiple polygons. Vertices consist of (longitude, latitude) pairs where longitude is always given in terms of a wrapped angle (between 0 and 2π).
This routine is not meant to cover all possible cases; it will only work for convex polygons that extend over less than a hemisphere.
Examples
>>> cut_prime_meridian(np.asarray([[6, 0.1], ... [7, 0.1], ... [7, -0.1], ... [6, -0.1], ... [6, 0.1]])) [array([[ 0.71681469, 0.1 ], [ 0.71681469, -0.1 ], [ 0. , -0.1 ], [ 0. , 0.1 ], [ 0.71681469, 0.1 ]]), array([[ 6.28318531, 0.1 ], [ 6.28318531, -0.1 ], [ 6. , -0.1 ], [ 6. , 0.1 ], [ 6.28318531, 0.1 ]])]