Skip to content

Commit

Permalink
added testing for potential splicing (needs to be single core as MINR…
Browse files Browse the repository at this point in the history
…ES is undeterministic on multiple threads)
  • Loading branch information
AnatoleStorck committed Oct 3, 2024
1 parent 510ea83 commit de798dc
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 0 deletions.
4 changes: 4 additions & 0 deletions genetIC/tests/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ function runtest {
if [ "$#" -eq 0 ]; then
for i in test_*
do
if [ "$i" == "test_24b_splicing_potential" ]
then
export OMP_NUM_THREADS=1
fi
runtest $i
done
else
Expand Down
44 changes: 44 additions & 0 deletions genetIC/tests/test_24b_splicing_potential/animate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import subprocess
import plotslice as ps
import pylab as p

def run_genetic(sphere_size):
st = """
Om 0.279
Ol 0.721
#Ob 0.04
s8 0.817
zin 99
random_seed_real_space 8896131
camb ../camb_transfer_kmax40_z0.dat
outname test_1
outdir ./
outformat tipsy
basegrid 50.0 128
center 25 25 25
select_sphere %.1f
splice 8896132
done
dump_ps 0
dump_grid 0"""%sphere_size

with open("paramfile_anim.txt","w") as f:
f.write(st)

subprocess.run(["../../genetIC", "paramfile_anim.txt"])

for frame in range(100):
size = frame/5
run_genetic(size)
p.clf()
ps.plotslice("./")
p.savefig("anim/%.3d.png"%frame)
ps.plotslice("./",diff_prefix="comp/",diff_normalized=False)
p.savefig("anim_diff/%.3d.png"%frame)
31 changes: 31 additions & 0 deletions genetIC/tests/test_24b_splicing_potential/paramfile.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Test splicing of two different random fields

Om 0.279
Ol 0.721
#Ob 0.04
s8 0.817
zin 99

random_seed 8896131
camb ../camb_transfer_kmax40_z0.dat

outname test_24b
outdir ./
outformat tipsy


basegrid 50.0 16

center 25 25 25
select_sphere 10


set_splice_minimization MINRES
splice_seedfourier_parallel
set_splice_accuracy relative 1e-5
splice_potential 8896132

done

dump_ps 0
dump_grid 0
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
0 0 0 50
The line above contains information about grid level 0
It gives the x-offset, y-offset and z-offset of the low-left corner and also the box length
Binary file not shown.

0 comments on commit de798dc

Please sign in to comment.