def fill_wcs_map_from_hpx_data(self, hpx_data, wcs_data, normalize=True):
        """Fills the wcs map from the hpx data using the pre-calculated
        mappings

        hpx_data  : the input HEALPix data
        wcs_data  : the data array being filled
        normalize : True -> perserve integral by splitting HEALPix values between bins

        """
        # FIXME, there really ought to be a better way to do this
        
        hpx_naxis = len(hpx_data.shape)
        wcs_naxis = len(wcs_data.shape)

        if hpx_naxis + 1 != wcs_naxis:
            raise ValueError("HPX.fill_wcs_map_from_hpx_data: HPX naxis should be 1 less that WCS naxis: %i, %i"%(hpx_naxis, wcs_naxis))
        if hpx_naxis == 2:
            if hpx_data.shape[1] != wcs_data.shape[2]:
                raise ValueError("HPX.fill_wcs_map_from_hpx_data: size of energy axes don't match: %i, %i"%(hpx_naxis[1], wcs_naxis[2]))

        lmap_valid = self._lmap[self._valid]
        wcs_layer_shape = wcs_data.shape[0]*wcs_data.shape[1]
        if hpx_naxis == 2:
            for i in range(hpx_data.shape[1]):
                wcs_data_layer = np.zeros(wcs_layer_shape)
                wcs_data_layer[self._valid] = hpx_data[:,i][lmap_valid]
                orig_value = wcs_data_layer.sum()
                if normalize:
                    wcs_data_layer *= self._mult_val
                wcs_data[:,:,i].flat = wcs_data_layer
        else:
            wcs_data_flat = np.zeros(wcs_layer_shape)
            wcs_data_flat[self._valid] = hpx_data[lmap_valid]
            if normalize:
                wcs_data_flat *= self._mult_val            
            wcs_data.flat = wcs_data_flat
def fill_wcs_map_from_hpx_data ( self , hpx_data , wcs_data , normalize = True ) : hpx_naxis = len ( hpx_data . shape ) wcs_naxis = len ( wcs_data . shape ) if hpx_naxis + 1 != wcs_naxis : raise ValueError ( "HPX.fill_wcs_map_from_hpx_data: HPX naxis should be 1 less that WCS naxis: %i, %i" % ( hpx_naxis , wcs_naxis ) ) if hpx_naxis == 2 : if hpx_data . shape [ 1 ] != wcs_data . shape [ 2 ] : raise ValueError ( "HPX.fill_wcs_map_from_hpx_data: size of energy axes don't match: %i, %i" % ( hpx_naxis [ 1 ] , wcs_naxis [ 2 ] ) ) lmap_valid = self . _lmap [ self . _valid ] wcs_layer_shape = wcs_data . shape [ 0 ] * wcs_data . shape [ 1 ] if hpx_naxis == 2 : for i in range ( hpx_data . shape [ 1 ] ) : wcs_data_layer = np . zeros ( wcs_layer_shape ) wcs_data_layer [ self . _valid ] = hpx_data [ : , i ] [ lmap_valid ] orig_value = wcs_data_layer . sum ( ) if normalize : wcs_data_layer *= self . _mult_val wcs_data [ : , : , i ] . flat = wcs_data_layer else : wcs_data_flat = np . zeros ( wcs_layer_shape ) wcs_data_flat [ self . _valid ] = hpx_data [ lmap_valid ] if normalize : wcs_data_flat *= self . _mult_val wcs_data . flat = wcs_data_flat
Fills the wcs map from the hpx data using the pre-calculated
        mappings

        hpx_data  : the input HEALPix data
        wcs_data  : the data array being filled
        normalize : True -> perserve integral by splitting HEALPix values between bins