Ejemplo n.º 1
0
    def visit(self, chunk):
        xyz, objectid, t = self.getpixels(chunk)
        if len(xyz) == 0: return 0

        xyzcoarse = self.getcoarse(xyz)
        xyzfine = self.getfine(xyz)
        proj = sightlines.dir[objectid, d]
        disp = map_coordinates(self.disp0, 
                xyzcoarse.T,
                mode='wrap', order=4, prefilter=False)
        disp += map_coordinates(self.disp1, 
                xyzfine.T,
                mode='wrap', order=4, prefilter=False)
        velfield[t] += disp * proj
        return len(xyz)
Ejemplo n.º 2
0
    def visit(self, chunk):
        xyz, objectid, t = self.getpixels(chunk)
        if len(xyz) == 0: 
            return 0
        chunk.empty = False
        xyzcoarse = self.getcoarse(xyz)
        d = map_coordinates(self.delta0, xyzcoarse.T, 
                mode='wrap', order=4, prefilter=False)

        xyzfine = self.getfine(xyz)
        d[:] += map_coordinates(self.delta1, xyzfine.T, 
                mode='wrap', order=4, prefilter=False)
        N = len(xyzfine)
        d[:] += self.RNG.normal(scale=self.varlya ** 0.5, size=N)
        deltafield[t] = d
        objectidfield[t] = numpy.int32(objectid)
        return len(xyz)
Ejemplo n.º 3
0
    def visit(self, chunk):
        sl = chunk.getslice()
        start, end, step = chunk.getslice().indices(self.A.NmeshQSO ** 3)
        linear = numpy.arange(start, end, step)
        xyzqso = numpy.array(numpy.unravel_index(linear, (self.A.NmeshQSO,) * 3)).T
        xyzcoarse = self.getcoarse(xyzqso)
        xyz = self.getcenter(xyzcoarse)    
        R2 = numpy.einsum('ij,ij->i', xyz, xyz)
        u = self.rng.uniform(size=len(xyz))
        #apply the redshift and skymask selection
        sky = self.skymask(xyz)
        mask = (R2 < self.Rmax ** 2) & (R2 > self.Rmin ** 2) & (sky > 0)

        if self.box.i == 0 and self.box.j == 0 and self.box.k == 0:
            numpy.save('delta1.npy', self.delta1)

        if not mask.any():
            return numpy.rec.fromarrays([[], [], [], []],
                    names=['R', 'DEC', 'RA', 'Z'])
            # avoid accessing self.delta1
            # which does the fft stuff.

        linear = linear[mask]
        xyz = xyz[mask]
        sky = sky[mask]
        xyzcoarse = xyzcoarse[mask]
        xyzqso = xyzqso[mask]
        R = R2[mask] ** 0.5

        delta = self.delta1.take(linear) 

        delta += map_coordinates(self.delta0,
                xyzcoarse.T, mode='wrap', order=4,
                prefilter=False)
        a = self.Dc.inv(R / self.A.DH)
        Nqso = self.getNqso(a, delta)
        Nqso = numpy.int32(Nqso * sky)
        return self.makeqso(xyz, Nqso)