Skip to content

Instantly share code, notes, and snippets.

@cdeil
Created October 17, 2017 07:11
Show Gist options
  • Save cdeil/754b76dc7f22511a5504fbbe74dccd62 to your computer and use it in GitHub Desktop.
Save cdeil/754b76dc7f22511a5504fbbe74dccd62 to your computer and use it in GitHub Desktop.
$ python -m pytest -v gammapy/maps/
Internet access disabled
Gammapy test data availability:
gammapy-extra ... yes
hess ............ yes
Gammapy environment variables:
GAMMAPY_EXTRA = /Users/deil/code/gammapy-extra
Setting matplotlib backend to "agg" for the tests.
============================================================ test session starts ============================================================
platform darwin -- Python 3.6.3, pytest-3.2.3, py-1.4.34, pluggy-0.4.0 -- /opt/local/bin/python
cachedir: .
Running tests with gammapy version 0.7.dev5123.
Running tests in gammapy/maps/.
Date: 2017-10-17T08:59:11
Platform: Darwin-17.0.0-x86_64-i386-64bit
Executable: /opt/local/bin/python
Full Python Version:
3.6.3 (default, Oct 7 2017, 02:03:21)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)]
encodings: sys: utf-8, locale: UTF-8, filesystem: utf-8
byteorder: little
float info: dig: 15, mant_dig: 15
Numpy: 1.13.3
Scipy: 0.19.1
Matplotlib: 2.1.0
h5py: 2.7.0
Pandas: 0.20.3
cython: 0.27.1
skimage: 0.13.1
sklearn: 0.19.0
uncertainties: 2.4.8.1
iminuit: not available
astropy: 3.0.dev20290
regions: 0.2
healpy: 1.10.3
sherpa: 4.9.1+12.g3626715
gammapy: 0.7.dev5123
naima: not available
reproject: 0.3.1
photutils: 0.3.2
aplpy: 0.0.dev1007
Using Astropy options: remote_data: none.
rootdir: /Users/deil/code/gammapy, inifile: setup.cfg
plugins: arraydiff-0.1, hypothesis-3.32.0
collected 252 items
gammapy/maps/tests/test_base.py::test_mapbase_create[0.1-10.0-wcs-skydir0-None] PASSED
gammapy/maps/tests/test_base.py::test_mapbase_create[0.1-10.0-wcs-skydir1-axes1] PASSED
gammapy/maps/tests/test_base.py::test_mapbase_create[0.1-10.0-wcs-skydir2-axes2] PASSED
gammapy/maps/tests/test_base.py::test_mapbase_create[0.1-10.0-hpx-skydir3-None] FAILED
gammapy/maps/tests/test_base.py::test_mapbase_create[0.1-10.0-hpx-skydir4-axes4] FAILED
gammapy/maps/tests/test_base.py::test_mapbase_create[0.1-10.0-hpx-skydir5-axes5] FAILED
gammapy/maps/tests/test_base.py::test_mapbase_create[0.1-10.0-hpx-sparse-skydir6-None] FAILED
gammapy/maps/tests/test_geom.py::test_mapaxis_init_from_edges[edges0-lin] PASSED
gammapy/maps/tests/test_geom.py::test_mapaxis_init_from_edges[edges1-log] PASSED
gammapy/maps/tests/test_geom.py::test_mapaxis_init_from_edges[edges2-sqrt] PASSED
gammapy/maps/tests/test_geom.py::test_mapaxis_from_nodes[nodes0-lin] PASSED
gammapy/maps/tests/test_geom.py::test_mapaxis_from_nodes[nodes1-log] PASSED
gammapy/maps/tests/test_geom.py::test_mapaxis_from_nodes[nodes2-sqrt] PASSED
gammapy/maps/tests/test_geom.py::test_mapaxis_from_bounds[nodes0-lin] PASSED
gammapy/maps/tests/test_geom.py::test_mapaxis_from_bounds[nodes1-log] PASSED
gammapy/maps/tests/test_geom.py::test_mapaxis_from_bounds[nodes2-sqrt] PASSED
gammapy/maps/tests/test_geom.py::test_mapaxis_pix_to_coord[nodes0-lin-edge] PASSED
gammapy/maps/tests/test_geom.py::test_mapaxis_pix_to_coord[nodes1-log-edge] PASSED
gammapy/maps/tests/test_geom.py::test_mapaxis_pix_to_coord[nodes2-sqrt-edge] PASSED
gammapy/maps/tests/test_geom.py::test_mapaxis_pix_to_coord[nodes3-lin-center] PASSED
gammapy/maps/tests/test_geom.py::test_mapaxis_pix_to_coord[nodes4-log-center] PASSED
gammapy/maps/tests/test_geom.py::test_mapaxis_pix_to_coord[nodes5-sqrt-center] PASSED
gammapy/maps/tests/test_geom.py::test_mapaxis_coord_to_idx[nodes0-lin-edge] PASSED
gammapy/maps/tests/test_geom.py::test_mapaxis_coord_to_idx[nodes1-log-edge] PASSED
gammapy/maps/tests/test_geom.py::test_mapaxis_coord_to_idx[nodes2-sqrt-edge] PASSED
gammapy/maps/tests/test_geom.py::test_mapaxis_coord_to_idx[nodes3-lin-center] PASSED
gammapy/maps/tests/test_geom.py::test_mapaxis_coord_to_idx[nodes4-log-center] PASSED
gammapy/maps/tests/test_geom.py::test_mapaxis_coord_to_idx[nodes5-sqrt-center] PASSED
gammapy/maps/tests/test_geom.py::test_mapaxis_slice[nodes0-lin-edge] PASSED
gammapy/maps/tests/test_geom.py::test_mapaxis_slice[nodes1-log-edge] PASSED
gammapy/maps/tests/test_geom.py::test_mapaxis_slice[nodes2-sqrt-edge] PASSED
gammapy/maps/tests/test_geom.py::test_mapaxis_slice[nodes3-lin-center] PASSED
gammapy/maps/tests/test_geom.py::test_mapaxis_slice[nodes4-log-center] PASSED
gammapy/maps/tests/test_geom.py::test_mapaxis_slice[nodes5-sqrt-center] PASSED
gammapy/maps/tests/test_geom.py::test_mapcoords_create PASSED
gammapy/maps/tests/test_hpx.py::test_unravel_hpx_index PASSED
gammapy/maps/tests/test_hpx.py::test_ravel_hpx_index PASSED
gammapy/maps/tests/test_hpx.py::test_hpx_global_to_local FAILED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_init_with_pix[8-False-GAL-None-None] PASSED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_init_with_pix[8-False-GAL-None-axes1] PASSED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_init_with_pix[nside2-False-GAL-None-axes2] PASSED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_init_with_pix[8-False-GAL-None-axes3] PASSED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_to_slice[8-False-GAL-None-None] PASSED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_to_slice[8-False-GAL-None-axes1] PASSED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_to_slice[nside2-False-GAL-None-axes2] PASSED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_to_slice[8-False-GAL-None-axes3] PASSED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_to_slice[8-False-GAL-DISK(110.,75.,10.)-None] FAILED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_to_slice[8-False-GAL-DISK(110.,75.,10.)-axes5] FAILED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_to_slice[nside6-False-GAL-DISK(110.,75.,10.)-axes6] FAILED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_to_slice[nside7-False-GAL-DISK(110.,75.,10.)-axes7] FAILED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_get_pixels[8-False-GAL-None-None] PASSED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_get_pixels[8-False-GAL-None-axes1] PASSED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_get_pixels[nside2-False-GAL-None-axes2] PASSED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_get_pixels[8-False-GAL-None-axes3] PASSED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_get_pixels[8-False-GAL-DISK(110.,75.,10.)-None] FAILED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_get_pixels[8-False-GAL-DISK(110.,75.,10.)-axes5] FAILED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_get_pixels[nside6-False-GAL-DISK(110.,75.,10.)-axes6] FAILED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_get_pixels[nside7-False-GAL-DISK(110.,75.,10.)-axes7] FAILED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_coord_to_idx[8-False-GAL-None-None] PASSED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_coord_to_idx[8-False-GAL-None-axes1] PASSED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_coord_to_idx[nside2-False-GAL-None-axes2] FAILED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_coord_to_idx[8-False-GAL-None-axes3] PASSED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_coord_to_idx[8-False-GAL-DISK(110.,75.,10.)-None] FAILED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_coord_to_idx[8-False-GAL-DISK(110.,75.,10.)-axes5] FAILED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_coord_to_idx[nside6-False-GAL-DISK(110.,75.,10.)-axes6] FAILED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_coord_to_idx[nside7-False-GAL-DISK(110.,75.,10.)-axes7] FAILED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_coord_to_pix FAILED
gammapy/maps/tests/test_hpx.py::test_hpx_nside_to_order PASSED
gammapy/maps/tests/test_hpx.py::test_hpx_get_pixel_size_from_nside PASSED
gammapy/maps/tests/test_hpx.py::test_hpx_get_region_size PASSED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_get_ref_dir PASSED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_make_wcs FAILED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_get_coords FAILED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_contains[8-False-GAL-None-None] PASSED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_contains[8-False-GAL-None-axes1] FAILED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_contains[nside2-False-GAL-None-axes2] FAILED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_contains[8-False-GAL-None-axes3] FAILED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_contains[8-False-GAL-DISK(110.,75.,10.)-None] FAILED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_contains[8-False-GAL-DISK(110.,75.,10.)-axes5] FAILED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_contains[nside6-False-GAL-DISK(110.,75.,10.)-axes6] FAILED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_contains[nside7-False-GAL-DISK(110.,75.,10.)-axes7] FAILED
gammapy/maps/tests/test_hpx.py::test_make_hpx_to_wcs_mapping FAILED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_from_header FAILED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_read_write[8-False-GAL-None-None] PASSED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_read_write[8-False-GAL-None-axes1] PASSED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_read_write[nside2-False-GAL-None-axes2] PASSED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_read_write[8-False-GAL-None-axes3] PASSED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_read_write[8-False-GAL-DISK(110.,75.,10.)-None] FAILED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_read_write[8-False-GAL-DISK(110.,75.,10.)-axes5] FAILED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_read_write[nside6-False-GAL-DISK(110.,75.,10.)-axes6] FAILED
gammapy/maps/tests/test_hpx.py::test_hpxgeom_read_write[nside7-False-GAL-DISK(110.,75.,10.)-axes7] FAILED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_init[8-False-GAL-None-None] PASSED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_init[8-False-GAL-None-axes1] PASSED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_init[nside2-False-GAL-None-axes2] PASSED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_init[8-False-GAL-DISK(110.,75.,10.)-axes3] FAILED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_init[8-False-GAL-DISK(110.,75.,10.)-axes4] FAILED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_create[8-False-GAL-None-None] PASSED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_create[8-False-GAL-None-axes1] PASSED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_create[nside2-False-GAL-None-axes2] PASSED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_create[8-False-GAL-DISK(110.,75.,10.)-axes3] FAILED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_create[8-False-GAL-DISK(110.,75.,10.)-axes4] FAILED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_read_write[8-False-GAL-None-None] PASSED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_read_write[8-False-GAL-None-axes1] PASSED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_read_write[nside2-False-GAL-None-axes2] PASSED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_read_write[8-False-GAL-DISK(110.,75.,10.)-axes3] FAILED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_read_write[8-False-GAL-DISK(110.,75.,10.)-axes4] FAILED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_set_get_by_pix[8-False-GAL-None-None] PASSED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_set_get_by_pix[8-False-GAL-None-axes1] PASSED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_set_get_by_pix[nside2-False-GAL-None-axes2] FAILED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_set_get_by_pix[8-False-GAL-DISK(110.,75.,10.)-axes3] FAILED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_set_get_by_pix[8-False-GAL-DISK(110.,75.,10.)-axes4] FAILED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_set_get_by_coords[8-False-GAL-None-None] PASSED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_set_get_by_coords[8-False-GAL-None-axes1] PASSED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_set_get_by_coords[nside2-False-GAL-None-axes2] FAILED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_set_get_by_coords[8-False-GAL-DISK(110.,75.,10.)-axes3] FAILED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_set_get_by_coords[8-False-GAL-DISK(110.,75.,10.)-axes4] FAILED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_get_by_coords_interp[8-False-GAL-None-None] xfail
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_get_by_coords_interp[8-False-GAL-None-axes1] xfail
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_get_by_coords_interp[nside2-False-GAL-None-axes2] xfail
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_get_by_coords_interp[8-False-GAL-DISK(110.,75.,10.)-axes3] xfail
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_get_by_coords_interp[8-False-GAL-DISK(110.,75.,10.)-axes4] xfail
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_fill_by_coords[8-False-GAL-None-None] PASSED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_fill_by_coords[8-False-GAL-None-axes1] PASSED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_fill_by_coords[nside2-False-GAL-None-axes2] FAILED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_fill_by_coords[8-False-GAL-DISK(110.,75.,10.)-axes3] FAILED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_fill_by_coords[8-False-GAL-DISK(110.,75.,10.)-axes4] FAILED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_iter[8-False-GAL-None-None] PASSED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_iter[8-False-GAL-None-axes1] PASSED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_iter[nside2-False-GAL-None-axes2] FAILED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_iter[8-False-GAL-DISK(110.,75.,10.)-axes3] FAILED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_iter[8-False-GAL-DISK(110.,75.,10.)-axes4] FAILED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_to_wcs[8-False-GAL-None-None] PASSED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_to_wcs[8-False-GAL-None-axes1] PASSED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_to_wcs[nside2-False-GAL-None-axes2] FAILED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_to_wcs[8-False-GAL-DISK(110.,75.,10.)-axes3] FAILED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_to_wcs[8-False-GAL-DISK(110.,75.,10.)-axes4] FAILED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_swap_scheme[8-False-GAL-None-None] PASSED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_swap_scheme[8-False-GAL-None-axes1] PASSED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_swap_scheme[nside2-False-GAL-None-axes2] FAILED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_swap_scheme[8-False-GAL-DISK(110.,75.,10.)-axes3] FAILED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_swap_scheme[8-False-GAL-DISK(110.,75.,10.)-axes4] FAILED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_ud_grade[8-False-GAL-None-None] PASSED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_ud_grade[8-False-GAL-None-axes1] PASSED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_ud_grade[nside2-False-GAL-None-axes2] FAILED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_ud_grade[8-False-GAL-DISK(110.,75.,10.)-axes3] FAILED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_ud_grade[8-False-GAL-DISK(110.,75.,10.)-axes4] FAILED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_sum_over_axes[8-False-GAL-None-None] PASSED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_sum_over_axes[8-False-GAL-None-axes1] PASSED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_sum_over_axes[nside2-False-GAL-None-axes2] FAILED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_sum_over_axes[8-False-GAL-DISK(110.,75.,10.)-axes3] FAILED
gammapy/maps/tests/test_hpxcube.py::test_hpxcube_sum_over_axes[8-False-GAL-DISK(110.,75.,10.)-axes4] FAILED
gammapy/maps/tests/test_hpxsparse.py::test_hpxcube_init[8-False-GAL-None-None] PASSED
gammapy/maps/tests/test_hpxsparse.py::test_hpxcube_init[8-False-GAL-None-axes1] PASSED
gammapy/maps/tests/test_hpxsparse.py::test_hpxcube_init[8-False-GAL-DISK(110.,75.,10.)-axes2] FAILED
gammapy/maps/tests/test_hpxsparse.py::test_hpxcube_init[nside3-False-GAL-DISK(110.,75.,10.)-axes3] FAILED
gammapy/maps/tests/test_hpxsparse.py::test_hpxcube_init[8-False-GAL-DISK(110.,75.,10.)-axes4] FAILED
gammapy/maps/tests/test_wcs.py::test_wcsgeom_init[None-10.0-GAL-AIT-skydir0-None] PASSED
gammapy/maps/tests/test_wcs.py::test_wcsgeom_init[None-10.0-GAL-AIT-skydir1-axes1] PASSED
gammapy/maps/tests/test_wcs.py::test_wcsgeom_init[None-binsz2-GAL-AIT-skydir2-axes2] PASSED
gammapy/maps/tests/test_wcs.py::test_wcsgeom_init[None-10.0-GAL-AIT-skydir3-axes3] PASSED
gammapy/maps/tests/test_wcs.py::test_wcsgeom_init[None-binsz4-GAL-AIT-skydir4-axes4] PASSED
gammapy/maps/tests/test_wcs.py::test_wcsgeom_get_pixels[None-10.0-GAL-AIT-skydir0-None] PASSED
gammapy/maps/tests/test_wcs.py::test_wcsgeom_get_pixels[None-10.0-GAL-AIT-skydir1-axes1] PASSED
gammapy/maps/tests/test_wcs.py::test_wcsgeom_get_pixels[None-binsz2-GAL-AIT-skydir2-axes2] PASSED
gammapy/maps/tests/test_wcs.py::test_wcsgeom_get_pixels[None-10.0-GAL-AIT-skydir3-axes3] PASSED
gammapy/maps/tests/test_wcs.py::test_wcsgeom_get_pixels[None-binsz4-GAL-AIT-skydir4-axes4] PASSED
gammapy/maps/tests/test_wcs.py::test_wcsgeom_test_pix_to_coord[None-10.0-GAL-AIT-skydir0-None] PASSED
gammapy/maps/tests/test_wcs.py::test_wcsgeom_test_pix_to_coord[None-10.0-GAL-AIT-skydir1-axes1] PASSED
gammapy/maps/tests/test_wcs.py::test_wcsgeom_test_pix_to_coord[None-binsz2-GAL-AIT-skydir2-axes2] PASSED
gammapy/maps/tests/test_wcs.py::test_wcsgeom_test_pix_to_coord[None-10.0-GAL-AIT-skydir3-axes3] PASSED
gammapy/maps/tests/test_wcs.py::test_wcsgeom_test_pix_to_coord[None-binsz4-GAL-AIT-skydir4-axes4] PASSED
gammapy/maps/tests/test_wcs.py::test_wcsgeom_test_coord_to_idx[None-10.0-GAL-AIT-skydir0-None] PASSED
gammapy/maps/tests/test_wcs.py::test_wcsgeom_test_coord_to_idx[None-10.0-GAL-AIT-skydir1-axes1] PASSED
gammapy/maps/tests/test_wcs.py::test_wcsgeom_test_coord_to_idx[None-binsz2-GAL-AIT-skydir2-axes2] PASSED
gammapy/maps/tests/test_wcs.py::test_wcsgeom_test_coord_to_idx[None-10.0-GAL-AIT-skydir3-axes3] PASSED
gammapy/maps/tests/test_wcs.py::test_wcsgeom_test_coord_to_idx[None-binsz4-GAL-AIT-skydir4-axes4] PASSED
gammapy/maps/tests/test_wcs.py::test_wcsgeom_read_write[None-10.0-GAL-AIT-skydir0-None] PASSED
gammapy/maps/tests/test_wcs.py::test_wcsgeom_read_write[None-10.0-GAL-AIT-skydir1-axes1] PASSED
gammapy/maps/tests/test_wcs.py::test_wcsgeom_read_write[None-binsz2-GAL-AIT-skydir2-axes2] PASSED
gammapy/maps/tests/test_wcs.py::test_wcsgeom_read_write[None-10.0-GAL-AIT-skydir3-axes3] PASSED
gammapy/maps/tests/test_wcs.py::test_wcsgeom_read_write[None-binsz4-GAL-AIT-skydir4-axes4] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_init[None-10.0-GAL-AIT-skydir0-None] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_init[None-10.0-GAL-AIT-skydir1-axes1] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_init[None-binsz2-GAL-AIT-skydir2-axes2] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_init[None-10.0-GAL-AIT-skydir3-axes3] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_init[None-binsz4-GAL-AIT-skydir4-axes4] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_init[10-1.0-GAL-AIT-skydir5-None] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_init[10-1.0-GAL-AIT-skydir6-axes6] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_init[10-binsz7-GAL-AIT-skydir7-axes7] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_init[10-1.0-GAL-AIT-skydir8-axes8] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_init[10-binsz9-GAL-AIT-skydir9-axes9] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_read_write[None-10.0-GAL-AIT-skydir0-None] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_read_write[None-10.0-GAL-AIT-skydir1-axes1] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_read_write[None-binsz2-GAL-AIT-skydir2-axes2] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_read_write[None-10.0-GAL-AIT-skydir3-axes3] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_read_write[None-binsz4-GAL-AIT-skydir4-axes4] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_read_write[10-1.0-GAL-AIT-skydir5-None] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_read_write[10-1.0-GAL-AIT-skydir6-axes6] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_read_write[10-binsz7-GAL-AIT-skydir7-axes7] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_read_write[10-1.0-GAL-AIT-skydir8-axes8] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_read_write[10-binsz9-GAL-AIT-skydir9-axes9] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_fill_by_coords[None-10.0-GAL-AIT-skydir0-None] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_fill_by_coords[None-10.0-GAL-AIT-skydir1-axes1] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_fill_by_coords[None-binsz2-GAL-AIT-skydir2-axes2] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_fill_by_coords[None-10.0-GAL-AIT-skydir3-axes3] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_fill_by_coords[None-binsz4-GAL-AIT-skydir4-axes4] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_fill_by_coords[10-1.0-GAL-AIT-skydir5-None] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_fill_by_coords[10-1.0-GAL-AIT-skydir6-axes6] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_fill_by_coords[10-binsz7-GAL-AIT-skydir7-axes7] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_fill_by_coords[10-1.0-GAL-AIT-skydir8-axes8] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_fill_by_coords[10-binsz9-GAL-AIT-skydir9-axes9] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_interp_by_coords[None-10.0-GAL-AIT-skydir0-None] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_interp_by_coords[None-10.0-GAL-AIT-skydir1-axes1] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_interp_by_coords[None-binsz2-GAL-AIT-skydir2-axes2] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_interp_by_coords[None-10.0-GAL-AIT-skydir3-axes3] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_interp_by_coords[None-binsz4-GAL-AIT-skydir4-axes4] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_interp_by_coords[10-1.0-GAL-AIT-skydir5-None] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_interp_by_coords[10-1.0-GAL-AIT-skydir6-axes6] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_interp_by_coords[10-binsz7-GAL-AIT-skydir7-axes7] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_interp_by_coords[10-1.0-GAL-AIT-skydir8-axes8] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_interp_by_coords[10-binsz9-GAL-AIT-skydir9-axes9] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_iter[None-10.0-GAL-AIT-skydir0-None] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_iter[None-10.0-GAL-AIT-skydir1-axes1] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_iter[None-binsz2-GAL-AIT-skydir2-axes2] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_iter[None-10.0-GAL-AIT-skydir3-axes3] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_iter[None-binsz4-GAL-AIT-skydir4-axes4] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_iter[10-1.0-GAL-AIT-skydir5-None] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_iter[10-1.0-GAL-AIT-skydir6-axes6] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_iter[10-binsz7-GAL-AIT-skydir7-axes7] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_iter[10-1.0-GAL-AIT-skydir8-axes8] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_iter[10-binsz9-GAL-AIT-skydir9-axes9] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_sum_over_axes[None-10.0-GAL-AIT-skydir0-None] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_sum_over_axes[None-10.0-GAL-AIT-skydir1-axes1] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_sum_over_axes[None-binsz2-GAL-AIT-skydir2-axes2] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_sum_over_axes[None-10.0-GAL-AIT-skydir3-axes3] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_sum_over_axes[None-binsz4-GAL-AIT-skydir4-axes4] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_sum_over_axes[10-1.0-GAL-AIT-skydir5-None] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_sum_over_axes[10-1.0-GAL-AIT-skydir6-axes6] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_sum_over_axes[10-binsz7-GAL-AIT-skydir7-axes7] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_sum_over_axes[10-1.0-GAL-AIT-skydir8-axes8] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_sum_over_axes[10-binsz9-GAL-AIT-skydir9-axes9] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_reproject[None-10.0-GAL-AIT-skydir0-None] xfail
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_reproject[None-10.0-GAL-AIT-skydir1-axes1] xfail
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_reproject[None-binsz2-GAL-AIT-skydir2-axes2] xfail
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_reproject[None-10.0-GAL-AIT-skydir3-axes3] xfail
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_reproject[None-binsz4-GAL-AIT-skydir4-axes4] xfail
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_reproject[10-1.0-GAL-AIT-skydir5-None] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_reproject[10-1.0-GAL-AIT-skydir6-axes6] PASSED
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_reproject[10-binsz7-GAL-AIT-skydir7-axes7] xfail
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_reproject[10-1.0-GAL-AIT-skydir8-axes8] xfail
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_reproject[10-binsz9-GAL-AIT-skydir9-axes9] xfail
gammapy/maps/tests/test_wcsnd.py::test_wcsmapnd_reproject_allsky_car PASSED
================================================================= FAILURES ==================================================================
______________________________________________ test_mapbase_create[0.1-10.0-hpx-skydir3-None] _______________________________________________
binsz = 0.1, width = 10.0, map_type = 'hpx', skydir = <SkyCoord (ICRS): (ra, dec) in deg
( 0., 30.)>, axes = None
@pytest.mark.parametrize(('binsz', 'width', 'map_type', 'skydir', 'axes'),
mapbase_args)
def test_mapbase_create(binsz, width, map_type, skydir, axes):
m = MapBase.create(binsz=binsz, width=width, map_type=map_type,
> skydir=skydir, axes=axes)
gammapy/maps/tests/test_base.py:31:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/base.py:100: in create
return HpxMap.create(**kwargs)
gammapy/maps/hpxmap.py:76: in create
conv=None, axes=axes, skydir=skydir, width=width)
gammapy/maps/hpx.py:920: in create
axes=axes, conv=conv)
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 512, nest = True, region = 'DISK(0.000000,30.000000,5.000000)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
______________________________________________ test_mapbase_create[0.1-10.0-hpx-skydir4-axes4] ______________________________________________
binsz = 0.1, width = 10.0, map_type = 'hpx', skydir = <SkyCoord (ICRS): (ra, dec) in deg
( 0., 30.)>
axes = [<gammapy.maps.geom.MapAxis object at 0x113b40c50>]
@pytest.mark.parametrize(('binsz', 'width', 'map_type', 'skydir', 'axes'),
mapbase_args)
def test_mapbase_create(binsz, width, map_type, skydir, axes):
m = MapBase.create(binsz=binsz, width=width, map_type=map_type,
> skydir=skydir, axes=axes)
gammapy/maps/tests/test_base.py:31:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/base.py:100: in create
return HpxMap.create(**kwargs)
gammapy/maps/hpxmap.py:76: in create
conv=None, axes=axes, skydir=skydir, width=width)
gammapy/maps/hpx.py:920: in create
axes=axes, conv=conv)
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 512, nest = True, region = 'DISK(0.000000,30.000000,5.000000)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
______________________________________________ test_mapbase_create[0.1-10.0-hpx-skydir5-axes5] ______________________________________________
binsz = 0.1, width = 10.0, map_type = 'hpx', skydir = <SkyCoord (ICRS): (ra, dec) in deg
( 0., 30.)>
axes = [<gammapy.maps.geom.MapAxis object at 0x113b40c50>, <gammapy.maps.geom.MapAxis object at 0x113b40b00>]
@pytest.mark.parametrize(('binsz', 'width', 'map_type', 'skydir', 'axes'),
mapbase_args)
def test_mapbase_create(binsz, width, map_type, skydir, axes):
m = MapBase.create(binsz=binsz, width=width, map_type=map_type,
> skydir=skydir, axes=axes)
gammapy/maps/tests/test_base.py:31:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/base.py:100: in create
return HpxMap.create(**kwargs)
gammapy/maps/hpxmap.py:76: in create
conv=None, axes=axes, skydir=skydir, width=width)
gammapy/maps/hpx.py:920: in create
axes=axes, conv=conv)
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 512, nest = True, region = 'DISK(0.000000,30.000000,5.000000)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
___________________________________________ test_mapbase_create[0.1-10.0-hpx-sparse-skydir6-None] ___________________________________________
binsz = 0.1, width = 10.0, map_type = 'hpx-sparse', skydir = <SkyCoord (ICRS): (ra, dec) in deg
( 0., 30.)>, axes = None
@pytest.mark.parametrize(('binsz', 'width', 'map_type', 'skydir', 'axes'),
mapbase_args)
def test_mapbase_create(binsz, width, map_type, skydir, axes):
m = MapBase.create(binsz=binsz, width=width, map_type=map_type,
> skydir=skydir, axes=axes)
gammapy/maps/tests/test_base.py:31:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/base.py:100: in create
return HpxMap.create(**kwargs)
gammapy/maps/hpxmap.py:76: in create
conv=None, axes=axes, skydir=skydir, width=width)
gammapy/maps/hpx.py:920: in create
axes=axes, conv=conv)
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 512, nest = True, region = 'DISK(0.000000,30.000000,5.000000)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
_________________________________________________________ test_hpx_global_to_local __________________________________________________________
def test_hpx_global_to_local():
ax0 = np.linspace(0., 1., 3)
ax1 = np.linspace(0., 1., 3)
# 2D All-sky
hpx = HpxGeom(16, False, 'GAL')
assert_allclose(hpx[0], np.array([0]))
assert_allclose(hpx[633], np.array([633]))
assert_allclose(hpx[0, 633], np.array([0, 633]))
assert_allclose(hpx[np.array([0, 633])], np.array([0, 633]))
# 3D All-sky
hpx = HpxGeom(16, False, 'GAL', axes=[ax0])
assert_allclose(hpx[(np.array([177, 177]), np.array([0, 1]))],
np.array([177, 177 + 3072]))
# 2D Partial-sky
> hpx = HpxGeom(64, False, 'GAL', region='DISK(110.,75.,2.)')
gammapy/maps/tests/test_hpx.py:86:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 64, nest = False, region = 'DISK(110.,75.,2.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
________________________________________ test_hpxgeom_to_slice[8-False-GAL-DISK(110.,75.,10.)-None] _________________________________________
nside = 8, nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)', axes = None
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxgeom_to_slice(nside, nested, coordsys, region, axes):
> geom = HpxGeom(nside, nested, coordsys, region=region, axes=axes)
gammapy/maps/tests/test_hpx.py:138:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
________________________________________ test_hpxgeom_to_slice[8-False-GAL-DISK(110.,75.,10.)-axes5] ________________________________________
nside = 8, nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)', axes = [<gammapy.maps.geom.MapAxis object at 0x113ba2a20>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxgeom_to_slice(nside, nested, coordsys, region, axes):
> geom = HpxGeom(nside, nested, coordsys, region=region, axes=axes)
gammapy/maps/tests/test_hpx.py:138:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
_____________________________________ test_hpxgeom_to_slice[nside6-False-GAL-DISK(110.,75.,10.)-axes6] ______________________________________
nside = [8, 16, 32], nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)'
axes = [<gammapy.maps.geom.MapAxis object at 0x113ba2a58>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxgeom_to_slice(nside, nested, coordsys, region, axes):
> geom = HpxGeom(nside, nested, coordsys, region=region, axes=axes)
gammapy/maps/tests/test_hpx.py:138:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
_____________________________________ test_hpxgeom_to_slice[nside7-False-GAL-DISK(110.,75.,10.)-axes7] ______________________________________
nside = [[8, 16, 32], [8, 8, 16]], nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)'
axes = [<gammapy.maps.geom.MapAxis object at 0x113ba2a90>, <gammapy.maps.geom.MapAxis object at 0x113ba2ac8>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxgeom_to_slice(nside, nested, coordsys, region, axes):
> geom = HpxGeom(nside, nested, coordsys, region=region, axes=axes)
gammapy/maps/tests/test_hpx.py:138:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
_______________________________________ test_hpxgeom_get_pixels[8-False-GAL-DISK(110.,75.,10.)-None] ________________________________________
nside = 8, nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)', axes = None
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxgeom_get_pixels(nside, nested, coordsys, region, axes):
> geom = HpxGeom(nside, nested, coordsys, region=region, axes=axes)
gammapy/maps/tests/test_hpx.py:172:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
_______________________________________ test_hpxgeom_get_pixels[8-False-GAL-DISK(110.,75.,10.)-axes5] _______________________________________
nside = 8, nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)', axes = [<gammapy.maps.geom.MapAxis object at 0x113ba2a20>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxgeom_get_pixels(nside, nested, coordsys, region, axes):
> geom = HpxGeom(nside, nested, coordsys, region=region, axes=axes)
gammapy/maps/tests/test_hpx.py:172:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
____________________________________ test_hpxgeom_get_pixels[nside6-False-GAL-DISK(110.,75.,10.)-axes6] _____________________________________
nside = [8, 16, 32], nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)'
axes = [<gammapy.maps.geom.MapAxis object at 0x113ba2a58>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxgeom_get_pixels(nside, nested, coordsys, region, axes):
> geom = HpxGeom(nside, nested, coordsys, region=region, axes=axes)
gammapy/maps/tests/test_hpx.py:172:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
____________________________________ test_hpxgeom_get_pixels[nside7-False-GAL-DISK(110.,75.,10.)-axes7] _____________________________________
nside = [[8, 16, 32], [8, 8, 16]], nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)'
axes = [<gammapy.maps.geom.MapAxis object at 0x113ba2a90>, <gammapy.maps.geom.MapAxis object at 0x113ba2ac8>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxgeom_get_pixels(nside, nested, coordsys, region, axes):
> geom = HpxGeom(nside, nested, coordsys, region=region, axes=axes)
gammapy/maps/tests/test_hpx.py:172:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
__________________________________________ test_hpxgeom_coord_to_idx[nside2-False-GAL-None-axes2] ___________________________________________
nside = array([2, 4, 8, 2, 4, 8, 2, 4, 8, 2, 4, 8, 2, 4, 8, 2, 4, 8, 2, 4, 8, 2, 4,
8, 2, 4, 8]), nested = False, coordsys = 'GAL'
region = None, axes = [<gammapy.maps.geom.MapAxis object at 0x113ba24e0>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxgeom_coord_to_idx(nside, nested, coordsys, region, axes):
from astropy_healpix import healpy as hp
geom = HpxGeom(nside, nested, coordsys, region=region, axes=axes)
lon = np.array([112.5, 135., 105.])
lat = np.array([75.3, 75.3, 74.6])
coords = make_test_coords(geom, lon, lat)
zidx = [ax.coord_to_idx(t) for t, ax in zip(coords[2:], geom.axes)]
if geom.nside.size > 1:
nside = geom.nside[zidx]
else:
nside = geom.nside
phi, theta = lonlat_to_colat(coords[0], coords[1])
> idx = geom.coord_to_idx(coords)
gammapy/maps/tests/test_hpx.py:200:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/geom.py:808: in coord_to_idx
pix = self.coord_to_pix(coords)
gammapy/maps/hpx.py:611: in coord_to_pix
pix = hp.ang2pix(nside, theta, phi, nest=self.nest)
../../Library/Python/3.6/lib/python/site-packages/astropy_healpix/healpy.py:97: in ang2pix
return lonlat_to_healpix(lon, lat, nside, order='nested' if nest else 'ring')
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
lon = array([ 1.96349541, 1.96349541, 1.96349541, 2.35619449, 2.35619449,
2.35619449, 1.83259571, 1.83259571, ... 1.96349541,
1.96349541, 2.35619449, 2.35619449, 2.35619449, 1.83259571,
1.83259571, 1.83259571])
lat = array([ 1.31423293, 1.31423293, 1.31423293, 1.31423293, 1.31423293,
1.31423293, 1.31423293, 1.31423293, ... 1.30201562,
1.30201562, 1.30201562, 1.30201562, 1.30201562, 1.30201562,
1.30201562, 1.30201562])
nside = array([2, 4, 8, 2, 4, 8, 2, 4, 8, 2, 4, 8, 2, 4, 8, 2, 4, 8, 2, 4, 8, 2, 4,
8, 2, 4, 8]), return_offsets = False
order = 'ring'
def lonlat_to_healpix(lon, lat, nside, return_offsets=False, order='ring'):
"""
Convert longitudes/latitudes to HEALPix indices
Parameters
----------
lon, lat : :class:`~astropy.units.Quantity`
The longitude and latitude values as :class:`~astropy.units.Quantity`
instances with angle units.
nside : int
Number of pixels along the side of each of the 12 top-level HEALPix tiles
order : { 'nested' | 'ring' }
Order of HEALPix pixels
return_offsets : bool, optional
If `True`, the returned values are the HEALPix pixel indices as well as
``dx`` and ``dy``, the fractional positions inside the pixels. If
`False` (the default), only the HEALPix pixel indices is returned.
Returns
-------
healpix_index : int or `~numpy.ndarray`
The HEALPix indices
dx, dy : `~numpy.ndarray`
Offsets inside the HEALPix pixel in the range [0:1], where 0.5 is the
center of the HEALPix pixels
"""
lon = lon.to(u.rad).value
lat = lat.to(u.rad).value
lon, lat = np.broadcast_arrays(lon, lat)
shape = np.shape(lon)
lon = lon.astype(float).ravel()
lat = lat.astype(float).ravel()
> nside = int(nside)
E TypeError: only length-1 arrays can be converted to Python scalars
../../Library/Python/3.6/lib/python/site-packages/astropy_healpix/core.py:273: TypeError
______________________________________ test_hpxgeom_coord_to_idx[8-False-GAL-DISK(110.,75.,10.)-None] _______________________________________
nside = 8, nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)', axes = None
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxgeom_coord_to_idx(nside, nested, coordsys, region, axes):
from astropy_healpix import healpy as hp
> geom = HpxGeom(nside, nested, coordsys, region=region, axes=axes)
gammapy/maps/tests/test_hpx.py:188:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
______________________________________ test_hpxgeom_coord_to_idx[8-False-GAL-DISK(110.,75.,10.)-axes5] ______________________________________
nside = 8, nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)', axes = [<gammapy.maps.geom.MapAxis object at 0x113ba2a20>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxgeom_coord_to_idx(nside, nested, coordsys, region, axes):
from astropy_healpix import healpy as hp
> geom = HpxGeom(nside, nested, coordsys, region=region, axes=axes)
gammapy/maps/tests/test_hpx.py:188:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
___________________________________ test_hpxgeom_coord_to_idx[nside6-False-GAL-DISK(110.,75.,10.)-axes6] ____________________________________
nside = [8, 16, 32], nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)'
axes = [<gammapy.maps.geom.MapAxis object at 0x113ba2a58>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxgeom_coord_to_idx(nside, nested, coordsys, region, axes):
from astropy_healpix import healpy as hp
> geom = HpxGeom(nside, nested, coordsys, region=region, axes=axes)
gammapy/maps/tests/test_hpx.py:188:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
___________________________________ test_hpxgeom_coord_to_idx[nside7-False-GAL-DISK(110.,75.,10.)-axes7] ____________________________________
nside = [[8, 16, 32], [8, 8, 16]], nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)'
axes = [<gammapy.maps.geom.MapAxis object at 0x113ba2a90>, <gammapy.maps.geom.MapAxis object at 0x113ba2ac8>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxgeom_coord_to_idx(nside, nested, coordsys, region, axes):
from astropy_healpix import healpy as hp
> geom = HpxGeom(nside, nested, coordsys, region=region, axes=axes)
gammapy/maps/tests/test_hpx.py:188:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
_________________________________________________________ test_hpxgeom_coord_to_pix _________________________________________________________
def test_hpxgeom_coord_to_pix():
lon = np.array([110.25, 114., 105.])
lat = np.array([75.3, 75.3, 74.6])
z0 = np.array([0.5, 1.5, 2.5])
z1 = np.array([3.5, 4.5, 5.5])
ax0 = np.linspace(0., 3., 4)
ax1 = np.linspace(3., 6., 4)
pix64 = np.array([784, 785, 864])
# 2D all-sky
coords = (lon, lat)
hpx = HpxGeom(64, False, 'GAL')
assert_allclose(hpx.coord_to_pix(coords)[0], pix64)
# 2D partial-sky
coords = (lon, lat)
> hpx = HpxGeom(64, False, 'GAL', region='DISK(110.,75.,2.)')
gammapy/maps/tests/test_hpx.py:233:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 64, nest = False, region = 'DISK(110.,75.,2.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
___________________________________________________________ test_hpxgeom_make_wcs ___________________________________________________________
def test_hpxgeom_make_wcs():
ax0 = np.linspace(0., 3., 4)
> hpx = HpxGeom(64, False, 'GAL', region='DISK(110.,75.,2.)')
gammapy/maps/tests/test_hpx.py:294:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 64, nest = False, region = 'DISK(110.,75.,2.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
__________________________________________________________ test_hpxgeom_get_coords __________________________________________________________
def test_hpxgeom_get_coords():
ax0 = np.linspace(0., 3., 4)
# 2D all-sky
hpx = HpxGeom(16, False, 'GAL')
c = hpx.get_coords()
assert_allclose(c[0][:3], np.array([45., 135., 225.]))
assert_allclose(c[1][:3], np.array([87.075819, 87.075819, 87.075819]))
# 3D all-sky
hpx = HpxGeom(16, False, 'GAL', axes=[ax0])
c = hpx.get_coords()
assert_allclose(c[0][:3], np.array([45., 135., 225.]))
assert_allclose(c[1][:3], np.array([87.075819, 87.075819, 87.075819]))
assert_allclose(c[2][:3], np.array([0.5, 0.5, 0.5]))
# 2D partial-sky
> hpx = HpxGeom(64, False, 'GAL', region='DISK(110.,75.,2.)')
gammapy/maps/tests/test_hpx.py:320:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 64, nest = False, region = 'DISK(110.,75.,2.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
_______________________________________________ test_hpxgeom_contains[8-False-GAL-None-axes1] _______________________________________________
nside = 8, nested = False, coordsys = 'GAL', region = None, axes = [<gammapy.maps.geom.MapAxis object at 0x113ba2940>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxgeom_contains(nside, nested, coordsys, region, axes):
geom = HpxGeom(nside, nested, coordsys, region=region, axes=axes)
coords = geom.get_coords()
assert_allclose(geom.contains(coords), np.ones(
coords[0].shape, dtype=bool))
if axes is not None:
coords = [c[0] for c in coords[:2]] + \
[ax.edges[-1] + 1.0 for ax in axes]
> assert_allclose(geom.contains(coords), np.zeros((1,), dtype=bool))
gammapy/maps/tests/test_hpx.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:1371: in contains
idx = self.coord_to_idx(coords)
gammapy/maps/geom.py:809: in coord_to_idx
return self.pix_to_idx(pix)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <gammapy.maps.hpx.HpxGeom object at 0x113e1ae48>, pix = (0, array([ 2.50111111]))
def pix_to_idx(self, pix):
# FIXME: Correctly apply bounds on non-spatial pixel
# coordinates
idx = list(pix_tuple_to_idx(pix))
idx_local = self.global_to_local(idx)
for i, _ in enumerate(idx):
> idx[i][(idx_local[i] < 0) | (idx[i] < 0)] = -1
E IndexError: too many indices for array
gammapy/maps/hpx.py:653: IndexError
____________________________________________ test_hpxgeom_contains[nside2-False-GAL-None-axes2] _____________________________________________
nside = [2, 4, 8], nested = False, coordsys = 'GAL', region = None, axes = [<gammapy.maps.geom.MapAxis object at 0x113ba24e0>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxgeom_contains(nside, nested, coordsys, region, axes):
geom = HpxGeom(nside, nested, coordsys, region=region, axes=axes)
> coords = geom.get_coords()
gammapy/maps/tests/test_hpx.py:345:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:1367: in get_coords
return self.pix_to_coord(pix)
gammapy/maps/hpx.py:636: in pix_to_coord
theta, phi = hp.pix2ang(nside, ipix, nest=self.nest)
../../Library/Python/3.6/lib/python/site-packages/astropy_healpix/healpy.py:82: in pix2ang
lon, lat = healpix_to_lonlat(ipix, nside, order='nested' if nest else 'ring')
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
healpix_index = array([ 0, 1, 2, ..., 765, 766, 767]), nside = array([2, 2, 2, ..., 8, 8, 8]), dx = None, dy = None, order = 'ring'
def healpix_to_lonlat(healpix_index, nside, dx=None, dy=None, order='ring'):
"""
Convert HEALPix indices (optionally with offsets) to longitudes/latitudes.
If no offsets (``dx`` and ``dy``) are provided, the coordinates will default
to those at the center of the HEALPix pixels.
Parameters
----------
healpix_index : int or `~numpy.ndarray`
HEALPix indices (as a scalar or array)
nside : int
Number of pixels along the side of each of the 12 top-level HEALPix tiles
dx, dy : float or `~numpy.ndarray`, optional
Offsets inside the HEALPix pixel, which must be in the range [0:1],
where 0.5 is the center of the HEALPix pixels (as scalars or arrays)
order : { 'nested' | 'ring' }, optional
Order of HEALPix pixels
Returns
-------
lon : :class:`~astropy.coordinates.Longitude`
The longitude values
lat : :class:`~astropy.coordinates.Latitude`
The latitude values
"""
if (dx is None and dy is not None) or (dx is not None and dy is None):
raise ValueError('Either both or neither dx and dy must be specified')
healpix_index = np.asarray(healpix_index, dtype=np.int64)
if dx is None and dy is not None:
dx = 0.5
elif dx is not None and dy is None:
dy = 0.5
if dx is not None:
dx = np.asarray(dx, dtype=np.float)
dy = np.asarray(dy, dtype=np.float)
_validate_offset('x', dx)
_validate_offset('y', dy)
healpix_index, dx, dy = np.broadcast_arrays(healpix_index, dx, dy)
dx = dx.ravel()
dy = dy.ravel()
shape = healpix_index.shape
healpix_index = healpix_index.ravel()
> nside = int(nside)
E TypeError: only length-1 arrays can be converted to Python scalars
../../Library/Python/3.6/lib/python/site-packages/astropy_healpix/core.py:219: TypeError
_______________________________________________ test_hpxgeom_contains[8-False-GAL-None-axes3] _______________________________________________
nside = 8, nested = False, coordsys = 'GAL', region = None
axes = [<gammapy.maps.geom.MapAxis object at 0x113ba2978>, <gammapy.maps.geom.MapAxis object at 0x113ba29e8>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxgeom_contains(nside, nested, coordsys, region, axes):
geom = HpxGeom(nside, nested, coordsys, region=region, axes=axes)
coords = geom.get_coords()
assert_allclose(geom.contains(coords), np.ones(
coords[0].shape, dtype=bool))
if axes is not None:
coords = [c[0] for c in coords[:2]] + \
[ax.edges[-1] + 1.0 for ax in axes]
> assert_allclose(geom.contains(coords), np.zeros((1,), dtype=bool))
gammapy/maps/tests/test_hpx.py:353:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:1371: in contains
idx = self.coord_to_idx(coords)
gammapy/maps/geom.py:809: in coord_to_idx
return self.pix_to_idx(pix)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <gammapy.maps.hpx.HpxGeom object at 0x114037550>, pix = (0, array([ 1.50103266]), array([ 2.51274605]))
def pix_to_idx(self, pix):
# FIXME: Correctly apply bounds on non-spatial pixel
# coordinates
idx = list(pix_tuple_to_idx(pix))
idx_local = self.global_to_local(idx)
for i, _ in enumerate(idx):
> idx[i][(idx_local[i] < 0) | (idx[i] < 0)] = -1
E IndexError: too many indices for array
gammapy/maps/hpx.py:653: IndexError
________________________________________ test_hpxgeom_contains[8-False-GAL-DISK(110.,75.,10.)-None] _________________________________________
nside = 8, nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)', axes = None
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxgeom_contains(nside, nested, coordsys, region, axes):
> geom = HpxGeom(nside, nested, coordsys, region=region, axes=axes)
gammapy/maps/tests/test_hpx.py:344:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
________________________________________ test_hpxgeom_contains[8-False-GAL-DISK(110.,75.,10.)-axes5] ________________________________________
nside = 8, nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)', axes = [<gammapy.maps.geom.MapAxis object at 0x113ba2a20>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxgeom_contains(nside, nested, coordsys, region, axes):
> geom = HpxGeom(nside, nested, coordsys, region=region, axes=axes)
gammapy/maps/tests/test_hpx.py:344:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
_____________________________________ test_hpxgeom_contains[nside6-False-GAL-DISK(110.,75.,10.)-axes6] ______________________________________
nside = [8, 16, 32], nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)'
axes = [<gammapy.maps.geom.MapAxis object at 0x113ba2a58>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxgeom_contains(nside, nested, coordsys, region, axes):
> geom = HpxGeom(nside, nested, coordsys, region=region, axes=axes)
gammapy/maps/tests/test_hpx.py:344:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
_____________________________________ test_hpxgeom_contains[nside7-False-GAL-DISK(110.,75.,10.)-axes7] ______________________________________
nside = [[8, 16, 32], [8, 8, 16]], nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)'
axes = [<gammapy.maps.geom.MapAxis object at 0x113ba2a90>, <gammapy.maps.geom.MapAxis object at 0x113ba2ac8>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxgeom_contains(nside, nested, coordsys, region, axes):
> geom = HpxGeom(nside, nested, coordsys, region=region, axes=axes)
gammapy/maps/tests/test_hpx.py:344:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
_______________________________________________________ test_make_hpx_to_wcs_mapping ________________________________________________________
def test_make_hpx_to_wcs_mapping():
ax0 = np.linspace(0., 1., 3)
> hpx = HpxGeom(16, False, 'GAL', region='DISK(110.,75.,2.)')
gammapy/maps/tests/test_hpx.py:363:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 16, nest = False, region = 'DISK(110.,75.,2.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
_________________________________________________________ test_hpxgeom_from_header __________________________________________________________
def test_hpxgeom_from_header():
pars = {
'HPX_REG': 'DISK(110.,75.,2.)',
'EXTNAME': 'SKYMAP',
'NSIDE': 2 ** 6,
'ORDER': 6,
'PIXTYPE': 'HEALPIX',
'ORDERING': 'RING',
'COORDSYS': 'CEL',
'TTYPE1': 'PIX',
'TFORM1': 'K',
'TTYPE2': 'CHANNEL1',
'TFORM2': 'D',
'INDXSCHM': 'EXPLICIT',
}
header = fits.Header()
header.update(pars)
> hpx = HpxGeom.from_header(header)
gammapy/maps/tests/test_hpx.py:411:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:1021: in from_header
axes=axes, conv=conv)
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 64, nest = False, region = 'DISK(110.,75.,2.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
_______________________________________ test_hpxgeom_read_write[8-False-GAL-DISK(110.,75.,10.)-None] ________________________________________
tmpdir = local('/private/var/folders/sb/4qv5j4m90pz1rw7m70rj1b1r0000gn/T/pytest-of-deil/pytest-22/test_hpxgeom_read_write_8_Fals3')
nside = 8, nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)', axes = None
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxgeom_read_write(tmpdir, nside, nested, coordsys, region, axes):
> geom0 = HpxGeom(nside, nested, coordsys, region=region, axes=axes)
gammapy/maps/tests/test_hpx.py:421:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
_______________________________________ test_hpxgeom_read_write[8-False-GAL-DISK(110.,75.,10.)-axes5] _______________________________________
tmpdir = local('/private/var/folders/sb/4qv5j4m90pz1rw7m70rj1b1r0000gn/T/pytest-of-deil/pytest-22/test_hpxgeom_read_write_8_Fals4')
nside = 8, nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)', axes = [<gammapy.maps.geom.MapAxis object at 0x113ba2a20>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxgeom_read_write(tmpdir, nside, nested, coordsys, region, axes):
> geom0 = HpxGeom(nside, nested, coordsys, region=region, axes=axes)
gammapy/maps/tests/test_hpx.py:421:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
____________________________________ test_hpxgeom_read_write[nside6-False-GAL-DISK(110.,75.,10.)-axes6] _____________________________________
tmpdir = local('/private/var/folders/sb/4qv5j4m90pz1rw7m70rj1b1r0000gn/T/pytest-of-deil/pytest-22/test_hpxgeom_read_write_nside60')
nside = [8, 16, 32], nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)'
axes = [<gammapy.maps.geom.MapAxis object at 0x113ba2a58>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxgeom_read_write(tmpdir, nside, nested, coordsys, region, axes):
> geom0 = HpxGeom(nside, nested, coordsys, region=region, axes=axes)
gammapy/maps/tests/test_hpx.py:421:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
____________________________________ test_hpxgeom_read_write[nside7-False-GAL-DISK(110.,75.,10.)-axes7] _____________________________________
tmpdir = local('/private/var/folders/sb/4qv5j4m90pz1rw7m70rj1b1r0000gn/T/pytest-of-deil/pytest-22/test_hpxgeom_read_write_nside70')
nside = [[8, 16, 32], [8, 8, 16]], nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)'
axes = [<gammapy.maps.geom.MapAxis object at 0x113ba2a90>, <gammapy.maps.geom.MapAxis object at 0x113ba2ac8>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxgeom_read_write(tmpdir, nside, nested, coordsys, region, axes):
> geom0 = HpxGeom(nside, nested, coordsys, region=region, axes=axes)
gammapy/maps/tests/test_hpx.py:421:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
__________________________________________ test_hpxcube_init[8-False-GAL-DISK(110.,75.,10.)-axes3] __________________________________________
nside = 8, nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)', axes = [<gammapy.maps.geom.MapAxis object at 0x113bee5f8>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxcube_init(nside, nested, coordsys, region, axes):
geom = HpxGeom(nside=nside, nest=nested,
> coordsys=coordsys, region=region, axes=axes)
gammapy/maps/tests/test_hpxcube.py:31:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
__________________________________________ test_hpxcube_init[8-False-GAL-DISK(110.,75.,10.)-axes4] __________________________________________
nside = 8, nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)'
axes = [<gammapy.maps.geom.MapAxis object at 0x113bee630>, <gammapy.maps.geom.MapAxis object at 0x113bee668>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxcube_init(nside, nested, coordsys, region, axes):
geom = HpxGeom(nside=nside, nest=nested,
> coordsys=coordsys, region=region, axes=axes)
gammapy/maps/tests/test_hpxcube.py:31:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
_________________________________________ test_hpxcube_create[8-False-GAL-DISK(110.,75.,10.)-axes3] _________________________________________
nside = 8, nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)', axes = [<gammapy.maps.geom.MapAxis object at 0x113bee5f8>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxcube_create(nside, nested, coordsys, region, axes):
m = HpxMapND.create(nside=nside, nest=nested, coordsys=coordsys,
> region=region, axes=axes)
gammapy/maps/tests/test_hpxcube.py:47:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpxmap.py:76: in create
conv=None, axes=axes, skydir=skydir, width=width)
gammapy/maps/hpx.py:920: in create
axes=axes, conv=conv)
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
_________________________________________ test_hpxcube_create[8-False-GAL-DISK(110.,75.,10.)-axes4] _________________________________________
nside = 8, nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)'
axes = [<gammapy.maps.geom.MapAxis object at 0x113bee630>, <gammapy.maps.geom.MapAxis object at 0x113bee668>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxcube_create(nside, nested, coordsys, region, axes):
m = HpxMapND.create(nside=nside, nest=nested, coordsys=coordsys,
> region=region, axes=axes)
gammapy/maps/tests/test_hpxcube.py:47:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpxmap.py:76: in create
conv=None, axes=axes, skydir=skydir, width=width)
gammapy/maps/hpx.py:920: in create
axes=axes, conv=conv)
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
_______________________________________ test_hpxcube_read_write[8-False-GAL-DISK(110.,75.,10.)-axes3] _______________________________________
tmpdir = local('/private/var/folders/sb/4qv5j4m90pz1rw7m70rj1b1r0000gn/T/pytest-of-deil/pytest-22/test_hpxcube_read_write_8_Fals2')
nside = 8, nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)', axes = [<gammapy.maps.geom.MapAxis object at 0x113bee5f8>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxcube_read_write(tmpdir, nside, nested, coordsys, region, axes):
filename = str(tmpdir / 'skycube.fits')
m = HpxMapND(HpxGeom(nside=nside, nest=nested,
> coordsys=coordsys, region=region, axes=axes))
gammapy/maps/tests/test_hpxcube.py:55:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
_______________________________________ test_hpxcube_read_write[8-False-GAL-DISK(110.,75.,10.)-axes4] _______________________________________
tmpdir = local('/private/var/folders/sb/4qv5j4m90pz1rw7m70rj1b1r0000gn/T/pytest-of-deil/pytest-22/test_hpxcube_read_write_8_Fals3')
nside = 8, nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)'
axes = [<gammapy.maps.geom.MapAxis object at 0x113bee630>, <gammapy.maps.geom.MapAxis object at 0x113bee668>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxcube_read_write(tmpdir, nside, nested, coordsys, region, axes):
filename = str(tmpdir / 'skycube.fits')
m = HpxMapND(HpxGeom(nside=nside, nest=nested,
> coordsys=coordsys, region=region, axes=axes))
gammapy/maps/tests/test_hpxcube.py:55:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
_________________________________________ test_hpxcube_set_get_by_pix[nside2-False-GAL-None-axes2] __________________________________________
nside = [4, 8], nested = False, coordsys = 'GAL', region = None, axes = [<gammapy.maps.geom.MapAxis object at 0x113bee4e0>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxcube_set_get_by_pix(nside, nested, coordsys, region, axes):
m = HpxMapND(HpxGeom(nside=nside, nest=nested,
coordsys=coordsys, region=region, axes=axes))
> coords = m.hpx.get_coords()
gammapy/maps/tests/test_hpxcube.py:70:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:1367: in get_coords
return self.pix_to_coord(pix)
gammapy/maps/hpx.py:636: in pix_to_coord
theta, phi = hp.pix2ang(nside, ipix, nest=self.nest)
../../Library/Python/3.6/lib/python/site-packages/astropy_healpix/healpy.py:82: in pix2ang
lon, lat = healpix_to_lonlat(ipix, nside, order='nested' if nest else 'ring')
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
healpix_index = array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15, 16, 17, 18, 19, 20,..., 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756,
757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767])
nside = array([4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,... 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8])
dx = None, dy = None, order = 'ring'
def healpix_to_lonlat(healpix_index, nside, dx=None, dy=None, order='ring'):
"""
Convert HEALPix indices (optionally with offsets) to longitudes/latitudes.
If no offsets (``dx`` and ``dy``) are provided, the coordinates will default
to those at the center of the HEALPix pixels.
Parameters
----------
healpix_index : int or `~numpy.ndarray`
HEALPix indices (as a scalar or array)
nside : int
Number of pixels along the side of each of the 12 top-level HEALPix tiles
dx, dy : float or `~numpy.ndarray`, optional
Offsets inside the HEALPix pixel, which must be in the range [0:1],
where 0.5 is the center of the HEALPix pixels (as scalars or arrays)
order : { 'nested' | 'ring' }, optional
Order of HEALPix pixels
Returns
-------
lon : :class:`~astropy.coordinates.Longitude`
The longitude values
lat : :class:`~astropy.coordinates.Latitude`
The latitude values
"""
if (dx is None and dy is not None) or (dx is not None and dy is None):
raise ValueError('Either both or neither dx and dy must be specified')
healpix_index = np.asarray(healpix_index, dtype=np.int64)
if dx is None and dy is not None:
dx = 0.5
elif dx is not None and dy is None:
dy = 0.5
if dx is not None:
dx = np.asarray(dx, dtype=np.float)
dy = np.asarray(dy, dtype=np.float)
_validate_offset('x', dx)
_validate_offset('y', dy)
healpix_index, dx, dy = np.broadcast_arrays(healpix_index, dx, dy)
dx = dx.ravel()
dy = dy.ravel()
shape = healpix_index.shape
healpix_index = healpix_index.ravel()
> nside = int(nside)
E TypeError: only length-1 arrays can be converted to Python scalars
../../Library/Python/3.6/lib/python/site-packages/astropy_healpix/core.py:219: TypeError
_____________________________________ test_hpxcube_set_get_by_pix[8-False-GAL-DISK(110.,75.,10.)-axes3] _____________________________________
nside = 8, nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)', axes = [<gammapy.maps.geom.MapAxis object at 0x113bee5f8>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxcube_set_get_by_pix(nside, nested, coordsys, region, axes):
m = HpxMapND(HpxGeom(nside=nside, nest=nested,
> coordsys=coordsys, region=region, axes=axes))
gammapy/maps/tests/test_hpxcube.py:69:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
_____________________________________ test_hpxcube_set_get_by_pix[8-False-GAL-DISK(110.,75.,10.)-axes4] _____________________________________
nside = 8, nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)'
axes = [<gammapy.maps.geom.MapAxis object at 0x113bee630>, <gammapy.maps.geom.MapAxis object at 0x113bee668>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxcube_set_get_by_pix(nside, nested, coordsys, region, axes):
m = HpxMapND(HpxGeom(nside=nside, nest=nested,
> coordsys=coordsys, region=region, axes=axes))
gammapy/maps/tests/test_hpxcube.py:69:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
________________________________________ test_hpxcube_set_get_by_coords[nside2-False-GAL-None-axes2] ________________________________________
nside = [4, 8], nested = False, coordsys = 'GAL', region = None, axes = [<gammapy.maps.geom.MapAxis object at 0x113bee4e0>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxcube_set_get_by_coords(nside, nested, coordsys, region, axes):
m = HpxMapND(HpxGeom(nside=nside, nest=nested,
coordsys=coordsys, region=region, axes=axes))
> coords = m.hpx.get_coords()
gammapy/maps/tests/test_hpxcube.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:1367: in get_coords
return self.pix_to_coord(pix)
gammapy/maps/hpx.py:636: in pix_to_coord
theta, phi = hp.pix2ang(nside, ipix, nest=self.nest)
../../Library/Python/3.6/lib/python/site-packages/astropy_healpix/healpy.py:82: in pix2ang
lon, lat = healpix_to_lonlat(ipix, nside, order='nested' if nest else 'ring')
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
healpix_index = array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15, 16, 17, 18, 19, 20,..., 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756,
757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767])
nside = array([4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,... 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8])
dx = None, dy = None, order = 'ring'
def healpix_to_lonlat(healpix_index, nside, dx=None, dy=None, order='ring'):
"""
Convert HEALPix indices (optionally with offsets) to longitudes/latitudes.
If no offsets (``dx`` and ``dy``) are provided, the coordinates will default
to those at the center of the HEALPix pixels.
Parameters
----------
healpix_index : int or `~numpy.ndarray`
HEALPix indices (as a scalar or array)
nside : int
Number of pixels along the side of each of the 12 top-level HEALPix tiles
dx, dy : float or `~numpy.ndarray`, optional
Offsets inside the HEALPix pixel, which must be in the range [0:1],
where 0.5 is the center of the HEALPix pixels (as scalars or arrays)
order : { 'nested' | 'ring' }, optional
Order of HEALPix pixels
Returns
-------
lon : :class:`~astropy.coordinates.Longitude`
The longitude values
lat : :class:`~astropy.coordinates.Latitude`
The latitude values
"""
if (dx is None and dy is not None) or (dx is not None and dy is None):
raise ValueError('Either both or neither dx and dy must be specified')
healpix_index = np.asarray(healpix_index, dtype=np.int64)
if dx is None and dy is not None:
dx = 0.5
elif dx is not None and dy is None:
dy = 0.5
if dx is not None:
dx = np.asarray(dx, dtype=np.float)
dy = np.asarray(dy, dtype=np.float)
_validate_offset('x', dx)
_validate_offset('y', dy)
healpix_index, dx, dy = np.broadcast_arrays(healpix_index, dx, dy)
dx = dx.ravel()
dy = dy.ravel()
shape = healpix_index.shape
healpix_index = healpix_index.ravel()
> nside = int(nside)
E TypeError: only length-1 arrays can be converted to Python scalars
../../Library/Python/3.6/lib/python/site-packages/astropy_healpix/core.py:219: TypeError
___________________________________ test_hpxcube_set_get_by_coords[8-False-GAL-DISK(110.,75.,10.)-axes3] ____________________________________
nside = 8, nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)', axes = [<gammapy.maps.geom.MapAxis object at 0x113bee5f8>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxcube_set_get_by_coords(nside, nested, coordsys, region, axes):
m = HpxMapND(HpxGeom(nside=nside, nest=nested,
> coordsys=coordsys, region=region, axes=axes))
gammapy/maps/tests/test_hpxcube.py:80:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
___________________________________ test_hpxcube_set_get_by_coords[8-False-GAL-DISK(110.,75.,10.)-axes4] ____________________________________
nside = 8, nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)'
axes = [<gammapy.maps.geom.MapAxis object at 0x113bee630>, <gammapy.maps.geom.MapAxis object at 0x113bee668>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxcube_set_get_by_coords(nside, nested, coordsys, region, axes):
m = HpxMapND(HpxGeom(nside=nside, nest=nested,
> coordsys=coordsys, region=region, axes=axes))
gammapy/maps/tests/test_hpxcube.py:80:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
_________________________________________ test_hpxcube_fill_by_coords[nside2-False-GAL-None-axes2] __________________________________________
nside = [4, 8], nested = False, coordsys = 'GAL', region = None, axes = [<gammapy.maps.geom.MapAxis object at 0x113bee4e0>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxcube_fill_by_coords(nside, nested, coordsys, region, axes):
m = HpxMapND(HpxGeom(nside=nside, nest=nested,
coordsys=coordsys, region=region, axes=axes))
> coords = m.hpx.get_coords()
gammapy/maps/tests/test_hpxcube.py:103:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:1367: in get_coords
return self.pix_to_coord(pix)
gammapy/maps/hpx.py:636: in pix_to_coord
theta, phi = hp.pix2ang(nside, ipix, nest=self.nest)
../../Library/Python/3.6/lib/python/site-packages/astropy_healpix/healpy.py:82: in pix2ang
lon, lat = healpix_to_lonlat(ipix, nside, order='nested' if nest else 'ring')
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
healpix_index = array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15, 16, 17, 18, 19, 20,..., 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756,
757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767])
nside = array([4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,... 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8])
dx = None, dy = None, order = 'ring'
def healpix_to_lonlat(healpix_index, nside, dx=None, dy=None, order='ring'):
"""
Convert HEALPix indices (optionally with offsets) to longitudes/latitudes.
If no offsets (``dx`` and ``dy``) are provided, the coordinates will default
to those at the center of the HEALPix pixels.
Parameters
----------
healpix_index : int or `~numpy.ndarray`
HEALPix indices (as a scalar or array)
nside : int
Number of pixels along the side of each of the 12 top-level HEALPix tiles
dx, dy : float or `~numpy.ndarray`, optional
Offsets inside the HEALPix pixel, which must be in the range [0:1],
where 0.5 is the center of the HEALPix pixels (as scalars or arrays)
order : { 'nested' | 'ring' }, optional
Order of HEALPix pixels
Returns
-------
lon : :class:`~astropy.coordinates.Longitude`
The longitude values
lat : :class:`~astropy.coordinates.Latitude`
The latitude values
"""
if (dx is None and dy is not None) or (dx is not None and dy is None):
raise ValueError('Either both or neither dx and dy must be specified')
healpix_index = np.asarray(healpix_index, dtype=np.int64)
if dx is None and dy is not None:
dx = 0.5
elif dx is not None and dy is None:
dy = 0.5
if dx is not None:
dx = np.asarray(dx, dtype=np.float)
dy = np.asarray(dy, dtype=np.float)
_validate_offset('x', dx)
_validate_offset('y', dy)
healpix_index, dx, dy = np.broadcast_arrays(healpix_index, dx, dy)
dx = dx.ravel()
dy = dy.ravel()
shape = healpix_index.shape
healpix_index = healpix_index.ravel()
> nside = int(nside)
E TypeError: only length-1 arrays can be converted to Python scalars
../../Library/Python/3.6/lib/python/site-packages/astropy_healpix/core.py:219: TypeError
_____________________________________ test_hpxcube_fill_by_coords[8-False-GAL-DISK(110.,75.,10.)-axes3] _____________________________________
nside = 8, nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)', axes = [<gammapy.maps.geom.MapAxis object at 0x113bee5f8>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxcube_fill_by_coords(nside, nested, coordsys, region, axes):
m = HpxMapND(HpxGeom(nside=nside, nest=nested,
> coordsys=coordsys, region=region, axes=axes))
gammapy/maps/tests/test_hpxcube.py:102:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
_____________________________________ test_hpxcube_fill_by_coords[8-False-GAL-DISK(110.,75.,10.)-axes4] _____________________________________
nside = 8, nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)'
axes = [<gammapy.maps.geom.MapAxis object at 0x113bee630>, <gammapy.maps.geom.MapAxis object at 0x113bee668>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxcube_fill_by_coords(nside, nested, coordsys, region, axes):
m = HpxMapND(HpxGeom(nside=nside, nest=nested,
> coordsys=coordsys, region=region, axes=axes))
gammapy/maps/tests/test_hpxcube.py:102:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
______________________________________________ test_hpxcube_iter[nside2-False-GAL-None-axes2] _______________________________________________
nside = [4, 8], nested = False, coordsys = 'GAL', region = None, axes = [<gammapy.maps.geom.MapAxis object at 0x113bee4e0>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxcube_iter(nside, nested, coordsys, region, axes):
m = HpxMapND(HpxGeom(nside=nside, nest=nested,
coordsys=coordsys, region=region, axes=axes))
> coords = m.geom.get_coords()
gammapy/maps/tests/test_hpxcube.py:114:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:1367: in get_coords
return self.pix_to_coord(pix)
gammapy/maps/hpx.py:636: in pix_to_coord
theta, phi = hp.pix2ang(nside, ipix, nest=self.nest)
../../Library/Python/3.6/lib/python/site-packages/astropy_healpix/healpy.py:82: in pix2ang
lon, lat = healpix_to_lonlat(ipix, nside, order='nested' if nest else 'ring')
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
healpix_index = array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15, 16, 17, 18, 19, 20,..., 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756,
757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767])
nside = array([4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,... 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8])
dx = None, dy = None, order = 'ring'
def healpix_to_lonlat(healpix_index, nside, dx=None, dy=None, order='ring'):
"""
Convert HEALPix indices (optionally with offsets) to longitudes/latitudes.
If no offsets (``dx`` and ``dy``) are provided, the coordinates will default
to those at the center of the HEALPix pixels.
Parameters
----------
healpix_index : int or `~numpy.ndarray`
HEALPix indices (as a scalar or array)
nside : int
Number of pixels along the side of each of the 12 top-level HEALPix tiles
dx, dy : float or `~numpy.ndarray`, optional
Offsets inside the HEALPix pixel, which must be in the range [0:1],
where 0.5 is the center of the HEALPix pixels (as scalars or arrays)
order : { 'nested' | 'ring' }, optional
Order of HEALPix pixels
Returns
-------
lon : :class:`~astropy.coordinates.Longitude`
The longitude values
lat : :class:`~astropy.coordinates.Latitude`
The latitude values
"""
if (dx is None and dy is not None) or (dx is not None and dy is None):
raise ValueError('Either both or neither dx and dy must be specified')
healpix_index = np.asarray(healpix_index, dtype=np.int64)
if dx is None and dy is not None:
dx = 0.5
elif dx is not None and dy is None:
dy = 0.5
if dx is not None:
dx = np.asarray(dx, dtype=np.float)
dy = np.asarray(dy, dtype=np.float)
_validate_offset('x', dx)
_validate_offset('y', dy)
healpix_index, dx, dy = np.broadcast_arrays(healpix_index, dx, dy)
dx = dx.ravel()
dy = dy.ravel()
shape = healpix_index.shape
healpix_index = healpix_index.ravel()
> nside = int(nside)
E TypeError: only length-1 arrays can be converted to Python scalars
../../Library/Python/3.6/lib/python/site-packages/astropy_healpix/core.py:219: TypeError
__________________________________________ test_hpxcube_iter[8-False-GAL-DISK(110.,75.,10.)-axes3] __________________________________________
nside = 8, nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)', axes = [<gammapy.maps.geom.MapAxis object at 0x113bee5f8>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxcube_iter(nside, nested, coordsys, region, axes):
m = HpxMapND(HpxGeom(nside=nside, nest=nested,
> coordsys=coordsys, region=region, axes=axes))
gammapy/maps/tests/test_hpxcube.py:113:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
__________________________________________ test_hpxcube_iter[8-False-GAL-DISK(110.,75.,10.)-axes4] __________________________________________
nside = 8, nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)'
axes = [<gammapy.maps.geom.MapAxis object at 0x113bee630>, <gammapy.maps.geom.MapAxis object at 0x113bee668>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxcube_iter(nside, nested, coordsys, region, axes):
m = HpxMapND(HpxGeom(nside=nside, nest=nested,
> coordsys=coordsys, region=region, axes=axes))
gammapy/maps/tests/test_hpxcube.py:113:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
_____________________________________________ test_hpxcube_to_wcs[nside2-False-GAL-None-axes2] ______________________________________________
nside = [4, 8], nested = False, coordsys = 'GAL', region = None, axes = [<gammapy.maps.geom.MapAxis object at 0x113bee4e0>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxcube_to_wcs(nside, nested, coordsys, region, axes):
m = HpxMapND(HpxGeom(nside=nside, nest=nested,
coordsys=coordsys, region=region, axes=axes))
> m_wcs = m.to_wcs(sum_bands=False, oversample=2, normalize=False)
gammapy/maps/tests/test_hpxcube.py:127:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpxcube.py:135: in to_wcs
self.make_wcs_mapping(oversample=oversample, proj=proj)
gammapy/maps/hpxcube.py:123: in make_wcs_mapping
self._hpx2wcs = HpxToWcsMapping.create(self.hpx, self._wcs2d)
gammapy/maps/hpx.py:1478: in create
ipix, mult_val, npix = make_hpx_to_wcs_mapping(hpx, wcs)
gammapy/maps/hpx.py:288: in make_hpx_to_wcs_mapping
hpx.nest).flatten()
../../Library/Python/3.6/lib/python/site-packages/astropy_healpix/healpy.py:97: in ang2pix
return lonlat_to_healpix(lon, lat, nside, order='nested' if nest else 'ring')
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
lon = array([ 3.14025542, 3.13047409, 3.12316943, ..., 3.16001588,
3.15271122, 3.14292989])
lat = array([-0.11133886, -0.08673701, -0.06202949, ..., 0.06202949,
0.08673701, 0.11133886]), nside = array([[4],
[8]])
return_offsets = False, order = 'ring'
def lonlat_to_healpix(lon, lat, nside, return_offsets=False, order='ring'):
"""
Convert longitudes/latitudes to HEALPix indices
Parameters
----------
lon, lat : :class:`~astropy.units.Quantity`
The longitude and latitude values as :class:`~astropy.units.Quantity`
instances with angle units.
nside : int
Number of pixels along the side of each of the 12 top-level HEALPix tiles
order : { 'nested' | 'ring' }
Order of HEALPix pixels
return_offsets : bool, optional
If `True`, the returned values are the HEALPix pixel indices as well as
``dx`` and ``dy``, the fractional positions inside the pixels. If
`False` (the default), only the HEALPix pixel indices is returned.
Returns
-------
healpix_index : int or `~numpy.ndarray`
The HEALPix indices
dx, dy : `~numpy.ndarray`
Offsets inside the HEALPix pixel in the range [0:1], where 0.5 is the
center of the HEALPix pixels
"""
lon = lon.to(u.rad).value
lat = lat.to(u.rad).value
lon, lat = np.broadcast_arrays(lon, lat)
shape = np.shape(lon)
lon = lon.astype(float).ravel()
lat = lat.astype(float).ravel()
> nside = int(nside)
E TypeError: only length-1 arrays can be converted to Python scalars
../../Library/Python/3.6/lib/python/site-packages/astropy_healpix/core.py:273: TypeError
_________________________________________ test_hpxcube_to_wcs[8-False-GAL-DISK(110.,75.,10.)-axes3] _________________________________________
nside = 8, nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)', axes = [<gammapy.maps.geom.MapAxis object at 0x113bee5f8>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxcube_to_wcs(nside, nested, coordsys, region, axes):
m = HpxMapND(HpxGeom(nside=nside, nest=nested,
> coordsys=coordsys, region=region, axes=axes))
gammapy/maps/tests/test_hpxcube.py:126:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
_________________________________________ test_hpxcube_to_wcs[8-False-GAL-DISK(110.,75.,10.)-axes4] _________________________________________
nside = 8, nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)'
axes = [<gammapy.maps.geom.MapAxis object at 0x113bee630>, <gammapy.maps.geom.MapAxis object at 0x113bee668>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxcube_to_wcs(nside, nested, coordsys, region, axes):
m = HpxMapND(HpxGeom(nside=nside, nest=nested,
> coordsys=coordsys, region=region, axes=axes))
gammapy/maps/tests/test_hpxcube.py:126:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
___________________________________________ test_hpxcube_swap_scheme[nside2-False-GAL-None-axes2] ___________________________________________
nside = [4, 8], nested = False, coordsys = 'GAL', region = None, axes = [<gammapy.maps.geom.MapAxis object at 0x113bee4e0>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxcube_swap_scheme(nside, nested, coordsys, region, axes):
m = HpxMapND(HpxGeom(nside=nside, nest=nested,
coordsys=coordsys, region=region, axes=axes))
m.fill_poisson(1.0)
> m2 = m.to_swapped_scheme()
gammapy/maps/tests/test_hpxcube.py:137:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpxcube.py:391: in to_swapped_scheme
idx_new = tuple([hp.ring2nest(nside, idx[0])] + idx[1:])
../../Library/Python/3.6/lib/python/site-packages/astropy_healpix/healpy.py:109: in ring2nest
return ring_to_nested(ipix, nside)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
ring_index = array([ 0, 1, 4, 5, 6, 7, 8, 10, 12, 13, 14, 15, 16,
17, 18, 19, 22, 26, 28, 29, 33,..., 737, 739, 740, 742, 743, 745, 746, 747, 750, 751,
752, 753, 754, 755, 757, 760, 761, 762, 763, 764, 765, 767])
nside = array([4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,... 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8])
def ring_to_nested(ring_index, nside):
"""
Convert a HEALPix 'ring' index to a HEALPix 'nested' index
Parameters
----------
ring_index : int or `~numpy.ndarray`
Healpix index using the 'ring' ordering
nside : int
Number of pixels along the side of each of the 12 top-level HEALPix tiles
Returns
-------
nested_index : int or `~numpy.ndarray`
Healpix index using the 'nested' ordering
"""
ring_index = np.asarray(ring_index, dtype=np.int64)
shape = ring_index.shape
ring_index = ring_index.ravel()
> nside = int(nside)
E TypeError: only length-1 arrays can be converted to Python scalars
../../Library/Python/3.6/lib/python/site-packages/astropy_healpix/core.py:334: TypeError
______________________________________ test_hpxcube_swap_scheme[8-False-GAL-DISK(110.,75.,10.)-axes3] _______________________________________
nside = 8, nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)', axes = [<gammapy.maps.geom.MapAxis object at 0x113bee5f8>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxcube_swap_scheme(nside, nested, coordsys, region, axes):
m = HpxMapND(HpxGeom(nside=nside, nest=nested,
> coordsys=coordsys, region=region, axes=axes))
gammapy/maps/tests/test_hpxcube.py:135:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
______________________________________ test_hpxcube_swap_scheme[8-False-GAL-DISK(110.,75.,10.)-axes4] _______________________________________
nside = 8, nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)'
axes = [<gammapy.maps.geom.MapAxis object at 0x113bee630>, <gammapy.maps.geom.MapAxis object at 0x113bee668>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxcube_swap_scheme(nside, nested, coordsys, region, axes):
m = HpxMapND(HpxGeom(nside=nside, nest=nested,
> coordsys=coordsys, region=region, axes=axes))
gammapy/maps/tests/test_hpxcube.py:135:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
____________________________________________ test_hpxcube_ud_grade[nside2-False-GAL-None-axes2] _____________________________________________
nside = [4, 8], nested = False, coordsys = 'GAL', region = None, axes = [<gammapy.maps.geom.MapAxis object at 0x113bee4e0>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxcube_ud_grade(nside, nested, coordsys, region, axes):
m = HpxMapND(HpxGeom(nside=nside, nest=nested,
coordsys=coordsys, region=region, axes=axes))
> m.to_ud_graded(4)
gammapy/maps/tests/test_hpxcube.py:147:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpxcube.py:410: in to_ud_graded
coords = self.hpx.get_coords()
gammapy/maps/hpx.py:1367: in get_coords
return self.pix_to_coord(pix)
gammapy/maps/hpx.py:636: in pix_to_coord
theta, phi = hp.pix2ang(nside, ipix, nest=self.nest)
../../Library/Python/3.6/lib/python/site-packages/astropy_healpix/healpy.py:82: in pix2ang
lon, lat = healpix_to_lonlat(ipix, nside, order='nested' if nest else 'ring')
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
healpix_index = array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15, 16, 17, 18, 19, 20,..., 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756,
757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767])
nside = array([4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,... 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8])
dx = None, dy = None, order = 'ring'
def healpix_to_lonlat(healpix_index, nside, dx=None, dy=None, order='ring'):
"""
Convert HEALPix indices (optionally with offsets) to longitudes/latitudes.
If no offsets (``dx`` and ``dy``) are provided, the coordinates will default
to those at the center of the HEALPix pixels.
Parameters
----------
healpix_index : int or `~numpy.ndarray`
HEALPix indices (as a scalar or array)
nside : int
Number of pixels along the side of each of the 12 top-level HEALPix tiles
dx, dy : float or `~numpy.ndarray`, optional
Offsets inside the HEALPix pixel, which must be in the range [0:1],
where 0.5 is the center of the HEALPix pixels (as scalars or arrays)
order : { 'nested' | 'ring' }, optional
Order of HEALPix pixels
Returns
-------
lon : :class:`~astropy.coordinates.Longitude`
The longitude values
lat : :class:`~astropy.coordinates.Latitude`
The latitude values
"""
if (dx is None and dy is not None) or (dx is not None and dy is None):
raise ValueError('Either both or neither dx and dy must be specified')
healpix_index = np.asarray(healpix_index, dtype=np.int64)
if dx is None and dy is not None:
dx = 0.5
elif dx is not None and dy is None:
dy = 0.5
if dx is not None:
dx = np.asarray(dx, dtype=np.float)
dy = np.asarray(dy, dtype=np.float)
_validate_offset('x', dx)
_validate_offset('y', dy)
healpix_index, dx, dy = np.broadcast_arrays(healpix_index, dx, dy)
dx = dx.ravel()
dy = dy.ravel()
shape = healpix_index.shape
healpix_index = healpix_index.ravel()
> nside = int(nside)
E TypeError: only length-1 arrays can be converted to Python scalars
../../Library/Python/3.6/lib/python/site-packages/astropy_healpix/core.py:219: TypeError
________________________________________ test_hpxcube_ud_grade[8-False-GAL-DISK(110.,75.,10.)-axes3] ________________________________________
nside = 8, nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)', axes = [<gammapy.maps.geom.MapAxis object at 0x113bee5f8>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxcube_ud_grade(nside, nested, coordsys, region, axes):
m = HpxMapND(HpxGeom(nside=nside, nest=nested,
> coordsys=coordsys, region=region, axes=axes))
gammapy/maps/tests/test_hpxcube.py:146:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
________________________________________ test_hpxcube_ud_grade[8-False-GAL-DISK(110.,75.,10.)-axes4] ________________________________________
nside = 8, nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)'
axes = [<gammapy.maps.geom.MapAxis object at 0x113bee630>, <gammapy.maps.geom.MapAxis object at 0x113bee668>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxcube_ud_grade(nside, nested, coordsys, region, axes):
m = HpxMapND(HpxGeom(nside=nside, nest=nested,
> coordsys=coordsys, region=region, axes=axes))
gammapy/maps/tests/test_hpxcube.py:146:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
__________________________________________ test_hpxcube_sum_over_axes[nside2-False-GAL-None-axes2] __________________________________________
nside = [4, 8], nested = False, coordsys = 'GAL', region = None, axes = [<gammapy.maps.geom.MapAxis object at 0x113bee4e0>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxcube_sum_over_axes(nside, nested, coordsys, region, axes):
m = HpxMapND(HpxGeom(nside=nside, nest=nested,
coordsys=coordsys, region=region, axes=axes))
> coords = m.geom.get_coords()
gammapy/maps/tests/test_hpxcube.py:155:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:1367: in get_coords
return self.pix_to_coord(pix)
gammapy/maps/hpx.py:636: in pix_to_coord
theta, phi = hp.pix2ang(nside, ipix, nest=self.nest)
../../Library/Python/3.6/lib/python/site-packages/astropy_healpix/healpy.py:82: in pix2ang
lon, lat = healpix_to_lonlat(ipix, nside, order='nested' if nest else 'ring')
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
healpix_index = array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15, 16, 17, 18, 19, 20,..., 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756,
757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767])
nside = array([4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,... 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8])
dx = None, dy = None, order = 'ring'
def healpix_to_lonlat(healpix_index, nside, dx=None, dy=None, order='ring'):
"""
Convert HEALPix indices (optionally with offsets) to longitudes/latitudes.
If no offsets (``dx`` and ``dy``) are provided, the coordinates will default
to those at the center of the HEALPix pixels.
Parameters
----------
healpix_index : int or `~numpy.ndarray`
HEALPix indices (as a scalar or array)
nside : int
Number of pixels along the side of each of the 12 top-level HEALPix tiles
dx, dy : float or `~numpy.ndarray`, optional
Offsets inside the HEALPix pixel, which must be in the range [0:1],
where 0.5 is the center of the HEALPix pixels (as scalars or arrays)
order : { 'nested' | 'ring' }, optional
Order of HEALPix pixels
Returns
-------
lon : :class:`~astropy.coordinates.Longitude`
The longitude values
lat : :class:`~astropy.coordinates.Latitude`
The latitude values
"""
if (dx is None and dy is not None) or (dx is not None and dy is None):
raise ValueError('Either both or neither dx and dy must be specified')
healpix_index = np.asarray(healpix_index, dtype=np.int64)
if dx is None and dy is not None:
dx = 0.5
elif dx is not None and dy is None:
dy = 0.5
if dx is not None:
dx = np.asarray(dx, dtype=np.float)
dy = np.asarray(dy, dtype=np.float)
_validate_offset('x', dx)
_validate_offset('y', dy)
healpix_index, dx, dy = np.broadcast_arrays(healpix_index, dx, dy)
dx = dx.ravel()
dy = dy.ravel()
shape = healpix_index.shape
healpix_index = healpix_index.ravel()
> nside = int(nside)
E TypeError: only length-1 arrays can be converted to Python scalars
../../Library/Python/3.6/lib/python/site-packages/astropy_healpix/core.py:219: TypeError
_____________________________________ test_hpxcube_sum_over_axes[8-False-GAL-DISK(110.,75.,10.)-axes3] ______________________________________
nside = 8, nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)', axes = [<gammapy.maps.geom.MapAxis object at 0x113bee5f8>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxcube_sum_over_axes(nside, nested, coordsys, region, axes):
m = HpxMapND(HpxGeom(nside=nside, nest=nested,
> coordsys=coordsys, region=region, axes=axes))
gammapy/maps/tests/test_hpxcube.py:154:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
_____________________________________ test_hpxcube_sum_over_axes[8-False-GAL-DISK(110.,75.,10.)-axes4] ______________________________________
nside = 8, nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)'
axes = [<gammapy.maps.geom.MapAxis object at 0x113bee630>, <gammapy.maps.geom.MapAxis object at 0x113bee668>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxcube_sum_over_axes(nside, nested, coordsys, region, axes):
m = HpxMapND(HpxGeom(nside=nside, nest=nested,
> coordsys=coordsys, region=region, axes=axes))
gammapy/maps/tests/test_hpxcube.py:154:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
__________________________________________ test_hpxcube_init[8-False-GAL-DISK(110.,75.,10.)-axes2] __________________________________________
nside = 8, nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)', axes = [<gammapy.maps.geom.MapAxis object at 0x113c3f198>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxcube_init(nside, nested, coordsys, region, axes):
> geom = HpxGeom(nside, nested, coordsys, region=region, axes=axes)
gammapy/maps/tests/test_hpxsparse.py:28:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
_______________________________________ test_hpxcube_init[nside3-False-GAL-DISK(110.,75.,10.)-axes3] ________________________________________
nside = [8, 16, 32], nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)'
axes = [<gammapy.maps.geom.MapAxis object at 0x113c3f2b0>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxcube_init(nside, nested, coordsys, region, axes):
> geom = HpxGeom(nside, nested, coordsys, region=region, axes=axes)
gammapy/maps/tests/test_hpxsparse.py:28:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
__________________________________________ test_hpxcube_init[8-False-GAL-DISK(110.,75.,10.)-axes4] __________________________________________
nside = 8, nested = False, coordsys = 'GAL', region = 'DISK(110.,75.,10.)'
axes = [<gammapy.maps.geom.MapAxis object at 0x113c3f2e8>, <gammapy.maps.geom.MapAxis object at 0x113c3f320>]
@pytest.mark.parametrize(('nside', 'nested', 'coordsys', 'region', 'axes'),
hpx_test_geoms)
def test_hpxcube_init(nside, nested, coordsys, region, axes):
> geom = HpxGeom(nside, nested, coordsys, region=region, axes=axes)
gammapy/maps/tests/test_hpxsparse.py:28:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/maps/hpx.py:425: in __init__
self._create_lookup(region)
gammapy/maps/hpx.py:444: in _create_lookup
for nside in self._nside.flat]
gammapy/maps/hpx.py:444: in <listcomp>
for nside in self._nside.flat]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nside = 8, nest = False, region = 'DISK(110.,75.,10.)'
@staticmethod
def get_index_list(nside, nest, region):
"""Get list of pixels indices for all the pixels in a region.
Parameters
----------
nside : int
HEALPIX nside parameter
nest : bool
True for 'NESTED', False = 'RING'
region : str
HEALPIX region string
Returns
-------
ilist : `~numpy.ndarray`
List of pixel indices.
"""
from astropy_healpix import healpy as hp
tokens = parse_hpxregion(region)
if tokens[0] == 'DISK':
vec = coords_to_vec(float(tokens[1]), float(tokens[2]))
> ilist = hp.query_disc(nside, vec[0], np.radians(float(tokens[3])),
E AttributeError: module 'astropy_healpix.healpy' has no attribute 'query_disc'
gammapy/maps/hpx.py:1190: AttributeError
============================================ 67 failed, 172 passed, 13 xfailed in 19.75 seconds =============================================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment