Skip to content

Commit

Permalink
Change UNIT to BUNIT in gammapy.maps
Browse files Browse the repository at this point in the history
  • Loading branch information
cdeil committed Aug 31, 2018
1 parent 9670707 commit e6a31fb
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gammapy/maps/hpxmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def to_hdulist(self, hdu="SKYMAP", hdu_bands=None, sparse=False, conv=None):

hdu_out = self.make_hdu(hdu=hdu, hdu_bands=hdu_bands, sparse=sparse, conv=conv)
hdu_out.header["META"] = json.dumps(self.meta)
hdu_out.header["UNIT"] = self.unit.to_string("fits")
hdu_out.header["BUNIT"] = self.unit.to_string("fits")

hdu_list = fits.HDUList([fits.PrimaryHDU(), hdu_out])

Expand Down
2 changes: 1 addition & 1 deletion gammapy/maps/hpxnd.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def from_hdu(cls, hdu, hdu_bands=None):

meta = cls._get_meta_from_header(hdu.header)

unit = hdu.header.get("UNIT", "")
unit = hdu.header.get("BUNIT", "")
map_out = cls(hpx, None, meta=meta, unit=unit)

colnames = hdu.columns.names
Expand Down
2 changes: 1 addition & 1 deletion gammapy/maps/tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def test_map_unit_read_write(map_type, unit):
hdu_list = m.to_hdulist(hdu='COUNTS')
header = hdu_list['COUNTS'].header

assert Unit(header['UNIT']) == Unit(unit)
assert Unit(header['BUNIT']) == Unit(unit)

m2 = Map.from_hdulist(hdu_list)
assert m2.unit == unit
Expand Down
2 changes: 1 addition & 1 deletion gammapy/maps/wcsmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def to_hdulist(self, hdu=None, hdu_bands=None, sparse=False, conv=None):

hdu_out.header["META"] = json.dumps(self.meta)

hdu_out.header["UNIT"] = self.unit.to_string("fits")
hdu_out.header["BUNIT"] = self.unit.to_string("fits")

if hdu == "PRIMARY":
hdulist = [hdu_out]
Expand Down
2 changes: 1 addition & 1 deletion gammapy/maps/wcsnd.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def from_hdu(cls, hdu, hdu_bands=None):
shape_wcs = tuple([np.max(geom.npix[0]), np.max(geom.npix[1])])
meta = cls._get_meta_from_header(hdu.header)

unit = hdu.header.get("UNIT", "")
unit = hdu.header.get("BUNIT", "")

map_out = cls(geom, meta=meta, unit=unit)

Expand Down

0 comments on commit e6a31fb

Please sign in to comment.