-
Notifications
You must be signed in to change notification settings - Fork 0
/
power_example.py
56 lines (44 loc) · 1.98 KB
/
power_example.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
# I haven't made bplike into a package yet, so I run everything in the same dir.
# The stuff you need is all in the fg.py module; note that it depends on tileC.
import fg
import numpy as np
def config_from_yaml(filename):
import yaml
with open(filename) as f:
config = yaml.safe_load(f)
return config
sz_temp_file = "data/cl_tsz_150_bat.dat"
sz_x_cib_temp_file = "data/sz_x_cib_template.dat"
ksz_temp_file = "data/cl_ksz_bat.dat"
# Internal identifier for what radio source parameter to vary
flux_cut = '15mJy'
# Load fiducial foreground parameters
params = config_from_yaml("fg_defaults.yml")
# Multipoles to evaluate at
ells = np.arange(2,3000)
# Initialize the power generator
comps = ['tsz','ksz','cibc','cibp','tsz_x_cib','radio','galdust','galsyn']
fp = fg.ForegroundPowers(params,ells,
sz_temp_file,ksz_temp_file,sz_x_cib_temp_file,flux_cut,
arrays=None,bp_file_dict=None,beam_file_dict=None,cfreq_dict=None, # Only used with bandpasses
comps = comps) # Components to initialize
freq1 = 90. # Ghz
freq2 = 90.
efreq1 = {'dust':freq1,'tsz':freq1,'syn':freq1} # All components have the same effective frequency
efreq2 = {'dust':freq2,'tsz':freq2,'syn':freq2}
# Now get D_ell_foreground = C_ell * l (l+1) / 2 / pi
dltt = fp.get_power("TT",
comps, # components to include in sum
params,
eff_freq_ghz1=efreq1,array1=None,
eff_freq_ghz2=efreq2,array2=None,lmax=None)
dlee = fp.get_power("EE",
comps, # components to include in sum
params,
eff_freq_ghz1=efreq1,array1=None,
eff_freq_ghz2=efreq2,array2=None,lmax=None)
dlte = fp.get_power("TE",
comps, # components to include in sum
params,
eff_freq_ghz1=efreq1,array1=None,
eff_freq_ghz2=efreq2,array2=None,lmax=None)