@@ -19,6 +19,11 @@ class Metals:
19
19
cache_pk = LRUCache (128 )
20
20
cache_xi = LRUCache (128 )
21
21
22
+ metal_growth_rate = None
23
+ par_sigma_smooth = None
24
+ per_sigma_smooth = None
25
+ fast_metals = False
26
+
22
27
def __init__ (self , corr_item , fiducial , scale_params , PktoXi_obj , data = None ):
23
28
"""Initialize metals
24
29
@@ -41,18 +46,16 @@ def __init__(self, corr_item, fiducial, scale_params, PktoXi_obj, data=None):
41
46
self .size = corr_item .model_coordinates .rp_grid .size
42
47
ell_max = self ._corr_item .config ['model' ].getint ('ell_max' , 6 )
43
48
self ._coordinates = corr_item .model_coordinates
44
- self .metal_growth_rate = fiducial [ 'metal-growth_rate' ]
49
+ self .fast_metals = corr_item . config [ 'model' ]. getboolean ( 'fast_metals' , False )
45
50
51
+ # Read the growth rate and sigma_smooth from the fiducial config
52
+ if 'metal-growth_rate' in fiducial :
53
+ self .metal_growth_rate = fiducial ['metal-growth_rate' ]
46
54
if 'par_sigma_smooth' in fiducial :
47
55
self .par_sigma_smooth = fiducial ['par_sigma_smooth' ]
48
56
if 'per_sigma_smooth' in fiducial :
49
57
self .per_sigma_smooth = fiducial ['per_sigma_smooth' ]
50
58
51
- self .fast_metals = corr_item .config ['model' ].getboolean ('fast_metals' , False )
52
- # self.fast_metals_unsafe = corr_item.config['model'].getboolean('fast_metals_unsafe', False)
53
- # if self.fast_metals_unsafe:
54
- # self.fast_metals = True
55
-
56
59
self .save_components = fiducial .get ('save-components' , False )
57
60
58
61
if self .save_components and self .fast_metals :
@@ -169,12 +172,15 @@ def compute(self, pars, pk_lin, component):
169
172
"""
170
173
assert self ._corr_item .has_metals
171
174
local_pars = copy .deepcopy (pars )
172
- if 'growth_rate' in local_pars :
173
- local_pars ['growth_rate' ] = self .metal_growth_rate
174
- if 'sigma_smooth_par' in local_pars :
175
- local_pars ['sigma_smooth_par' ] = self .par_sigma_smooth
176
- if 'sigma_smooth_per' in local_pars :
177
- local_pars ['sigma_smooth_per' ] = self .per_sigma_smooth
175
+
176
+ # TODO Check growth rate and sigma_smooth exist. They should be in the fiducial config.
177
+ if self .fast_metals :
178
+ if 'growth_rate' in local_pars and self .metal_growth_rate is not None :
179
+ local_pars ['growth_rate' ] = self .metal_growth_rate
180
+ if 'sigma_smooth_par' in local_pars and self .par_sigma_smooth is not None :
181
+ local_pars ['sigma_smooth_par' ] = self .par_sigma_smooth
182
+ if 'sigma_smooth_per' in local_pars and self .per_sigma_smooth is not None :
183
+ local_pars ['sigma_smooth_per' ] = self .per_sigma_smooth
178
184
179
185
xi_metals = np .zeros (self .size )
180
186
for name1 , name2 , in self ._corr_item .metal_correlations :
0 commit comments