candl.transformations.common#
Common transformations, including additive foregrounds (Poisson, CIB, …), calibration, super-sample lensing, and aberration as well as required helper functions. These are all that is required to run the data sets made available at initial release. Most of the specific foreground subclasses contain examples for how to include them in the data set yaml file.
Note:#
Warning: 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:#
Extragalactic foregrounds:
Galactic contamination:
Calibration:
Other:
Frequency scaling functions:
- class candl.transformations.common.AberrationCorrection(ells, long_ells, aberration_coefficient, descriptor='Aberration Correction')#
AberrationCorrection. Following Equation 23 in Jeong et al. 2013 (https://arxiv.org/pdf/1309.2285.pdf). Note that this is a fixed transformation and does not depend on any nuisance parameters.
The addition in Cl space is:
\[- AC * \ell * \frac{\partial C_\ell}{\partial \ell}\]where AC is the aberration coefficient with \(AC = \beta \langle\cos{\theta}\rangle\). Here \(\beta\) is the speed in units of c (typically ~0.00123) and \(\langle\cos{\theta}\rangle\) is the average direction (w.r.t. the observed field).
Used by SPT-3G 2018 TT/TE/EE implementation.
Examples
Example yaml block to add Aberration:
- Module: "common.SuperSampleLensing" aberration_coefficient: 0.0001
- Attributes:
- ellsarray (float)
The ell range the transformation acts on.
- aberration_coefficientfloat
Product of the beta and cos(theta) terms.
- descriptorstr
A short descriptor.
- par_nameslist
Names of parameters involved in transformation.
- long_ellsarray (float)
Long vector of concatenated theory ells.
- operation_hintstr
Type of the ‘transform’ operation: ‘additive’.
Methods
__init__(ells, long_ells, aberration_coefficient)Initialise the AberrationCorrection transformation.
output(Dls)Return the aberration correction.
transform(Dls, sample_params)Transform the input spectrum.
- output(Dls)#
Return the aberration correction. Sightly different signature to foregrounds (only Dl dependent), but intended to be accessed through transformation() only.
- Returns:
- array, float
Aberration correcation.
- transform(Dls, sample_params)#
Transform the input spectrum. Note that sample_params is never accessed, but for uniformity across transformation() methods still included.
- Returns:
- arrayfloat
The transformed spectrum in Dl.
- class candl.transformations.common.CIBClustering(ells, spec_order, freq_info, affected_specs, amp_param, beta_param, alpha, ell_ref, nu_ref, T_CIB, descriptor='CIB clustering')#
Adds CIB clustering power using a power law with fixed index.
\[A * g(\nu_1, \beta) * g(\nu_2, \beta) * \left( \ell / \ell_{ref} \right)^\alpha\]where:
\(A\) is the amplitude
\(\ell_{ref}\) is the reference ell
\(\alpha\) is the power law index
\(\beta\) is the frequency scaling parameter
\(g(\nu, \beta)\) is the frequency scaling for a modified black body
Used by SPT-3G 2018 TT/TE/EE implementation.
Notes
User required arguments in data set yaml file:
ell_ref (float) : Reference ell.
nu_ref (float) : Reference frequency.
T_CIB (float) : Temperature of the CIB.
amp_param (str) : The name of the amplitude parameter.
beta_param (str) : The name of the frequency scaling parameter.
alpha (float) : The power law index.
effective_frequencies (str) : Keyword to look for in effective frequencies yaml file.
affected_specs (str) : List of spectrum identifiers the transformation is applied to.
Examples
Example yaml block to add CIB clustering power to all TT spectra:
- Module: "common.CIBClustering" amp_param: "TT_CIBClustering_Amp" alpha: 0.8 beta_param: "TT_CIBClustering_Beta" effective_frequencies: "CIB"# keyword in effective frequencies file with corresponding entry affected_specs: ["TT 90x90", "TT 90x150", "TT 90x220", "TT 150x150", "TT 150x220", "TT 220x220"] ell_ref: 3000 nu_ref: 150 T_CIB: 25
- 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.
- amp_paramstr
The name of the amplitude parameter.
- beta_paramstr
The name of the frequency scaling parameter.
- alphafloat
The power law index.
Methods
__init__(ells, spec_order, freq_info, ...[, ...])Initialise a new instance of the CIBClustering 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.
- Returns:
- array, float
Foreground spectrum.
- transform(Dls, sample_params)#
Transform spectrum by adding foreground component (result of output method).
- Returns:
- array, float
Transformed spectrum.
- class candl.transformations.common.CIBtSZCorrelationGeometricMean(ells, spec_order, affected_specs, amp_param, link_transformation_module_CIB, link_transformation_module_tSZ, descriptor='CIB-tSZ correlation')#
Simple correlation term between power-law CIB and template tSZ modules above with a free amplitude.. Note that the sign is defined such that a positive correlation parameter leads to a reduction of power at 150GHz. Used by SPT-3G 2018 TT/TE/EE implementation. Note that the meat has been taken out of the output method in order to allow for differentiability; auto-diff struggles with this module due to the square-roots, hence hand-defined defined custom derivate rules. Thanks to Marco Bonici for the pointer.
Notes
User required arguments in data set yaml file:
link_transformation_module_CIB (str) : Class of the CIB module to scan initialised transformations for.
link_transformation_module_tSZ (str) : Class of the tSZ module to scan initialised transformations for.
amp_param (str) : Name of the free amplitude parameter.
affected_specs (list) : List of the spectra to apply this foreground to.
Examples
Example yaml block to add tSZ-CIB correlation power:
- Module: "common.CIBtSZCorrelationGeometricMean" link_transformation_module_CIB: "common.CIBClustering" link_transformation_module_tSZ: "common.tSZTemplateForeground" amp_param: "TT_tSZ_CIB_Corr_Amp" affected_specs: ["TT 90x90", "TT 90x150", "TT 90x220", "TT 150x150", "TT 150x220", "TT 220x220"]
- 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.
- ell_refint
Reference ell for normalisation.
- spec_maskarray (int)
Masks which spectra of the long data vector are affected by the transformation.
- affected_specslist (str)
List of the spectra to apply this foreground to.
- full_maskarray (int)
Masks which elements of the long data vector are affected by the transformation.
- affected_specs_ixlist (int)
Indices of affected spectra
- N_specint
The total number of spectra in the long data vector.
- amp_paramstr
The name of the amplitude parameter.
- CIBcandl.transformations.abstract_base.transformation
CIB module.
- tSZcandl.transformations.abstract_base.transformation
tSZ module.
Methods
__init__(ells, spec_order, affected_specs, ...)Initialise a new instance of the CIBtSZCorrelationGeometricMean 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. Direct call to _CIBtSZCorrelationGeometricMean_output.
- Returns:
- array, float
Foreground spectrum.
- transform(Dls, sample_params)#
Transform spectrum by adding foreground component (result of output method).
- Returns:
- array, float
Transformed spectrum.
- class candl.transformations.common.CalibrationAuto(ells, spec_order, spec_param_dict, descriptor='Calibration', operation_hint='multiplicative', inverse_calibration=False)#
Calibration model that divides each spectrum by the series of specified parameters. Scales model spectra by \(1/\Pi_i X_i\), where \(X_i\) are specified in the spec_param_dict. Contributed by Etienne Camphuis.
Notes
User required arguments in data set yaml file
spec_param_dict (dict) : 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.
Examples
Example yaml block to calibrate TT 90GHz and 150GHz spectra in two steps (internal and external):
- Module: "common.CalibrationAuto" spec_param_dict: TT 90x90: ["cal_ext", "cal_ext", "cal_rel", "cal_rel"] TT 90x150: ["cal_ext", "cal_ext", "cal_rel"] TT 150x150: ["cal_ext", "cal_ext"]
- 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.
- inverse_calibrationbool
If True, the transformation will multiply the spectrum by the calibration factors instead of dividing. False by default.
Methods
__init__(ells, spec_order, spec_param_dict)Initialise a new instance of the Calibration class.
transform(Dls, sample_params)Transform the input spectrum.
- get_cal_vec(sample_params)#
Shortcut to access calibration vector. See also: transformation()
- transform(Dls, sample_params)#
Transform the input spectrum.
- Returns:
- arrayfloat
The transformed spectrum in Dl.
- class candl.transformations.common.CalibrationCross(ells, spec_order, spec_param_dict, descriptor='Calibration', operation_hint='multiplicative')#
Calibration model for summed spectra, e.g. for TE_90x150: :math:` 0.5 * ( T_{90}xE_{150} + E_{90}xT_{150} )`. Scales model spectra by \(1/[0.5*(X*Y+WV)]\), where \(X,Y,W,V\) are specified in the spec_param_dict (most likely want Tcal and/or Ecal in there). Reduces to CalibrationAuto if parameters are repeated appropriately. Used by SPT-3G 2018 TT/TE/EE implementation.
Notes
User required arguments in data set yaml file
spec_param_dict (dict) : 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.
Examples
Example yaml block to calibrate TE spectra that are the sum of the two (TE/ET) crosses:
- Module: "common.CalibrationCross" spec_param_dict: TE 90x90: ["Tcal90", "Ecal90", "Tcal90", "Ecal90"] TE 90x150: [ "Tcal90", "Ecal150", "Tcal150", "Ecal90" ] TE 90x220: [ "Tcal90", "Ecal220", "Tcal220", "Ecal90" ] TE 150x150: [ "Tcal150", "Ecal150", "Tcal150", "Ecal150" ] TE 150x220: [ "Tcal150", "Ecal220", "Tcal220", "Ecal150" ] TE 220x220: [ "Tcal220", "Ecal220", "Tcal220", "Ecal220" ]
- 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.
Methods
__init__(ells, spec_order, spec_param_dict)Initialise a new instance of the Calibration class.
transform(Dls, sample_params)Transform the input spectrum.
- get_cal_vec(sample_params)#
Shortcut to access calibration vector. See also: transformation()
- transform(Dls, sample_params)#
Transform the input spectrum.
- Returns:
- arrayfloat
The transformed spectrum in Dl.
- class candl.transformations.common.CalibrationSingleScalar(cal_param, descriptor='Calibration (single number')#
Simple calibration model for spectra. Scales all model spectra by \(1/X\), where \(X\) is specified as cal_param.
- Attributes:
- descriptorstr
A short descriptor.
- cal_paramstr
Name of the calibration parameter.
- par_nameslist
Names of parameters involved in transformation.
Methods
__init__(cal_param[, descriptor])Initialise a new instance of the Calibration class.
transform(Dls, sample_params)Transform the input spectrum.
- transform(Dls, sample_params)#
Transform the input spectrum.
- Returns:
- arrayfloat
The transformed spectrum in Dl.
- class candl.transformations.common.CalibrationSingleScalarSquared(cal_param, descriptor='Calibration (single number')#
Simple calibration model for spectra. Scales all model spectra by \(1/X^2\), where \(X\) is specified as cal_param.
- Attributes:
- descriptorstr
A short descriptor.
- cal_paramstr
Name of the calibration parameter.
- par_nameslist
Names of parameters involved in transformation.
Methods
__init__(cal_param[, descriptor])Initialise a new instance of the Calibration class.
transform(Dls, sample_params)Transform the input spectrum.
- transform(Dls, sample_params)#
Transform the input spectrum.
- Returns:
- arrayfloat
The transformed spectrum in Dl.
- class candl.transformations.common.FGSpectraInterfaceFactorizedCrossSpectrum(ells, fgspectra_sed, fgspectra_sed_args, fgspectra_sed_args_fixed, fgspectra_cl, fgspectra_cl_args, fgspectra_cl_args_fixed, amp_param, freq_info, spec_order, affected_specs, descriptor='FGSpectra Interface')#
Wrapper for SO’s FGSpectra FactorizedCrossSpectrum (simonsobs/fgspectra) with a free amplitude.
Notes
User required arguments in data set yaml file:
fg_spectra_sed (str) : Name of fgspectra.frequency class to use for SED.
fg_spectra_sed_args (list) : Names of sampled parameters that need to be passed to the SED instance.
fg_spectra_sed_args_fixed (dict) : Names and values of fixed parameters to be passed to the SED instance.
fg_spectra_cl (str) : Name of fgspectra.power class to use for Cls.
fg_spectra_cl_args (list) : Names of sampled parameters that need to be passed to the Cl instance.
fg_spectra_cl_args_fixed (dict) : Names and values of fixed parameters to be passed to the Cl instance.
amp_param (str) : The name of the amplitude parameter.
affected_specs (list) : List of the spectra to apply this foreground to.
effective_frequencies (str) : Keyword to look for in effective frequencies yaml file.
Examples
Example yaml block:
- Module: "common.FGSpectraInterfaceFactorizedCrossSpectrum" fgspectra_sed: "ThermalSZ" fgspectra_sed_args: [] fgspectra_sed_args_fixed: {nu_0: 150.0} fgspectra_cl: "tSZ_150_bat" fgspectra_cl_args: [] fgspectra_cl_args_fixed: {ell_0: 3000} amp_param: "FGSpec_amp" affected_specs: ["TT 90x90", "TT 150x150", "TT 220x220"] effective_frequencies: "tSZ"
- Attributes:
- fgspectra_sedInstance of a fgspectra.frequency class
Used by FGSpectra for SED.
- fgspectra_sed_argslist (str)
Names of sampled parameters that need to be passed to the SED instance.
- fgspectra_sed_args_fixeddictionary of stringfloat
Names and values of fixed parameters to be passed to the SED instance.
- fgspectra_clInstance of a fgspectra.power class
Used by FGSpectra for Cls.
- fgspectra_cl_argslist (str))
Names of sampled parameters that need to be passed to the Cl instance.
- fgspectra_cl_args_fixeddictionary of stringfloat
Names and values of fixed parameters to be passed to the Cl instance.
- 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.
- ell_refint
Reference ell for normalisation.
- spec_maskarray (int)
Masks which spectra of the long data vector are affected by the transformation.
- affected_specslist (str)
List of the spectra to apply this foreground to.
- affected_specs_ixlist (int)
Indices of affected spectra
- N_specint
The total number of spectra in the long data vector.
- amp_paramstr
The name of the amplitude parameter.
Methods
__init__(ells, fgspectra_sed, ...[, descriptor])Initialise a new instance of the FGSpectraInterfaceFactorizedCrossSpectrum class.
output(sample_params)Return foreground spectrum.
transform(Dls, sample_params)Transform the input spectrum.
- output(sample_params)#
Return foreground spectrum.
- Returns:
- array, float
Foreground spectrum.
- transform(Dls, sample_params)#
Transform the input spectrum.
- Returns:
- arrayfloat
The transformed spectrum in Dl.
- class candl.transformations.common.GalacticDust(ells, spec_order, freq_info, affected_specs, amp_param, alpha_param, beta_param, ell_ref, nu_ref, T_GALDUST, descriptor='Galactic Dust')#
Adds galactic dust power using a power law.
\[A * g(\nu_1, b\eta) * g(\nu_2, b\eta) * \left( \ell / \ell_{ref} \right)^{(\alpha+2)}\]where:
\(A\) is the amplitude
\(\ell_{ref}\) is the reference ell
\(\alpha\) is the power law index
\(\beta\) is the frequency scaling parameter
\(g(\nu, \beta)\) is the frequency scaling for a modified black body
Used by SPT-3G 2018 TT/TE/EE implementation.
Notes
User required arguments in data set yaml file:
ell_ref (float) : Reference ell.
nu_ref (float) : Reference frequency.
T_GALDUST (float) : Temperature of the dust.
amp_param (str) : The name of the amplitude parameter.
beta_param (str) : The name of the frequency scaling parameter.
alpha (float) : The power law index.
effective_frequencies (str) : Keyword to look for in effective frequencies yaml file.
affected_specs (str) : List of spectrum identifiers the transformation is applied to.
Examples
Example yaml block to add residual cirrus power to all TT spectra:
- Module: "common.GalacticDust" descriptor: "Cirrus" amp_param: "TT_GalCirrus_Amp" alpha_param: "TT_GalCirrus_Alpha" beta_param: "TT_GalCirrus_Beta" effective_frequencies: "cirrus"# keyword in effective frequencies file with corresponding entry affected_specs: ["TT 90x90", "TT 90x150", "TT 90x220", "TT 150x150", "TT 150x220", "TT 220x220"] ell_ref: 80 nu_ref: 150 T_GALDUST: 19.6
- 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.
- amp_paramstr
The name of the amplitude parameter.
- beta_paramstr
The name of the frequency scaling parameter.
- alpha_paramstr
The name of the power law index parameter.
Methods
__init__(ells, spec_order, freq_info, ...[, ...])Initialise a new instance of the GalacticDust 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.
- Returns:
- array, float
Foreground spectrum.
- transform(Dls, sample_params)#
Transform spectrum by adding foreground component (result of output method).
- Returns:
- array, float
Transformed spectrum.
- class candl.transformations.common.GalacticDustBandPass(ells, spec_order, bandpass_info, affected_specs, amp_param, alpha_param, beta_param, ell_ref, nu_ref, T_GALDUST, descriptor='Galactic Dust (Band pass)')#
Dusty foreground with modified black-body frequency scaling with integral over band pass with a power law ell power spectrum.
\[A * f(\beta, \mathrm{bdp}_1) * f(\beta, \mathrm{bdp}_2) * \left( \ell / \ell_{ref} \right)^{(\alpha + 2)}\]where:
\(A\) is the amplitude
\(\ell_{ref}\) is the reference ell
\(\alpha\) is the power law index
\(\beta\) is the frequency scaling parameter
\(f(\beta, \mathrm{bdp})\) is the frequency scaling for a modified black body with band pass \(\mathrm{bdp}\)
The +2 to the exponent is convention.
Notes
User required arguments in data set yaml file:
ell_ref (float) : Reference ell.
nu_ref (float) : Reference frequency.
T_GALDUST (float) : Temperature of the dust.
amp_param (str) : The name of the amplitude parameter.
beta_param (str) : The name of the frequency scaling parameter.
alpha (float) : The power law index.
affected_specs (str) : List of spectrum identifiers the transformation is applied to.
Examples
Example yaml block to add polarised galactic dust to all EE spectra:
- Module: "common.GalacticDustBandPass" amp_param: "BB_GalDust_BDP_Amp" alpha_param: "BB_GalDust_BDP_Alpha" beta_param: "BB_GalDust_BDP_Beta" nu_ref: 353 affected_specs: ["BB 90x90", "BB 90x150", "BB 90x220", "BB 150x150", "BB 150x220", "BB 220x220"] ell_ref: 80 T_GALDUST: 19.6 descriptor: "BB Polarised Galactic Dust (Bandpass)"
- 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.
- affected_specslist (str)
List of the spectra to apply this foreground to.
- 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.
- T_dustfloat
Dust temperature.
- amp_paramstr
The name of the amplitude parameter.
- alpha_paramstr
The name of the power law index parameter.
- beta_paramstr
The name of the frequency scaling parameter.
Methods
__init__(ells, spec_order, bandpass_info, ...)Initialise a new instance of the GalacticDustBandPass 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.
- Returns:
- array, float
Foreground spectrum.
- transform(Dls, sample_params)#
Transform spectrum by adding foreground component (result of output method).
- Returns:
- array, float
Transformed spectrum.
- class candl.transformations.common.PoissonPower(ells, spec_order, spec_param_dict, ell_ref, descriptor='Poisson Power')#
Adds individual Poisson terms to a series of spectra.
\[A * \left( \ell / \ell_{ref} \right)^2\]where:
\(A\) is the amplitude
\(\ell_{ref}\) is the reference ell
Used by SPT-3G 2018 TT/TE/EE implementation.
Notes
User required arguments in data set yaml file:
ell_ref (float) : Reference ell.
spec_param_dict (dict) : 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.
Examples
Example yaml block to add individual Poisson terms to a series of TT spectra:
- Module: "common.PoissonPower" ell_ref: 3000 spec_param_dict: TT 90x90: "TT_Poisson_90x90" TT 90x150: "TT_Poisson_90x150" TT 90x220: "TT_Poisson_90x220" TT 150x150: "TT_Poisson_150x150" TT 150x220: "TT_Poisson_150x220" TT 220x220: "TT_Poisson_220x220"
- 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.
- 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.
- spec_maskarray (int)
Masks which parts of the long data vector are affected by the transformation.
- N_specint
The total number of spectra in the long data vector.
- affected_specs_ixlist (int)
Indices in spectra_order of spectra the transformation is applied to.
Methods
__init__(ells, spec_order, spec_param_dict, ...)Initialise a new instance of the PoissonPower class.
output(sample_params)Return foreground spectrum.
transform(Dls, sample_params)Transform the input spectrum.
- output(sample_params)#
Return foreground spectrum.
- Returns:
- array, float
Foreground spectrum.
- transform(Dls, sample_params)#
Transform the input spectrum.
- Returns:
- arrayfloat
The transformed spectrum in Dl.
- class candl.transformations.common.PolarisationCalibration(ells, cal_param, spec_order, descriptor='Calibration (single number')#
Simple calibration model for spectra. Scales all TE by \(X\) and all EE by \(X^2\), where \(X\) is specified as cal_param. Used by ACT DR4 likelihood implementation.
Notes
User required arguments in data set yaml file:
cal_param (str) : Name of the calibration parameter.
Examples
Example yaml block to calibrate TE and EE spectra:
- Module: "common.PolarisationCalibration" cal_param: "yp" descriptor: "Calibration"
- Attributes:
- ellsarray (float)
The ell range the transformation acts on.
- descriptorstr
A short descriptor.
- cal_paramstr
Name of the calibration parameter.
- 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.
- TE_affected_specs_ixlist
List of indices of spectra that get a yp factor
- EE_affected_specs_ixlist
List of indices of spectra that get a yp^2 factor
Methods
__init__(ells, cal_param, spec_order[, ...])Initialise a new instance of the Calibration class.
transform(Dls, sample_params)Transform the input spectrum.
- transform(Dls, sample_params)#
Transform the input spectrum.
- Returns:
- arrayfloat
The transformed spectrum in Dl.
- class candl.transformations.common.PolarisationCalibrationDivision(ells, cal_param, spec_order, descriptor='Calibration (single number')#
Simple calibration model for spectra. Same as PolarisationCalibration, but divides, rather than multiplies by the calibration parameter.
Methods
transform(Dls, sample_params)Transform the input spectrum.
- transform(Dls, sample_params)#
Transform the input spectrum.
- Returns:
- arrayfloat
The transformed spectrum in Dl.
- class candl.transformations.common.RadioPoisson(ells, spec_order, freq_info, affected_specs, amp_param, beta_val, sigmasq_val, ell_ref, nu_ref, descriptor='Radio Poisson')#
Adds Radio Poisson power enforcing a powerlaw SED.
Notes
User required arguments in data set yaml file:
ell_ref (float) : Reference ell.
nu_ref (float) : Reference frequency.
amp_param (str) : The name of the amplitude parameter.
beta_val (float) : The value of the frequency scaling parameter.
sigmasq_val (float) : The value of the sigmasq frequency scaling parameter.
effective_frequencies (str) : Keyword to look for in effective frequencies yaml file.
affected_specs (str) : List of spectrum identifiers the transformation is applied to.
- 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.
- 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.
- amp_paramstr
The name of the amplitude parameter.
- beta_valfloat
The value of the beta frequency scaling parameter.
- sigmasq_valfloat
The value of the sigmasq frequency scaling parameter.
Methods
__init__(ells, spec_order, freq_info, ...[, ...])Initialise a new instance of the RadioPoisson 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.
- Returns:
- array, float
Foreground spectrum.
- transform(Dls, sample_params)#
Transform spectrum by adding foreground component (result of output method).
- Returns:
- array, float
Transformed spectrum.
- class candl.transformations.common.SuperSampleLensing(ells, long_ells, kappa_param, descriptor='Super-Sample Lensing')#
Super sample lensing. Following Equation 32 in Manzotti, Hu, Benoit-Levy 2014 (https://arxiv.org/pdf/1401.7992.pdf). The addition in Cl space is:
\[- \frac{\partial\ell^2 C_\ell^{XY}}{\partial \ln{\ell}} \frac{\kappa}{\ell^2}\]or:
\[- \frac{\kappa}{\ell^2} \frac{\partial}{\partial\ln{\ell}} (\ell^2 C_\ell) = -\kappa(\ell*\frac{\partial C_\ell}{\partial\ell} + 2 C_\ell)\]Used by SPT-3G 2018 TT/TE/EE implementation.
Notes
User required arguments in data set yaml file:
kappa_param (str) : Name of the kappa parameter to be used.
Examples
Example yaml block to add SSL:
- Module: "common.SuperSampleLensing" kappa_param: "Kappa"
- Attributes:
- ellsarray (float)
The ell range the transformation acts on.
- descriptorstr
A short descriptor.
- par_nameslist
Names of parameters involved in transformation.
- kappa_paramstr
Name of the kappa parameter to be used (i.e. the mean lensing covergence across the field).
- long_ellsarray (float)
Long vector of concatenated theory ells.
- operation_hintstr
Type of the ‘transform’ operation: ‘additive’.
Methods
__init__(ells, long_ells, kappa_param[, ...])Initialise the SuperSamleLensing transformation.
output(Dls, sample_params)Return SSL contribution.
transform(Dls, sample_params)Transform the input spectrum.
- output(Dls, sample_params)#
Return SSL contribution. Sightly different signature to foregrounds (Dl dependent), but intended to be accessed through transformation() only.
- Returns:
- array, float
SSL contribution.
- transform(Dls, sample_params)#
Transform the input spectrum.
- Returns:
- arrayfloat
The transformed spectrum in Dl.
- candl.transformations.common.black_body(nu: float64, nu0: float64, T: float64) float64#
Black body function, normalised to 1 at nu0. Based on code shared by Christian Reichardt - thank you!
- Returns:
- float
Frequency scaling
- candl.transformations.common.black_body_deriv(nu: float64, nu0: float64, T: float64) float64#
Derivative of black body function, normalised to 1 at nu0. Based on code shared by Christian Reichardt - thank you!
- Returns:
- float
Frequency scaling
- candl.transformations.common.dust_frequency_scaling(beta: float64, Tdust: float64, nu_0_dust: float64, nu: float64) float64#
Modified black body frequency scaling. Based on code shared by Christian Reichardt - thank you!
- Returns:
- float
Frequency scaling
- candl.transformations.common.dust_frequency_scaling_bandpass(beta, Tdust, nu_0_dust, nu_spacing, nu_vals, bandpass_vals, thermo_conv)#
Modified black body frequency scaling with the integral over the bandpass. Band pass information is expanded out (rather than passing an instance of BandPass) to make @jit easier. Frequency power law index is 3 + beta. Following BK_Planck likelihood.
- Returns:
- float
Frequency scaling
- class candl.transformations.common.kSZTemplateForeground(ells, spec_order, affected_specs, template_arr, amp_param, ell_ref, descriptor='kSZ')#
kSZ template spectrum. Used by SPT-3G 2018 TT/TE/EE implementation.
Notes
User required arguments in data set yaml file:
ell_ref (float) : Reference ell.
template_file (str) : Relative path to the template file from the candl/ folder.
affected_specs (list) : List of the spectra to apply this foreground to.
amp_param (str) : The name of the amplitude parameter.
Examples
Example yaml block to add kSZ power to all TT spectra:
- Module: "common.kSZTemplateForeground" template_file: "foreground_templates/dl_ksz_CSFplusPATCHY_13sep2011_norm1_fake25000.txt" amp_param: "TT_kSZ_Amp" affected_specs: [ "TT 90x90", "TT 90x150", "TT 90x220", "TT 150x150", "TT 150x220", "TT 220x220" ] ell_ref: 3000
- Attributes:
- template_arrarray (float)
Template spectrum and ells.
- template_specarray (float)
Template spectrum.
- template_ellsarray (int)
Template ells.
- ell_refint
Reference ell for normalisation.
- 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.
- affected_specslist (str)
List of the spectra to apply this foreground to.
- 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.
- amp_paramstr
The name of the amplitude parameter.
- template_spec_tiledarray (float)
Template spectrum repeated N_spec times.
Methods
__init__(ells, spec_order, affected_specs, ...)Initialise a new instance of the kSZTemplateForeground 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.
- Returns:
- array, float
Foreground spectrum.
- transform(Dls, sample_params)#
Transform spectrum by adding foreground component (result of output method).
- Returns:
- array, float
Transformed spectrum.
- candl.transformations.common.radio_frequency_scaling(beta: float64, sigmasq: float64, nu_0_rg: float64, nu: float64) float64#
Power law frequency scaling. Based on code shared by Christian Reichardt - thank you!
- Returns:
- float
Frequency scaling
- class candl.transformations.common.tSZTemplateForeground(ells, spec_order, freq_info, affected_specs, template_arr, amp_param, ell_ref, nu_ref, descriptor='tSZ')#
tSZ template with frequency scaling and one free amplitude parameter.
\[A * g(\nu_1) * g(\nu_2) * D^{\mathrm{template}}_{\ell_{ref}}\]where:
\(A\) is the amplitude parameter
\(g(\nu)\) is the appropriate frequency scaling
Used by SPT-3G 2018 TT/TE/EE implementation.
Notes
User required arguments in data set yaml file:
ell_ref (float) : Reference ell.
template_file (str) : Relative path to the template file from the candl/ folder.
affected_specs (list) : List of the spectra to apply this foreground to.
amp_param (str) : The name of the amplitude parameter.
nu_ref (float) : Reference frequency.
effective_frequencies (str) : Keyword to look for in effective frequencies yaml file.
Examples
Example yaml block to add tSZ power to all TT spectra:
- Module: "common.tSZTemplateForeground" template_file: "foreground_templates/dl_shaw_tsz_s10_153ghz_norm1_fake25000.txt" amp_param: "TT_tSZ_Amp" effective_frequencies: "tSZ"# keyword in effective frequencies file with corresponding entry affected_specs: ["TT 90x90", "TT 90x150", "TT 90x220", "TT 150x150", "TT 150x220", "TT 220x220"] ell_ref: 3000 nu_ref: 143
- Attributes:
- template_arrarray (float)
Template spectrum and ells.
- template_specarray (float)
Template spectrum.
- template_ellsarray (int)
Template ells.
- ell_refint
Reference ell for normalisation.
- 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.
- 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.
- 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.
- amp_paramstr
The name of the amplitude parameter.
- template_spec_tiledarray (float)
Template spectrum repeated N_spec times.
- T_CMBfloat
CMB temperature.
Methods
__init__(ells, spec_order, freq_info, ...[, ...])Initialise a new instance of the tSZTemplateForeground 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.
- Returns:
- array, float
Foreground spectrum.
- transform(Dls, sample_params)#
Transform spectrum by adding foreground component (result of output method).
- Returns:
- array, float
Transformed spectrum.
- candl.transformations.common.tSZ_frequency_scaling(nu: float64, nu0: float64, T: float64) float64#
tSZ frequency scaling. Based on code shared by Christian Reichardt - thank you!
- Returns:
- float
Frequency scaling