def main(A): """ normalize to observed mean F """ zcenter, afactor = numpy.loadtxt(A.datadir + '/afactor.txt', unpack=True) AZ = interp1d(zcenter, afactor, fill_value=1.0, kind=4) all = numpy.fromfile(A.datadir + '/pass3.raw', dtype=pixeldtype2) Z = A.Z(all) all['F'] = all['F'] ** AZ(Z) all.tofile(A.datadir + '/pass4.raw')
def powertopole(r, K, P, kernel): """calculate the multipoles of xi upto order nmax, for given P(K) K R are in DH units! """ mask = ~numpy.isnan(P) & (K > 0) K = K[mask] P = P[mask] P = P * (2 * numpy.pi) ** 3 # going from GADGET to xiao Pfunc = interp1d(K, P, kind=5) xi = numpy.empty_like(r) for i in range(len(r)): def func(k): rt = Pfunc(k) * k ** 2 * numpy.exp(- (k *1e3) ** 2) * kernel(k * r[i]) return rt xi[i] = quad(func, K.min(), K.max())[0] return xi * (2 * numpy.pi) ** -3