Skip to content

Instantly share code, notes, and snippets.

@cdeil
Created October 17, 2017 19:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cdeil/19762df1038889985744071c376f9281 to your computer and use it in GitHub Desktop.
Save cdeil/19762df1038889985744071c376f9281 to your computer and use it in GitHub Desktop.
____________________________________________________________ TestFermiLATBasicImageEstimator.test_run _____________________________________________________________
self = <gammapy.image.tests.test_basic.TestFermiLATBasicImageEstimator object at 0x127ccd2b0>
def test_run(self):
images = OrderedDict()
images['counts'] = dict(sum=155.0)
images['background'] = dict(sum=1294.44777903)
images['exposure'] = dict(sum=71671503335592.98)
# Note: excess / flux is negative, because diffuse background
# is overestimated for the Galactic center region used here.
images['excess'] = dict(sum=-1139.44777903)
images['flux'] = dict(sum=-3.67226151181e-09)
images['psf'] = dict(sum=1)
if 'FERMI_DIFFUSE_DIR' in os.environ:
names = list(images.keys())
else:
names = ['counts', 'exposure', 'psf']
results = self.estimator.run(
self.dataset,
> which=names,
)
gammapy/image/tests/test_basic.py:50:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gammapy/image/basic.py:570: in run
images['background'] = self.background(dataset)
gammapy/image/basic.py:456: in background
exposure_cube = dataset.exposure.reproject(background_cube)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <gammapy.maps.hpxcube.HpxMapND object at 0x119ec4198>, geom = <gammapy.cube.core.SkyCube object at 0x119adb940>, order = 1, mode = 'interp'
def reproject(self, geom, order=1, mode='interp'):
"""Reproject this map to a different geometry.
Parameters
----------
geom : `~MapGeom`
Geometry of projection.
mode : str
Method for reprojection. 'interp' method interpolates at pixel
centers. 'exact' method integrates over intersection of pixels.
order : int or str
Order of interpolating polynomial (0 = nearest-neighbor, 1 =
linear, 2 = quadratic, 3 = cubic).
Returns
-------
map : `~MapBase`
Reprojected map.
"""
> if geom.ndim == 2 and self.geom.ndim > 2:
E AttributeError: 'SkyCube' object has no attribute 'ndim'
gammapy/maps/base.py:242: AttributeError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment