From f2b81d863fa43f3480fa49f2d901710c4e673664 Mon Sep 17 00:00:00 2001 From: Guilhem Lavaux Date: Tue, 24 Jun 2014 11:23:00 +0200 Subject: [PATCH] minval/maxval for plotting. Only generate velocities if it is required --- python_sample/build_2lpt_skymap.py | 3 ++- python_sample/gen_2lpt_density.py | 2 +- python_sample/icgen/borgicgen.py | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/python_sample/build_2lpt_skymap.py b/python_sample/build_2lpt_skymap.py index a7137d9..6c9cf28 100644 --- a/python_sample/build_2lpt_skymap.py +++ b/python_sample/build_2lpt_skymap.py @@ -14,7 +14,7 @@ parser.add_argument('--start', type=int, required=True) parser.add_argument('--end', type=int, required=True) parser.add_argument('--step', type=int, required=True) parser.add_argument('--minval', type=float, default=0) -parser.add_argument('--maxval', type=float, default=60) +parser.add_argument('--maxval', type=float, default=4) parser.add_argument('--depth_min', type=float, default=10) parser.add_argument('--depth_max', type=float, default=60) parser.add_argument('--iid', type=int, default=0) @@ -65,6 +65,7 @@ for i in xrange(args.start,args.end,args.step): hp.write_map("skymaps/proj_map_%d.fits" % i, proj) + print proj.min(), proj.max() hp.mollview(proj, fig=1, coord='CG', cmap=plt.cm.copper, title='Sample %d' % i, min=args.minval, max=args.maxval) if args.proj_cat: hp.projscatter(b[idx], l[idx], lw=0, color=[0.1,0.8,0.8], s=2.0, alpha=0.7) diff --git a/python_sample/gen_2lpt_density.py b/python_sample/gen_2lpt_density.py index 2af9d0a..85a23e7 100644 --- a/python_sample/gen_2lpt_density.py +++ b/python_sample/gen_2lpt_density.py @@ -33,7 +33,7 @@ for i in xrange(args.start, args.end, args.step): print i # pos,_,density,N,L,_ = bic.run_generation("/nethome/lavaux/remote/borg_2m++_128/initial_density_%d.dat" % i, 0.001, astart, cosmo, supersample=2, do_lpt2=True) pos,_,density,N,L,_,_ = bic.run_generation("%s/initial_density_%d.dat" % (args.base,i), 0.001, astart, - cosmo, supersample=args.supersample, do_lpt2=True) + cosmo, supersample=args.supersample, do_lpt2=True, needvel=False) dcic = ct.cicParticles(pos, L, args.N) dcic /= np.average(np.average(np.average(dcic, axis=0), axis=0), axis=0) diff --git a/python_sample/icgen/borgicgen.py b/python_sample/icgen/borgicgen.py index 2efa9ba..6e32769 100644 --- a/python_sample/icgen/borgicgen.py +++ b/python_sample/icgen/borgicgen.py @@ -53,7 +53,7 @@ def compute_ref_power(L, N, cosmo, bins=10, range=(0,1), func='HU_WIGGLES'): return bin_power(p.compute(k)*cosmo['h']**3, L, bins=bins, range=range) -def run_generation(input_borg, a_borg, a_ic, cosmo, supersample=1, do_lpt2=True, shiftPixel=False): +def run_generation(input_borg, a_borg, a_ic, cosmo, supersample=1, do_lpt2=True, shiftPixel=False, needvel=True): """ Generate particles and velocities from a BORG snapshot. Returns a tuple of (positions,velocities,N,BoxSize,scale_factor).""" @@ -90,7 +90,8 @@ def run_generation(input_borg, a_borg, a_ic, cosmo, supersample=1, do_lpt2=True, # Generate posx posx.append(((posq[j] + psi)%L).astype(np.float32)) # Generate vel - vel.append((psi*velmul).astype(np.float32)) + if needvel: + vel.append((psi*velmul).astype(np.float32)) print("velmul=%lg" % (cosmo['h']*velmul))