candl.transformations.common_lensing#

Common transformations for lensing likelihoods.

Note:#

The transformations of lensing likelihoods act on binned spectra. This is NOT a comprehensive foreground/data model library. Instead, the classes below are designed for the data sets implemented in candl and serve as examples that you can use to implement any model you want.

Overview:#

class candl.transformations.common_lensing.BinnedTemplateForeground(ells, template_arr, amp_param, crop_mask, descriptor='')#

Template foreground that is already binned, with a single amplitude parameter.

Used in the SPT-3G 2018 Lensing likelihood implementation.

Notes

User required arguments in data set yaml file:

  • template_file (str) : path to file with template spectrum.

  • amp_param (str) : name of the amplitude parameter.

Examples

Example yaml block to use a template foreground:

- Module: "common_lensing.BinnedTemplateForeground"
template_file: "foreground_templates/spt3g_2018_lensing_foreground_template.txt"
amp_param: "A_fg"
Attributes:
template_arrarray (float)

Template spectrum and ells.

template_specarray (float)

Template spectrum.

template_ellsarray (int)

Template ells.

ellsarray (float)

The ell range the transformation acts on.

descriptorstr

A short descriptor.

par_nameslist

Names of parameters involved in transformation.

amp_paramstr

The name of the amplitude parameter.

crop_maskarray (bool)

Mask of which bins to use.

Methods

__init__(ells, template_arr, amp_param, ...)

Initialise a new instance of the BinnedTemplateForeground class.

output(sample_params)

Return foreground spectrum.

transform(Dls, sample_params)

Transform spectrum by adding foreground component (result of output method).

output(sample_params)#

Return foreground spectrum. Intended to be overwritten by subclasses.

Returns:
array, float

Foreground spectrum.

Attributes:
sampled_paramsdict

Dictionary of nuisance parameter values.

transform(Dls, sample_params)#

Transform spectrum by adding foreground component (result of output method). Intended to be overwritten by subclasses.

Returns:
array, float

Transformed spectrum.

Attributes:
Dlsarray

Dls to transform.

sampled_paramsdict

Dictionary of nuisance parameter values.

class candl.transformations.common_lensing.LensingAmplitude(ells, amp_param, descriptor='')#

Lensing amplitude function, which multiplies the input by some factor.

Notes

User required arguments in data set yaml file:

  • amp_param (str) : name of the amplitude parameter.

Examples

Example yaml block to a template foreground:

- Module: "common_lensing.LensingAmplitude"
  amp_param: "AL"
Attributes:
ellsarray (float)

The ell range the transformation acts on.

descriptorstr

A short descriptor.

par_nameslist

Names of parameters involved in transformation.

amp_paramstr

The name of the amplitude parameter.

operation_hintstr

Type of the ‘transform’ operation: ‘additive’.

Methods

__init__(ells, amp_param[, descriptor])

Initialise a new instance of the LensingAmplitude class.

output(sample_params)

Return multiplicative factor.

transform(Dls, sample_params)

Transform spectrum by multiplying by overall constant factor (result of output method).

output(sample_params)#

Return multiplicative factor. Intended to be overwritten by subclasses.

Returns:
float

Multiplicative factor.

Attributes:
sampled_paramsdict

Dictionary of nuisance parameter values.

transform(Dls, sample_params)#

Transform spectrum by multiplying by overall constant factor (result of output method). Intended to be overwritten by subclasses.

Returns:
array, float

Transformed spectrum.

Attributes:
Dlsarray

Dls to transform.

sampled_paramsdict

Dictionary of nuisance parameter values.

class candl.transformations.common_lensing.NormCorr(ells, template_arr_dAL_dC_TT, template_arr_dAL_dC_TE, template_arr_dAL_dC_EE, template_arr_dAL_dC_BB, template_arr_fAL, template_arr_fiducial_Cl_kk, template_arr_fiducial_correction, window_functions, descriptor='NormCorr')#

Calculates \(-2 \frac{\frac{d A}{d C} \Delta C}{f} C^{fid}\).

Used in the ACT DR6 Lensing likelihood.

Notes

User required arguments in data set yaml file:

  • M_matrices_folder (str) : path to folder with M matrices.

  • Mmodes (list) : list of spectra to use in M matrices.

  • fiducial_correction_file (str) : path to file with the fiducial correction.

