2

I am trying to write a FITS file in the HEALPix format, using healpy and the following script:

import healpy as hp

fname = 'COM_CMB_IQU-100-fgsub-sevem_2048_R3.00_full.fits'

map1 = hp.read_map(fname, field=[0], nest=True)
map2 = hp.read_map(fname, field=[1], nest=True)
map3 = hp.read_map(fname, field=[2], nest=True)

hp.write_map('tst1.fits', m=[map1, map2, map3], fits_IDL=False, nest=True)

This raises the following error:

/usr/lib/python2.7/dist-packages/healpy/fitsfunc.py:151:
PyfitsDeprecationWarning: The new_table function is deprecated as of
version 3.3 and may be removed in a future version.

Use :meth:`BinTableHDU.from_columns` for new BINARY tables or
:meth:`TableHDU.from_columns` for new ASCII tables instead.   tbhdu =
pf.new_table(cols) Traceback (most recent call last):   File
"write_fits.py", line 13, in <module>
    hp.write_map('tst1.fits',m=[map1, map2, map3], fits_IDL= False, nest= True)   File
"/usr/lib/python2.7/dist-packages/healpy/fitsfunc.py", line 153, in
write_map
     tbhdu.header.update('PIXTYPE','HEALPIX','HEALPIX pixelisation')   File "/usr/lib/python2.7/dist-packages/pyfits/header.py", line 1017,
in update
    'value, and comment string.' % idx) ValueError: Header update sequence item #0 is invalid; the item must either be a 2-tuple
containing a keyword and value, or a 3-tuple containing a keyword,
value, and comment string.

Any help is appreciated!

Daniel Lenz
  • 2,245
  • 10
  • 29
  • I cannot reproduce the error, works fine for me (healpy 1.11.0, python 3.6.3). – Daniel Lenz Oct 31 '18 at 19:42
  • 1
    Could this be due to an old version of `healpy`? The traceback shows that it's using `pyfits`, whereas `healpy` has been using `astropy.io.fits` for some time now. I'd recommend updating `healpy`, getting rid of `pyfits`, and installing `astropy`. – Daniel Lenz Oct 31 '18 at 19:46

0 Answers0