fgbuster.component_model

Parametric spectral energy distribution (SED)

Unified API for evaluating SEDs, see Component.

This module also provides a handy way of generating a Component from analytic expressions, see the AnalyticComponent. For components frequently used (e.g. power law, gray body, CMB) these are already prepared.

Functions

lambdify(x, y)

Classes

AnalyticComponent(analytic_expr, **fixed_params)

Component defined analytically

CMB([units])

Cosmic microwave background

Component

Abstract class for SED evaluation

Dust(nu0[, temp, beta_d, units])

Alias of ModifiedBlackBody

FreeFree([logEM, Te, units])

Free-free

ModifiedBlackBody(nu0[, temp, beta_d, units])

Modified Black body

PowerLaw(nu0[, beta_pl, nu_pivot, running, …])

Power law

Synchrotron(nu0[, beta_pl, nu_pivot, …])

Alias of PowerLaw

ThermalSZ([units])

Thermal Sunyaev-Zeldovich

class fgbuster.component_model.Component[source]

Abstract class for SED evaluation

It defines the API.

property defaults

Default values of the free parameters

diff(nu, *params)[source]

Evaluate the derivative of the SED

Parameters
  • nu (array) – Frequencies at which the SED is evaluated

  • *params (float or ndarray) – Value of the free parameters. They can be arrays and, in this case, they should be broadcastable to a common shape.

Returns

result – It contains the derivative with respect to each parameter. See eval() for more details about the format of the evaluated derivative

Return type

list

eval(nu, *params)[source]

Evaluate the SED

Parameters
  • nu (array) – Frequencies at which the SED is evaluated

  • *params (float or ndarray) – Value of each of the free parameters. They can be arrays and, in this case, they should be broadcastable to a common shape.

Returns

result – SED. The shape is always np.broadcast(*params).shape + nu.shape. In particular, if the parameters are all floats, the shape is the same nu.

Return type

ndarray

property n_param

Number of free parameters

property params

Name of the free parameters

class fgbuster.component_model.AnalyticComponent(analytic_expr, **fixed_params)[source]

Component defined analytically

Class that allows analytic definition and automatic (symbolic) differentiation of it using sympy.

Parameters
  • analytic_expr (str) – Analytic expression for the SED. The variable representing the frequency is assumed to be nu. You can not use names that produce clashes with sympy definitions (e.g, functions). Notable forbidden names are beta, gamma.

  • **fixed_params (float) – Fix the value of the desired variables. If a variable is not specified or is set equal to None, it will be a free parameters.

Note

Difference with respect to a sympy.Expression

  • Efficient evaluators of the SED and its derivatives are prepared at construction time

  • Following the API specified in Component, nu has a special meaning and has a dedicated dimension (the last one) when evaluations are performed

  • diff (and diff_diff) return the evaluation of the derivatives with respect to all the free parameters, not the expression of the derivatives with respect to a specific parameter

Note also that

  • You can trade a longer construction time for faster evaluation time by setting component_model.lambdify to sympy.utilities.autowrap.ufuncify. After constructing the anlytic component you can revert back the change by setting component_model.lambdify back to sympy.lambdify. The gain can negligible or considerable depending on the analytic expression.

class fgbuster.component_model.CMB(units='K_CMB')[source]

Cosmic microwave background

Parameters

units – Output units (K_CMB and K_RJ available)

class fgbuster.component_model.ThermalSZ(units='uK_CMB')[source]

Thermal Sunyaev-Zeldovich

Parameters

units – Output units (K_CMB and K_RJ available)

class fgbuster.component_model.Dust(nu0, temp=None, beta_d=None, units='K_CMB')[source]

Alias of ModifiedBlackBody

class fgbuster.component_model.Synchrotron(nu0, beta_pl=None, nu_pivot=None, running=0.0, units='K_CMB')[source]

Alias of PowerLaw

class fgbuster.component_model.ModifiedBlackBody(nu0, temp=None, beta_d=None, units='K_CMB')[source]

Modified Black body

Parameters
  • nu0 (float) – Reference frequency

  • temp (float) – Black body temperature

  • beta_d (float) – Spectral index

  • units – Output units (K_CMB and K_RJ available)

class fgbuster.component_model.PowerLaw(nu0, beta_pl=None, nu_pivot=None, running=0.0, units='K_CMB')[source]

Power law

Parameters
  • nu0 (float) – Reference frequency

  • beta_pl (float) – Spectral index

  • nu_pivot (float) – Pivot frequency for the running

  • running (float) – Curvature of the power law

  • units – Output units (K_CMB and K_RJ available)

class fgbuster.component_model.FreeFree(logEM=None, Te=None, units='K_CMB')[source]

Free-free

Anlytic model for bremsstrahlung emission (Draine, 2011) Above 1GHz it is essentially equivalent to a power law.

Parameters
  • logEM – Logarithm (base ten) of the integrated squared electron density along a line of sight in cm^-3 pc

  • Te – Electron temperature

  • units – Output units (K_CMB and K_RJ available)