code: def write_to_fitsfile(self, fitsfile, clobber=True):
          
          from fermipy.skymap import Map
          hpx_header = self._hpx.make_header()
          index_map = Map(self.ipixs, self.wcs)
          mult_map = Map(self.mult_val, self.wcs)
          prim_hdu = index_map.create_primary_hdu()
          mult_hdu = index_map.create_image_hdu()
          for key in ['COORDSYS', 'ORDERING', 'PIXTYPE',
                      'ORDERING', 'ORDER', 'NSIDE',
                      'FIRSTPIX', 'LASTPIX']:
              prim_hdu.header[key] = hpx_header[key]
              mult_hdu.header[key] = hpx_header[key]
  
          hdulist = fits.HDUList([prim_hdu, mult_hdu])
          hdulist.writeto(fitsfile, overwrite=clobber)
docs: Write this mapping to a FITS file, to avoid having to recompute it