Skip to content

Commit

Permalink
change default values for _get_sigma2_B, edited tests accordingly
Browse files Browse the repository at this point in the history
  • Loading branch information
paulrogozenski committed Dec 18, 2024
1 parent b3534c8 commit e7af6dd
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 19 deletions.
11 changes: 0 additions & 11 deletions tests/data/conf_covariance_ssc_fsky.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,6 @@ tjpcov:
# 'set' from parameters OR pass CCL cosmology object OR yaml file
cosmo: 'set'

# Setting mask OR fsky approximation
mask_file:
DESgc__0: ./tests/benchmarks/32_DES_tjpcov_bm/catalogs/mask_DESgc__0.fits.gz
DESwl__0: ./tests/benchmarks/32_DES_tjpcov_bm/catalogs/DESwlMETACAL_mask_zbin0_ns32.fits.gz
DESwl__1: ./tests/benchmarks/32_DES_tjpcov_bm/catalogs/DESwlMETACAL_mask_zbin1_ns32.fits.gz

mask_names:
DESgc__0: mask_DESgc0
DESwl__0: mask_DESwl0
DESwl__1: mask_DESwl1

outdir: ./tests/tmp/

# Survey params:
Expand Down
2 changes: 2 additions & 0 deletions tests/test_covariance_fourier_ssc_fsky.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,8 @@ def test_get_covariance_block_WL_benchmark(cov_fssc):

# Modify tjpcov instance
cov_fssc.io.sacc_file = s
# Create an empty mask dict since there are no input mask files in the yaml
cov_fssc.mask_files = {}
cov_fssc.mask_files["DESwl__0"] = mask
cov_fssc.cosmo = cosmo

Expand Down
11 changes: 6 additions & 5 deletions tjpcov/covariance_fourier_ssc.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(self, config):

self.ssc_conf = self.config.get("SSC", {})

def _get_sigma2_B(self, cosmo, a_arr, masks={}):
def _get_sigma2_B(self, cosmo, a_arr, tr=None):
"""Returns the variance of the projected linear density field,
for the case when a survey mask is provided.
Expand All @@ -36,8 +36,8 @@ def _get_sigma2_B(self, cosmo, a_arr, masks={}):
a_arr (:obj:`float`, `array` or :obj:`None`): an array of
scale factor values at which to evaluate
the projected variance.
masks (:obj:`dict`): dictionary containing the survey
masks of the relevant tracers.
tr (:obj:`dict`): dictionary containing the
tracer name combinations.
Returns:
- (:obj:`float` or `array`): projected variance.
Expand All @@ -46,6 +46,8 @@ def _get_sigma2_B(self, cosmo, a_arr, masks={}):
# TODO: Optimize this, avoid computing the mask_wl for all blocks.
# Note that this is correct for same footprint cross-correlations. In
# case of multisurvey analyses this approximation might break.
masks = self.get_masks_dict(tr, {})

m12 = masks[1] * masks[2]
m34 = masks[3] * masks[4]
area = hp.nside2pixarea(hp.npix2nside(m12.size))
Expand Down Expand Up @@ -172,8 +174,7 @@ def get_covariance_block(
is_number_counts4=isnc[4],
)

masks = self.get_masks_dict(tr, {})
sigma2_B = self._get_sigma2_B(cosmo, a, masks=masks)
sigma2_B = self._get_sigma2_B(cosmo, a, tr=tr)

ell = self.get_ell_eff()
cov_ssc = ccl.covariances.angular_cl_cov_SSC(
Expand Down
6 changes: 3 additions & 3 deletions tjpcov/covariance_fourier_ssc_fsky.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def __init__(self, config):
"You need to set fsky for FourierSSCHaloModelFsky"
)

def _get_sigma2_B(self, cosmo, a_arr, masks={}):
def _get_sigma2_B(self, cosmo, a_arr, tr=None):
"""Returns the variance of the projected linear density field,
for the fsky/disk approximation case.
Expand All @@ -37,8 +37,8 @@ def _get_sigma2_B(self, cosmo, a_arr, masks={}):
a_arr (:obj:`float`, `array` or :obj:`None`): an array of
scale factor values at which to evaluate
the projected variance.
masks (:obj:`dict`): dictionary containing the survey
masks of the relevant tracers.
tr (:obj:`dict`): dictionary containing the
tracer name combinations.
Returns:
- (:obj:`float` or `array`): projected variance.
"""
Expand Down

0 comments on commit e7af6dd

Please sign in to comment.