This repository has been archived by the owner on Feb 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_config.py
121 lines (84 loc) · 2.6 KB
/
_config.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
import os
from pathlib import Path
import logging
import numpy as np
from cosmology import Cosmology
# use CAMB for cosmology and angular power spectra
# many other choices are possible!
import camb
import glass.all
# parameters of the simulation
nside = 4096
lmax = 5000
# maximum redshift of the simulation
zend = 2.
# number of correlated matter fields
ncorr = 5
# cosmology for the simulation
h = 0.7
Oc = 0.25
Ob = 0.05
# random number generator, fix seed to make reproducible
rng = np.random.default_rng()
# which individual redshifts to show
showz = [0.5, 1.0, 2.0]
# redshift array for various functions
zz = np.linspace(0, zend, 1000)
# where spectra are stored
spec_path = Path('spectra')
# where data files are stored
data_path = Path('data')
# where plots are stored
plot_path = Path('plot')
# CAMB config
# -----------
# set up and store CAMB parameters
pars = camb.set_params(H0=100*h, omch2=Oc*h**2, ombh2=Ob*h**2,
NonLinear=camb.model.NonLinear_both)
# this is the cosmology object used in the benchmarks
cosmo = Cosmology.from_camb(pars)
# matter
# ------
# shell setup; here equal thickness of 150 Mpc in comoving distance
shells = glass.matter.distance_shells(cosmo, 0., zend, dx=150.)
# matter weights; the zlin is necessary for CAMB to produce good results
weights = glass.matter.uniform_weights(shells, zlin=0.1)
# galaxies
# --------
# settings for galaxy analysis
nside_gal = 2048
lmax_gal = 3000
# number of correlated matter fields for galaxy analysis
ncorr_gal = 5
# angular mode binning; set to None for no binning
gal_lbin = np.unique(np.geomspace(2, lmax_gal, 41, dtype=int))
# default bias parameter
# this is less than unity so that the density will not get clipped
# which would require non-linear theory bias computation
gal_bias = 0.8
# photometric redshift distribution
gal_mean_z = [0.5, 1.0]
gal_sigma_z = 0.125
# total number of galaxies per arcmin2 in each bin
gal_dens = 1.0
# galaxy number density in units of galaxies/arcmin2/dz
dndz = glass.observations.gaussian_nz(zz, gal_mean_z, gal_sigma_z, norm=gal_dens)
# the number of galaxy populations (= bins)
nbin = dndz.shape[0]
# job config
# ----------
# this is to give multiple runs a different output filename
if 'SLURM_JOB_ID' in os.environ:
job_id = os.environ['SLURM_JOB_ID']
else:
job_id = os.getpid()
# logging
# -------
logger = logging.getLogger('glass')
loglevel = logging.INFO
loghandler = logging.StreamHandler()
logformatter = logging.Formatter('%(message)s')
loghandler.setFormatter(logformatter)
loghandler.setLevel(loglevel)
logger.addHandler(loghandler)
logger.setLevel(loglevel)