Implement unit test for RegionGeom.pad()
@@ -272,6 +272,20 @@ def test_squash(region):
assert geom_squashed.axes[1] == axis2
assert_allclose(geom_squashed.axes[0].edges.to_value("TeV"), (1, 100))
+
+def test_pad(region):
+ axis1 = MapAxis.from_edges([1, 10] * u.TeV, name="energy", interp="log")
+ axis2 = MapAxis.from_nodes([1, 2, 3, 4] * u.deg, name="angle", interp="lin")
+
+ geom = RegionGeom(region, axes=[axis1, axis2])
+
+ geom_pad = geom.pad(axis_name="energy", pad_width=1)
+ assert_allclose(geom_pad.axes["energy"].nbin, 3)
+
+ geom_pad = geom.pad(axis_name="angle", pad_width=1)
+ assert_allclose(geom_pad.axes["angle"].nbin, 6)
+
+
def test_to_wcs_geom(region):
geom = RegionGeom(region)
wcs_geom = geom.to_wcs_geom()
@@ -297,6 +311,7 @@ def test_to_wcs_geom(region):
assert_allclose(wcs_geom.center_coord[1].value, 0, rtol=0.001, atol=0)
assert_allclose(wcs_geom.width, [[2], [3]] * u.deg, rtol=1, atol=0)
+
def test_get_wcs_coord_and_weights(region):
# test on circular region
geom = RegionGeom(region)