Examples

Example yaml block:

- Module: "common_lensing.NormCorr"
  template_file_dAL_dC_TT: "data/ACT_DR6_Lens_v1/dAL_dC_TT.txt"
  template_file_dAL_dC_TE: "data/ACT_DR6_Lens_v1/dAL_dC_TE.txt"
  template_file_dAL_dC_EE: "data/ACT_DR6_Lens_v1/dAL_dC_EE.txt"
  template_file_dAL_dC_BB: "data/ACT_DR6_Lens_v1/dAL_dC_BB.txt"
  template_file_fAL: "data/ACT_DR6_Lens_v1/fAL.txt"
  template_file_fiducial_correction: "data/ACT_DR6_Lens_v1/norm_corr_fiducial_correction.txt"
  template_file_fiducial_Cl_kk: "data/ACT_DR6_Lens_v1/fiducial_Cl_kk.txt"
Attributes:
ellsarray (float)

The ell range the transformation acts on.

descriptorstr

A short descriptor.

cl2dlarray (float)

Conversion helper.

dAL_dCarray (bool)

Array for matrix multiplication (see equation in docs).

fAlarray (bool)

Array for normalisation (see equation in docs).

template_arr_fiducial_Cl_kkarray (bool)

Fiducial lensing spectrum.

fiducial_correctionarray (bool)

Fiducial correction.

window_functionslist

List of window functions to use for binning.

operation_hintstr

Type of the ‘transform’ operation: ‘additive’.

required_spectradict

Dictionary of spectra required for the transformation (may be primary CMB!)

Methods

__init__(ells, template_arr_dAL_dC_TT, ...)

Initialise a new instance of the LensingAmplitude class.

transform(Dls, sample_params)

Transform the input spectrum.

output

gives the additive contribution.

transform(Dls, sample_params)#

Transform the input spectrum. Intended to be overwritten by subclasses.

Parameters:
Dlsarray (float)

The spectrum to transform in Dl.

sample_paramsdict

A dictionary of parameters that are used in the transformation

Returns:
arrayfloat

The transformed spectrum in Dl.

class candl.transformations.common_lensing.ResponseFunctionM(ells, M_matrices, fiducial_correction, crop_mask, descriptor='ResponseFunctionM', overwrite_ell_max={})#

Calculates \(M * (C^{th}) - M * (C^{fid})\).

Used in the SPT-3G 2018 Lensing and ACT DR6 Lensing likelihood implementations.

Notes

User required arguments in data set yaml file:

  • M_matrices_folder (str) : path to folder with M matrices.

  • Mmodes (list) : list of spectra to use in M matrices.

  • fiducial_correction_file (str) : path to file with the fiducial correction.

Examples

Example yaml block:

- Module: "common_lensing.ResponseFunctionM"
  M_matrices_folder: "lens_delta_windows_phionly/"
  Mmodes:
    - pp
    - TT
  fiducial_correction_file: "spt3g_2018_pp_lensing_fiducial_correction_phionly.txt"
Attributes:
ellsarray (float)

The ell range the transformation acts on.

descriptorstr

A short descriptor.

M_matrixarray (float)

The matrix of the transformation.

crop_maskarray (bool)

Mask of which bins to use.

operation_hintstr

Type of the ‘transform’ operation: ‘additive’.

required_spectradict

Dictionary of spectra required for the transformation (may be primary CMB!)

overwrite_ell_maxdict

Dictionary with the maximum ell for each spectrum mode (otherwise full range will be used).

Methods

__init__(ells, M_matrices, ...[, ...])

Initialise the ResponseFunctionM transformation.

output(sample_params)

Return the correction.

transform(Dls, sample_params)

Transform the input spectrum.

output(sample_params)#

Return the correction. Needs to use unbinned (from params) spectra.

Returns:
array, float

Response function contribution.

Attributes:
sample_params dict

Contains the unbinned (pp, TT) theory spectra to be used in calculating (M * C).

transform(Dls, sample_params)#

Transform the input spectrum.

Returns:
arrayfloat

Response function contribution.

Attributes:
Dictionary of Dlsdict of array (float)

The binned spectra (pp) to add to (M * C).

sample_params dict

Contains the unbinned (pp, TT) theory spectra to be used in calculating (M * C).