candl.transformations.abstract_base#

Transformation module containing abstract base classes. They establish the general framework of how transformations work in the likelihood. Specific foregrounds or other transformations are intended to be implemented as subclasses of these in their own files. See candl.transformations.common.py for examples.

Overview#

class candl.transformations.abstract_base.BandPass(bandpass_array)#

Base class to hold band pass. Assumes all band pass measurements are equally spaced. Modelled on procedure in BK_Planck likelihood: BICEP2/Keck Array and Planck Joint Analysis January 2015 Data Products, The BICEP2/Keck and Planck Collaborations, A Joint Analysis of BICEP2/Keck Array and Planck Data (http://bicepkeck.org/).

Attributes:
nu_valsarray (float)

Frequencies where the band pass is measured

bandpass_valsarray (float)

Band pass values

nu_spacingfloat

Spacing between measurements.

thermo_convdict

Dictionary holding the thermodynamic conversion factors for different reference frequencies.

Methods

__init__(bandpass_array)

Initialise the Band pass.

calculate_thermodynamic_conversion(nu_ref)

Calculate the thermodynamic conversion factor for a given reference frequency.

calculate_thermodynamic_conversion(nu_ref)#

Calculate the thermodynamic conversion factor for a given reference frequency.

Parameters:
nu_reffloat

Reference frequency.

class candl.transformations.abstract_base.Calibration(ells, descriptor='', param_names=[], operation_hint='multiplicative')#

Abstract base class for calibration. Useful to catch tool methods that identify calibration transformations.

Methods

transform(Dls, sample_params)

Transform the input spectrum.

class candl.transformations.abstract_base.DustyForeground(ells, spec_order, freq_info, affected_specs, ell_ref, nu_ref, T_dust, descriptor='', param_names=[], operation_hint='additive')#

Abstract base class for dusty foregrounds using modified black-body spectra.

Attributes:
ellsarray (float)

The ell range the transformation acts on.

descriptorstr

A short descriptor.

par_nameslist

Names of parameters involved in transformation.

spec_orderarray (str)

Identifiers of spectra in the order in which spectra are handled in the long data vector.

freq_infolist

List of lists, where each sublist contains the two effective frequencies for a given spectrum.

affected_specslist (str)

List of the spectra to apply this foreground to.

ell_refint

Reference ell for normalisation.

nu_reffloat

Reference frequency.

T_dustfloat

Temperature of the dust.

spec_maskarray (int)

Masks which spectra of the long data vector are affected by the transformation.

full_maskarray (int)

Masks which elements of the long data vector are affected by the transformation.

N_specint

The total number of spectra in the long data vector.

operation_hintstr

Type of the ‘transform’ operation, i.e. ‘additive’ (default), ‘multiplicative’, or other (anything else). Non-binding, used as a hint for helper functions in tools module.

Methods

__init__(ells, spec_order, freq_info, ...[, ...])

Initialise a new instance of the DustyForeground class.

output(sampled_params)

Return foreground spectrum.

transform(Dls, sampled_params)

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

class candl.transformations.abstract_base.Foreground(ells, ell_ref=None, nu_ref=None, descriptor='', param_names=[], operation_hint='additive')#

Abstract base class for foregrounds.

Attributes:
ellsarray (float)

The ell range the transformation acts on.

descriptorstr

A short descriptor.

par_nameslist

Names of parameters involved in transformation.

ell_reffloat

Reference ell.

nu_reffloat

Reference frequency.

operation_hintstr

Type of the ‘transform’ operation, i.e. ‘additive’ (default), ‘multiplicative’, or other (anything else). Non-binding, used as a hint for helper functions in tools module.

Methods

__init__(ells[, ell_ref, nu_ref, ...])

Initialise a new instance of the Foreground class.

output(sampled_params)

Return foreground spectrum.

transform(Dls, sampled_params)

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

output(sampled_params)#

Return foreground spectrum. Intended to be overwritten by subclasses.

Parameters:
sampled_paramsdict

Dictionary of nuisance parameter values.

Returns:
array, float

Foreground spectrum.

transform(Dls, sampled_params)#

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

Parameters:
Dlsarray

Dls to transform.

sampled_paramsdict

Dictionary of nuisance parameter values.

Returns:
array, float

Transformed spectrum.

class candl.transformations.abstract_base.ForegroundBandPass(ells, spec_order, bandpass_info, ell_ref, nu_ref, descriptor='', param_names=[], operation_hint='additive')#

Abstract base class for foreground with a frequency scaling using integrals over the band pass.

Attributes:
ellsarray (float)

The ell range the transformation acts on.

descriptorstr

A short descriptor.

par_nameslist

Names of parameters involved in transformation.

spec_orderarray (str)

Identifiers of spectra in the order in which spectra are handled in the long data vector.

bandpass_infolist

List of lists, where each sublist contains the two candl.transformations.abstract_base.BandPass instances for the two frequencies involved.

ell_refint

Reference ell for normalisation.

nu_reffloat

Reference frequency.

N_specint

The total number of spectra in the long data vector.

operation_hintstr

Type of the ‘transform’ operation, i.e. ‘additive’ (default), ‘multiplicative’, or other (anything else). Non-binding, used as a hint for helper functions in tools module.

Methods

__init__(ells, spec_order, bandpass_info, ...)

Initialise a new instance of the DustyForeground class.

output(sampled_params)

Return foreground spectrum.

transform(Dls, sampled_params)

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

class candl.transformations.abstract_base.IndividualCalibration(ells, spec_order, spec_param_dict, descriptor='Calibration', operation_hint='multiplicative')#

Base class to calibrate individual spectra one by one.

Attributes:
ellsarray (float)

The ell range the transformation acts on.

descriptorstr

A short descriptor.

par_nameslist

Names of parameters involved in transformation.

spec_param_dictdict

A dictionary with keys that are spectrum identifiers and values that are lists of the nuisance parameter names that are used to transform this spectrum.

spec_orderlist

Order of the spectra in the long data vector.

N_specsint

Total number of spectra.

affected_specslist (str)

List of the spectra to apply this foreground to.

spec_maskarray (int)

Masks which parts of the long data vector are affected by the transformation.

affected_specs_ixlist (int)

Indices in spectra_order of spectra the transformation is applied to.

operation_hintstr

Type of the ‘transform’ operation, i.e. ‘additive’, ‘multiplicative’ (default), or other (anything else). Non-binding, used as a hint for helper functions in tools module.

Methods

__init__(ells, spec_order, spec_param_dict)

Initialise a new instance of the Calibration class.

transform(Dls, sample_params)

Transform the input spectrum.

transform(Dls, sample_params)#

Transform the input spectrum. Intended to be overwritten by subclasses with the details of the calibration model.

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.abstract_base.TemplateForeground(ells, template_arr, ell_ref, descriptor='', param_names=[], operation_hint='additive')#

Abstract base class for template foregrounds, i.e. some D_ell template spectrum that gets reused with potentially a free amplitude or frequency scaling added on top.

Attributes:
template_arrarray (float)

Template spectrum and ells.

template_specarray (float)

Template spectrum.

template_ellsarray (int)

Template ells.

ell_refint

Reference ell for normalisation. If zero, do not normalise.

ellsarray (float)

The ell range the transformation acts on.

descriptorstr

A short descriptor.

par_nameslist

Names of parameters involved in transformation.

nu_reffloat

Reference frequency.

operation_hintstr

Type of the ‘transform’ operation, i.e. ‘additive’ (default), ‘multiplicative’, or other (anything else). Non-binding, used as a hint for helper functions in tools module.

Methods

__init__(ells, template_arr, ell_ref[, ...])

Initialise a new instance of the TemplateForeground 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.

Parameters:
sampled_paramsdict

Dictionary of nuisance parameter values.

Returns:
array, float

Foreground spectrum.

transform(Dls, sample_params)#

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

Parameters:
Dlsarray

Dls to transform.

sampled_paramsdict

Dictionary of nuisance parameter values.

Returns:
array, float

Transformed spectrum.

class candl.transformations.abstract_base.Transformation(ells, descriptor='', param_names=[], operation_hint='')#

Abstract base class for transformation. Transformations are applied to theory spectra in order to make them comparable to the data. Transformations are instantiated by the likelihood.

Notes

On making subclasses: initialisation arguments can either correspond the names of attributes of the likelihood, supplied by the user, or one of the few special keywords that the likelihood understands.

Attributes:
ellsarray (float)

The ell range the transformation acts on.

descriptorstr

A short descriptor.

par_nameslist

Names of parameters involved in transformation.

operation_hintstr

Type of the ‘transform’ operation, i.e. ‘additive’, ‘multiplicative’, or other (anything else). Non-binding, used as a hint for helper functions in tools module.

Methods

__init__(ells[, descriptor, param_names, ...])

Initialise the Transformation.

transform(Dls, sample_params)

Transform the input spectrum.

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.