Clean hpx convolve test code format
@@ -505,6 +505,7 @@ def test_smooth(kernel):
with pytest.raises(ValueError):
m_nest.smooth(0.2 * u.deg, "box")
+
@pytest.mark.parametrize("nest", [True, False])
def test_convolve_wcs(nest):
energy = MapAxis.from_bounds(1,100, unit='TeV', nbin=2, name='energy')
@@ -517,9 +518,8 @@ def test_convolve_wcs(nest):
)
hpx_map = Map.from_geom(hpx_geom)
hpx_map.set_by_coord((0, 0, [2, 90]), 1)
- wcs_geom = WcsGeom.create(width=5,
- binsz = 0.04,
- axes = [energy])
+ wcs_geom = WcsGeom.create(width=5, binsz=0.04, axes=[energy])
+
kernel = PSFKernel.from_gauss(wcs_geom, 0.4*u.deg)
convolved_map = hpx_map.convolve_wcs(kernel)
assert_allclose(convolved_map.data.sum(), 2, rtol=0.001)
@@ -529,11 +529,15 @@ def test_convolve_wcs(nest):
def test_convolve_full(region):
energy = MapAxis.from_bounds(1, 100, unit='TeV', nbin=2, name='energy_true')
nside = 256
- all_sky_geom = HpxGeom(nside=nside,
+
+ all_sky_geom = HpxGeom(
+ nside=nside,
axes=[energy],
region=region,
nest=False,
- frame = 'icrs')
+ frame='icrs'
+ )
+
all_sky_map = Map.from_geom(all_sky_geom)
all_sky_map.set_by_coord((0, 0, [2, 90]), 1)
all_sky_map.set_by_coord((10, 10, [2, 90]), 1)
@@ -543,9 +547,7 @@ def test_convolve_full(region):
all_sky_map.set_by_coord((-45, 30, [2, 90]), 1)
all_sky_map.set_by_coord((30, -45, [2, 90]), 1)
- wcs_geom = WcsGeom.create(width=5,
- binsz = 0.05,
- axes = [energy])
+ wcs_geom = WcsGeom.create(width=5, binsz=0.05, axes=[energy])
psf = PSFMap.from_gauss(
energy_axis_true=energy, sigma=[0.5, 0.6] * u.deg
)
@@ -554,6 +556,7 @@ def test_convolve_full(region):
convolved_map = all_sky_map.convolve_full(kernel)
assert_allclose(convolved_map.data.sum(), 14, rtol=1e-5)
+
def test_hpxmap_read_healpy(tmp_path):
import healpy as hp
path = tmp_path / "tmp.fits"
