Skip to content

Instantly share code, notes, and snippets.

@cdeil
Created October 18, 2017 11:24
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/cf5c5d39dd87e7c4fe0633bf378d0e61 to your computer and use it in GitHub Desktop.
Save cdeil/cf5c5d39dd87e7c4fe0633bf378d0e61 to your computer and use it in GitHub Desktop.
self = <gammapy.image.tests.test_basic.TestFermiLATBasicImageEstimator object at 0x10d2ac710>
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:572: in run
images['background'] = self.background(dataset)
gammapy/image/basic.py:459: in background
exposure_cube = dataset.exposure.reproject(geom)
gammapy/maps/base.py:251: in reproject
return self._reproject_wcs(geom, mode=mode, order=order)
gammapy/maps/hpxcube.py:214: in _reproject_wcs
zip(geom.axes, self.geom.axes)])
gammapy/maps/hpxcube.py:213: in <listcomp>
axes_eq = np.all([ax0 == ax1 for ax0, ax1 in
gammapy/maps/geom.py:339: in __eq__
return (np.allclose(self._nodes, other._nodes) and
/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/numpy/core/numeric.py:2459: in allclose
res = all(isclose(a, b, rtol=rtol, atol=atol, equal_nan=equal_nan))
/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/numpy/core/numeric.py:2541: in isclose
return within_tol(x, y, atol, rtol)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
x = array([ 5.84731331e+01, 7.99703598e+01, 1.09370895e+02,
1.49580322e+02, 2.04572464e+02, 2.79782074e+... 1.07226313e+05, 1.46647297e+05, 2.00561125e+05,
2.74296000e+05, 3.75138969e+05, 5.13056156e+05])
y = array([ 50000. , 62116.764, 77169.848, 95870.824,
119103.712, 147966.752, 183824.304, 2283...3.136, 543997.696,
675827.52 , 839604.416, 1043070.144, 1295842.944,
1609871.36 , 2000000. ])
atol = 1e-08, rtol = 1e-05
def within_tol(x, y, atol, rtol):
with errstate(invalid='ignore'):
> result = less_equal(abs(x-y), atol + rtol * abs(y))
E ValueError: operands could not be broadcast together with shapes (30,) (18,)
/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/numpy/core/numeric.py:2524: ValueError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment