Skip to content

Instantly share code, notes, and snippets.

@cdeil
Created October 19, 2017 14:23
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/557cf27eea3750a2636de7337db2b4a8 to your computer and use it in GitHub Desktop.
Save cdeil/557cf27eea3750a2636de7337db2b4a8 to your computer and use it in GitHub Desktop.
In [5]: maps.HpxMapND.read('http://gamma-astro-data-formats.readthedocs.io/en/latest/_downloads/hpx_ccube_implicit.fits')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-5-aade25c1e381> in <module>()
----> 1 maps.HpxMapND.read('http://gamma-astro-data-formats.readthedocs.io/en/latest/_downloads/hpx_ccube_implicit.fits')
~/code/gammapy/gammapy/maps/base.py in read(cls, filename, **kwargs)
124 """
125 with fits.open(filename) as hdulist:
--> 126 map_out = cls.from_hdulist(hdulist, **kwargs)
127 return map_out
128
~/code/gammapy/gammapy/maps/hpxmap.py in from_hdulist(cls, hdulist, hdu, hdu_bands)
118 hdu_bands = hdulist[hdu_bands]
119
--> 120 return cls.from_hdu(hdu, hdu_bands)
121
122 def to_hdulist(self, **kwargs):
~/code/gammapy/gammapy/maps/hpxcube.py in from_hdu(cls, hdu, hdu_bands)
62 The BANDS table HDU
63 """
---> 64 hpx = HpxGeom.from_header(hdu.header, hdu_bands)
65 shape = tuple([ax.nbin for ax in hpx.axes[::-1]])
66 shape_data = shape + tuple([np.max(hpx.npix)])
~/code/gammapy/gammapy/maps/hpx.py in from_header(cls, header, hdu_bands, pix)
997
998 if hdu_bands is not None and 'NSIDE' in hdu_bands.columns.names:
--> 999 nside = hdu_bands.data.field('NSIDE').reshape(shape).astype(int)
1000 elif 'NSIDE' in header:
1001 nside = header['NSIDE']
ValueError: cannot reshape array of size 4 into shape ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment