SEDs (mesmer.seds)

This module contains the SEDs of the different physical components that are allowed in the likelihood. The list of currently allowed SEDs is:

These are referred ot by name when defining the FMatrix object, which then composes the model as a linear sum of the various components.

import matplotlib.pyplot as plt
import numpy as np
from mesmer.seds import *

freqs = np.logspace(1, 3)
c = cmb(freqs)
s = syncpl(freqs, 100., -3)
d = dustmbb(freqs, 100., 1.5, 20.)
sc = sync_curvedpl(freqs, 100, -3, 0.05)
fmatrix = FMatrix(['cmb', 'syncpl', 'dustmbb'])
params = {
    'nu': freqs,
    'nu_ref_s': 100.,
    'nu_ref_d': 100.,
    'beta_d': 1.5,
    'T_d': 20.,
    'beta_s': -3.
}
f = np.sum(fmatrix(**params), axis=0)
fig, ax = plt.subplots(1, 1)
ax.loglog(freqs, c, label='cmb')
ax.loglog(freqs, s, label='syncpl')
ax.loglog(freqs, d, label='dustmbb')
ax.loglog(freqs, sc, label='sync_curvedpl')
ax.loglog(freqs, f, label='fmatrix (c+s+d)')
ax.set_xlabel('frequency (GHz)')
ax.set_ylabel('f(nu)')
ax.set_xlim(23., 400.)
ax.set_ylim(1e-2, 1e2)
ax.legend()
plt.show()

(Source code, png, hires.png, pdf)

../_images/seds-1.png
class mesmer.seds.FMatrix(components)[source] [edit on github]

Bases: object

Class to construct the foreground mixing matrix. This class models foreground SEDs of the different components of the sky model. This is an implementation of Equation (10) in 1608.00551, for a single set of spectral parameters.

Examples

>>> from mesmer.seds import FMatrix
>>> fmatrix = FMatrix(['cmb', 'syncpl', 'dustmbb'])
>>> pars = {
...     'nu': np.array([1, 100, 1000]),
...     'nu_ref_d' : 100.,
...     'nu_ref_s' : 100.,
...     'beta_s' : -3.,
...     'beta_d' : 1.5,
...     'T_d' : 20.,
... }
>>> print(fmatrix(**pars).shape)
(3, 3)

Once instantiated this function evaluates the component SEDs with which this class was instantiated.

As it is used in a variety of contexts, the mesmer.seds.FMatrix can be called in a variety of ways. It must ultimately be passed the arguments for all of the component functions. This is usually done through keyword arguments, however, the frequency can be passed as the only positional argument.

Parameters
components: list(str)

List of function names. These functions, evaluated at a list of frequencies, will give the mixing matrix, F.

Returns
ndarray

Array of shape (ncomps, nfreqs), representing the component SEDs evaluated for the requested frequencies.

mesmer.seds.cmb(nu: numpy.ndarray, *args, **kwargs)numpy.ndarray[source] [edit on github]

Function to compute CMB SED, as a function of frequency.

f_{CMB}(\nu) = e^x \frac{x}{(e^x - 1)^2}

Parameters
nu: float, or array_like(float)

Frequency in GHz, \nu.

Returns
ndarray

CMB sed evaluated at frequency nu.

mesmer.seds.dustmbb(nu: numpy.ndarray, nu_ref_d: numpy.float32, beta_d: numpy.float32, T_d: numpy.float32, *args, **kwargs)numpy.ndarray[source] [edit on github]

Function to compute modified blackbody dust SED, given by:

f_{\rm dust}(\nu) = \left(\nu / \nu_d \right)^{1 + \beta_d}
\frac{e^{h \nu_d / (k_B T_d)} - 1} {e^{h \nu / (k_B T_d)} - 1}

Parameters
nu: float or array_like(float)

Freuency at which to calculate SED, \nu.

nu_ref_d: float

Reference frequency in GHz, \nu_d.

beta_d: float

Power law index of dust opacity, \beta_d.

T_d: float

Temperature of the dust, T_d.

Returns
array_like(float)

SED of dust modified black body relative to reference frequency.

mesmer.seds.sync_curvedpl(nu: numpy.ndarray, nu_ref_s: numpy.float32, beta_s: numpy.float32, beta_c: numpy.float32, *args, **kwargs)numpy.ndarray[source] [edit on github]

Function to compute curved synchrotron power law SED, given by:

f_{\rm syncpl}(\nu) = \left(\nu / \nu_s \right)^{\beta_s +
\beta_c \ln(\nu / \nu_s)}

Parameters
nu: float, or array_like(float)

Frequency in GHz, \nu.

nu_ref_s: float

Reference frequency in GHz, \nu_s.

beta_s: float

Power law index in RJ units, \beta_s.

beta_c: float

Power law index curvature, \beta_c.

Returns
array_like(float)

Synchroton SED relative to reference frequency.

mesmer.seds.syncpl(nu: numpy.ndarray, nu_ref_s: numpy.float32, beta_s: numpy.float32, *args, **kwargs)numpy.ndarray[source] [edit on github]

Function to compute synchrotron power law SED, given by:

f_{\rm sync}(\nu) = \left(\nu / \nu_s \right)^{\beta_s}

Parameters
nu: float, or array_like(float)

Frequency in GHz, \nu.

nu_ref_s: float

Reference frequency in GHz, \nu_s.

beta_s: float

Power law index in RJ units, \beta_s.

Returns
array_like(float)

Synchroton SED relative to reference frequency.