aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rwxr-xr-xutils/gen-dark-matter6
1 files changed, 3 insertions, 3 deletions
diff --git a/utils/gen-dark-matter b/utils/gen-dark-matter
index 007dde3..06b146f 100755
--- a/utils/gen-dark-matter
+++ b/utils/gen-dark-matter
@@ -145,12 +145,12 @@ MCPL_HEADER="""
class MyTemplate(string.Template):
delimiter = '@'
-def rand_sphere2(R):
+def rand_ball(R):
"""
Generates a random point inside a sphere of radius R.
"""
while True:
- pos = np.random.rand(3)*R
+ pos = (np.random.rand(3)*2-1)*R
if np.linalg.norm(pos) < R:
break
@@ -323,7 +323,7 @@ if __name__ == '__main__':
f.write("%i %i\n" % (args.n, 10))
for v1, v2 in islice(gen_decay(args.M,args.E,m1,m2),args.n):
- pos = rand_sphere2(PSUP_RADIUS)
+ pos = rand_ball(PSUP_RADIUS)
p1 = np.linalg.norm(v1[1:])
p2 = np.linalg.norm(v2[1:])
f.write(" %i %i %f %f %f %f %f %f %f %f\n" % (2,args.p1,pos[0], pos[1], pos[2],0.0, v1[0], v1[1]/p1, v1[2]/p1, v1[3]/p1))