Quick uniform background generation.

def toy_background(self,mc_source_id=2,seed=None):
        """
        Quick uniform background generation.
        """

        logger.info("Running toy background simulation...")
        size = 20000
        nstar = np.random.poisson(size)
        #np.random.seed(0)
        logger.info("Simulating %i background stars..."%nstar)

        ### # Random points from roi pixels
        ### idx = np.random.randint(len(self.roi.pixels)-1,size=nstar)
        ### pix = self.roi.pixels[idx]

        # Random points drawn from subpixels
        logger.info("Generating uniform positions...")
        idx = np.random.randint(0,len(self.subpix)-1,size=nstar)
        lon,lat = pix2ang(self.nside_subpixel,self.subpix[idx])

        pix = ang2pix(self.nside_pixel, lon, lat)
        lon,lat = pix2ang(self.nside_pixel,pix)

        # Single color
        #mag_1 = 19.05*np.ones(len(pix))
        #mag_2 = 19.10*np.ones(len(pix))

        # Uniform in color
        logger.info("Generating uniform CMD...")
        mag_1 = np.random.uniform(self.config['mag']['min'],self.config['mag']['max'],size=nstar)
        color = np.random.uniform(self.config['color']['min'],self.config['color']['max'],size=nstar)

        mag_2 = mag_1 - color

        # There is probably a better way to do this step without creating the full HEALPix map
        mask = -1. * np.ones(hp.nside2npix(self.nside_pixel))
        mask[self.roi.pixels] = self.mask.mask_1.mask_roi_sparse
        mag_lim_1 = mask[pix]
        mask = -1. * np.ones(hp.nside2npix(self.nside_pixel))
        mask[self.roi.pixels] = self.mask.mask_2.mask_roi_sparse
        mag_lim_2 = mask[pix]
        
        #mag_err_1 = 1.0*np.ones(len(pix))
        #mag_err_2 = 1.0*np.ones(len(pix))
        mag_err_1 = self.photo_err_1(mag_lim_1 - mag_1)
        mag_err_2 = self.photo_err_2(mag_lim_2 - mag_2)
        mc_source_id = mc_source_id * np.ones(len(mag_1))

        select = (mag_lim_1>mag_1)&(mag_lim_2>mag_2)

        hdu = ugali.observation.catalog.makeHDU(self.config,mag_1[select],mag_err_1[select],
                                                mag_2[select],mag_err_2[select],
                                                lon[select],lat[select],mc_source_id[select])
        catalog = ugali.observation.catalog.Catalog(self.config, data=hdu.data)
        return catalog