-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathexample_benchmark.py
More file actions
33 lines (27 loc) · 906 Bytes
/
example_benchmark.py
File metadata and controls
33 lines (27 loc) · 906 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import numpy as np
import time
import n5k
import os
# First, generate benchmarks if you haven't done so yet.
if not os.path.isfile("tests/benchmarks_nl_clgg.npz"):
cal_nl = n5k.N5KCalculatorCCLNonLimber("tests/config_nl.yml")
cal_nl.setup()
cal_nl.run()
cal_nl.write_output()
cal_nl.teardown()
# Generate C_ells for a given method (CCL with limber approximation, in this case)
cal_lm = n5k.N5KCalculatorCCL("tests/config_ccl_limber.yml")
cal_lm.setup()
cal_lm.run()
cal_lm.write_output()
cal_lm.teardown()
# Now generate the tester calculator
cal_test = n5k.N5KCalculatorTester('tests/config_tester.yml')
cal_test.setup()
# Compute non-Limber S/N and plots
sn = cal_test.compare('CCL', 'tests/config_ccl_limber.yml',
plot_stuff=True)
print("Total S/N wrt benchmarks: ", sn)
print("Plots saved in " +
cal_test.config['output_prefix'] +
'clcomp*')