minval/maxval for plotting. Only generate velocities if it is required

This commit is contained in:
Guilhem Lavaux 2014-06-24 11:23:00 +02:00
parent 6eebe9a9cb
commit f2b81d863f
3 changed files with 6 additions and 4 deletions

View File

@ -14,7 +14,7 @@ parser.add_argument('--start', type=int, required=True)
parser.add_argument('--end', type=int, required=True) parser.add_argument('--end', type=int, required=True)
parser.add_argument('--step', type=int, required=True) parser.add_argument('--step', type=int, required=True)
parser.add_argument('--minval', type=float, default=0) 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_min', type=float, default=10)
parser.add_argument('--depth_max', type=float, default=60) parser.add_argument('--depth_max', type=float, default=60)
parser.add_argument('--iid', type=int, default=0) 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) 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) 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: 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) hp.projscatter(b[idx], l[idx], lw=0, color=[0.1,0.8,0.8], s=2.0, alpha=0.7)

View File

@ -33,7 +33,7 @@ for i in xrange(args.start, args.end, args.step):
print i 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("/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, 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 = ct.cicParticles(pos, L, args.N)
dcic /= np.average(np.average(np.average(dcic, axis=0), axis=0), axis=0) dcic /= np.average(np.average(np.average(dcic, axis=0), axis=0), axis=0)

View File

@ -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) 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 """ Generate particles and velocities from a BORG snapshot. Returns a tuple of
(positions,velocities,N,BoxSize,scale_factor).""" (positions,velocities,N,BoxSize,scale_factor)."""
@ -90,6 +90,7 @@ def run_generation(input_borg, a_borg, a_ic, cosmo, supersample=1, do_lpt2=True,
# Generate posx # Generate posx
posx.append(((posq[j] + psi)%L).astype(np.float32)) posx.append(((posq[j] + psi)%L).astype(np.float32))
# Generate vel # Generate vel
if needvel:
vel.append((psi*velmul).astype(np.float32)) vel.append((psi*velmul).astype(np.float32))
print("velmul=%lg" % (cosmo['h']*velmul)) print("velmul=%lg" % (cosmo['h']*velmul))