Пример #1
0
 def disp1(self):
     A = self.A
     box = self.box
     i, j, k = box.i, box.j, box.k
     if True:
         self.den1.fill(seed=A.SeedTable[i, j, k], kernel=dispkernel[d])
         delta1 = self.den1.realize()
         return spline_filter(delta1, order=4,
                 output=numpy.dtype('f4'))
     else:
         return numpy.zeros([A.NmeshFine, ] * 3, dtype='f4')
Пример #2
0
 def delta1(self):
     box = self.box
     i, j, k = box.i, box.j, box.k
     if True:
         self.den1.fill(seed=self.A.SeedTable[i, j, k], kernel=None)
         delta1 = self.den1.realize()
         self.var1 = delta1.var(dtype='f8')
         return spline_filter(delta1, order=4,
                 output=numpy.dtype('f4'))
     else:
         return numpy.zeros([A.NmeshFine, ] * 3, dtype='f4')
Пример #3
0
def initcoarse(A, powerspec):
    den0 = density2.Density(A.NmeshCoarse,
            power=powerspec,
            BoxSize=A.BoxSize,
            Kmax=A.KSplit)

    den0.fill(seed=A.Seed, kernel=None)
    delta0 = den0.realize()
    var0 = delta0.var(dtype='f8')
    delta0 = spline_filter(delta0, order=4, output=numpy.dtype('f4'))
    return delta0, var0
Пример #4
0
def initcoarse(A, powerspec):
    den0 = density2.Density(A.NmeshCoarse, 
            power=powerspec,
            BoxSize=A.BoxSize,
            Kmax=A.KSplit)

    den0.fill(seed=A.Seed, kernel=None)

    delta0 = den0.realize()
    var0 = delta0.var(dtype='f8')
    delta0 = spline_filter(delta0, order=4, output=numpy.dtype('f4'))
    
    disp0 = numpy.empty((3, A.NmeshCoarse, 
        A.NmeshCoarse, A.NmeshCoarse), dtype='f4')
    for d in range(3):
        den0.fill(seed=A.Seed, kernel=dispkernel[d])
        disp0[d] = den0.realize()
        disp0[d] = spline_filter(disp0[d], order=4, output=numpy.dtype('f4')) 

    print 'coarse field var', var0
    return delta0, var0, disp0