-
Notifications
You must be signed in to change notification settings - Fork 3
/
make_KZ_cubes.py
executable file
·38 lines (26 loc) · 1.17 KB
/
make_KZ_cubes.py
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
34
35
36
37
38
#!/usr/bin/env python3
""" Make fits files with Bayesian evidences and Bayes factors """
from pyspecnest.chaincrunch import cube_K, cube_Z
import opencube
from config import name_id, chain_dir, file_Ks, file_Zs
def make_KZ_cubes(peaks=(0, 1, 2)):
""" Generates evidence and Bayes factor maps """
lnKZ_xy_kwargs = dict(silent=True, output_dir=chain_dir,
name_id=name_id)
spc = opencube.make_cube()
# NOTE: why normalize is set to False? It's because it is more
# computationally expensive to include the normalization constant
# into likelihood calls, so on a normal sampling run we would get
# evidences from likelihoods that aren't normed.
cube_KZ_kwargs = dict(shape=spc.cube.shape[1:],
data=spc.cube,
peaks=peaks,
rms=spc.errorcube,
header=spc.header,
normalize=False)
cube_KZ_kwargs.update(lnKZ_xy_kwargs)
hdu_K = cube_K(writeto=file_Ks, **cube_KZ_kwargs)
hdu_Z = cube_Z(writeto=file_Zs, **cube_KZ_kwargs)
return hdu_K, hdu_Z
if __name__ == '__main__':
make_KZ_cubes([0, 1, 2])