def main(ns, ns1, ns2): if ns.verbose: setup_logging('info') cat1 = read_cat(ns1) mesh1 = cat1.to_mesh(interlaced=True, compensated=True, window='tsc', Nmesh=ns.nmesh) if ns1 is not ns2: cat2 = read_cat(ns2) mesh2 = cat2.to_mesh(interlaced=True, compensated=True, window='tsc', Nmesh=ns.nmesh) else: mesh2 = None if ns1.with_rsd != ns2.with_rsd: warnings.warn("Two catalogs have different with-rsd settings, this may not be intended.") if ns.mode is None: if ns1.with_rsd or ns2.with_rsd: ns.mode = '2d' else: ns.mode = '1d' if ns.unique_k: dk = 0 else: dk = None r = FFTPower(mesh1, second=mesh2, mode=ns.mode, dk=dk) basename = ns.output.rsplit('.', 1)[0] if ns.output.endswith('.json'): r.save(ns.output) elif ns.output.endswith('.txt'): if cat1.comm.rank == 0: for var in r.power.data.dtype.names: numpy.savetxt(basename + '-%s.txt' % var, r.power[var].real ) if ns.with_plot: if cat1.comm.rank == 0: figure = make_plot(r) figure.savefig(basename + '.png')
rsd_factor = cat.attrs['RSDFactor'] cat['zPosition'] = cat['Position'] + rsd_factor * cat['Velocity'] * LOS mesh = cat.to_mesh(Nmesh=128, BoxSize=1000., position='zPosition') ## delta = mesh.paint(mode='real') - 1.0 ## deltak = mesh.paint(mode='complex') X[iid, :, :, :] = mesh.preview() ## mesh.save(os.environ['SCRATCH'] + '/fastpm/fpm-%d-1.0000' % iid, dataset='1/Field', mode='real') mesh.save(os.environ['SCRATCH'] + '/fastpm/fpm-%d-1.0000' % iid, dataset='1/kField', mode='complex') os.system('mkdir -p %s' % os.environ['SCRATCH'] + '/fastpm/fpm-%d-1.0000/1/multipoles/' % iid) multipoles = FFTPower(mesh, mode='2d', dk=0.005, kmin=0.01, Nmu=5, los=[0, 0, 1], poles=[0, 2, 4]) multipoles.save(os.environ['SCRATCH'] + '/fastpm/fpm-%d-1.0000/1/multipoles/000000' % iid) ## break