@@ -22,6 +22,7 @@ class Data:
22
22
_log_cov_det = None
23
23
_blind = None
24
24
rp_rt_custom_grid = None
25
+ cosmo_params = None
25
26
26
27
def __init__ (self , corr_item ):
27
28
"""
@@ -47,17 +48,31 @@ def __init__(self, corr_item):
47
48
self .corr_item .bin_size_rt_model = self .bin_size_rt_model
48
49
self .corr_item .bin_size_rp_data = self .bin_size_rp_data
49
50
self .corr_item .bin_size_rt_data = self .bin_size_rt_data
51
+ self .corr_item .rp_min_model = self .rp_min_model
52
+ self .corr_item .rp_max_model = self .rp_max_model
53
+ self .corr_item .rt_max_model = self .rt_max_model
54
+ self .corr_item .num_bins_rp_model = self .num_bins_rp_model
55
+ self .corr_item .num_bins_rt_model = self .num_bins_rt_model
50
56
51
57
# Read the metal file and init metals in the corr item
52
58
if 'metals' in corr_item .config :
53
- tracer_catalog , metal_correlations = self ._init_metals (
54
- corr_item .config ['metals' ])
59
+ if not corr_item .new_metals :
60
+ tracer_catalog , metal_correlations = self ._init_metals (corr_item .config ['metals' ])
61
+ else :
62
+ metals_in_tracer1 , metals_in_tracer2 , tracer_catalog = self ._init_metal_tracers (
63
+ corr_item .config ['metals' ])
64
+ metal_correlations = self ._init_metal_correlations (
65
+ corr_item .config ['metals' ], metals_in_tracer1 , metals_in_tracer2 )
66
+
55
67
self .corr_item .init_metals (tracer_catalog , metal_correlations )
56
68
57
69
# Check if we have broadband
58
70
if 'broadband' in corr_item .config :
59
71
self .corr_item .init_broadband (self .coeff_binning_model )
60
72
73
+ if self .cosmo_params is not None :
74
+ self .corr_item .cosmo_params = self .cosmo_params
75
+
61
76
if not self .has_distortion :
62
77
self ._distortion_mat = np .eye (self .full_data_size )
63
78
if not self .has_cov_mat :
@@ -262,6 +277,13 @@ def _read_data(self, data_path, cuts_config, dmat_path=None):
262
277
self .num_bins_rp_data = header ['NP' ]
263
278
self .num_bins_rt_data = header ['NT' ]
264
279
280
+ if "OMEGAM" in header :
281
+ self .cosmo_params = {}
282
+ self .cosmo_params ['Omega_m' ] = header ['OMEGAM' ]
283
+ self .cosmo_params ['Omega_k' ] = header .get ('OMEGAK' , 0. )
284
+ self .cosmo_params ['Omega_r' ] = header .get ('OMEGAR' , 0. )
285
+ self .cosmo_params ['wl' ] = header .get ('WL' , - 1. )
286
+
265
287
# Get the data bin size
266
288
# TODO If RTMIN is ever added to the cf data files this needs modifying
267
289
self .bin_size_rp_data = (self .rp_max_data - self .rp_min_data ) / self .num_bins_rp_data
@@ -424,22 +446,8 @@ def _build_mask(self, rp_grid, rt_grid, cuts_config, rp_min, bin_size_rp, bin_si
424
446
mask &= (bin_center_mu > self .mu_min_cut ) & (bin_center_mu < self .mu_max_cut )
425
447
426
448
return mask
427
-
428
- def _init_metals (self , metal_config ):
429
- """Read the metal file and initialize all the metal data.
430
-
431
- Parameters
432
- ----------
433
- metal_config : ConfigParser
434
- metals section from the config file
435
-
436
- Returns
437
- -------
438
- dict
439
- Dictionary containing all tracer objects (metals and the core ones)
440
- list
441
- list of all metal correlations we need to compute
442
- """
449
+
450
+ def _init_metal_tracers (self , metal_config ):
443
451
assert ('in tracer1' in metal_config ) or ('in tracer2' in metal_config )
444
452
445
453
# Read metal tracers
@@ -450,11 +458,6 @@ def _init_metals(self, metal_config):
450
458
if 'in tracer2' in metal_config :
451
459
metals_in_tracer2 = metal_config .get ('in tracer2' ).split ()
452
460
453
- self .metal_mats = {}
454
- self .metal_rp_grids = {}
455
- self .metal_rt_grids = {}
456
- self .metal_z_grids = {}
457
-
458
461
# Build tracer Catalog
459
462
tracer_catalog = {}
460
463
tracer_catalog [self .tracer1 ['name' ]] = self .tracer1
@@ -467,6 +470,55 @@ def _init_metals(self, metal_config):
467
470
if metals_in_tracer2 is not None :
468
471
for metal in metals_in_tracer2 :
469
472
tracer_catalog [metal ] = {'name' : metal , 'type' : 'continuous' }
473
+
474
+ return metals_in_tracer1 , metals_in_tracer2 , tracer_catalog
475
+
476
+ def _init_metal_correlations (self , metal_config , metals_in_tracer1 , metals_in_tracer2 ):
477
+ metal_correlations = []
478
+ if 'in tracer2' in metal_config :
479
+ for metal in metals_in_tracer2 :
480
+ if not self ._use_correlation (self .tracer1 ['name' ], metal ):
481
+ continue
482
+ metal_correlations .append ((self .tracer1 ['name' ], metal ))
483
+
484
+ if 'in tracer1' in metal_config :
485
+ for metal in metals_in_tracer1 :
486
+ if not self ._use_correlation (metal , self .tracer2 ['name' ]):
487
+ continue
488
+ metal_correlations .append ((metal , self .tracer2 ['name' ]))
489
+
490
+ if ('in tracer1' in metal_config ) and ('in tracer2' in metal_config ):
491
+ for i , metal1 in enumerate (metals_in_tracer1 ):
492
+ j0 = i if self .tracer1 == self .tracer2 else 0
493
+
494
+ for metal2 in metals_in_tracer2 [j0 :]:
495
+ if not self ._use_correlation (metal1 , metal2 ):
496
+ continue
497
+ metal_correlations .append ((metal1 , metal2 ))
498
+
499
+ return metal_correlations
500
+
501
+ def _init_metals (self , metal_config ):
502
+ """Read the metal file and initialize all the metal data.
503
+
504
+ Parameters
505
+ ----------
506
+ metal_config : ConfigParser
507
+ metals section from the config file
508
+
509
+ Returns
510
+ -------
511
+ dict
512
+ Dictionary containing all tracer objects (metals and the core ones)
513
+ list
514
+ list of all metal correlations we need to compute
515
+ """
516
+ metals_in_tracer1 , metals_in_tracer2 , tracer_catalog = self ._init_metal_tracers (metal_config )
517
+
518
+ self .metal_mats = {}
519
+ self .metal_rp_grids = {}
520
+ self .metal_rt_grids = {}
521
+ self .metal_z_grids = {}
470
522
471
523
# Read the metal file
472
524
metal_hdul = fits .open (find_file (metal_config .get ('filename' )))
0 commit comments