fgbuster.separation_recipes

High-level component separation routines

Functions

basic_comp_sep(components, instrument, data)

Basic component separation

harmonic_ilc(components, instrument, data[, …])

Harmonic Internal Linear Combination

harmonic_ilc_alm(components, instrument, alms)

Internal Linear Combination of alms

ilc(components, instrument, data[, patch_ids])

Internal Linear Combination

multi_res_comp_sep(components, instrument, …)

Basic component separation

weighted_comp_sep(components, instrument, …)

Weighted component separation

fgbuster.separation_recipes.basic_comp_sep(components, instrument, data, nside=0, **minimize_kwargs)[source]

Basic component separation

Parameters
  • components (list) – List storing the Component s of the mixing matrix

  • instrument

    Object that provides the following as a key or an attribute.

    • frequency

    • depth_i or depth_p (optional, frequencies are inverse-noise weighted according to these noise levels)

    They can be anything that is convertible to a float numpy array.

  • data (ndarray or MaskedArray) –

    Data vector to be separated. Shape (n_freq, …, n_pix). can be

    • absent or 1: temperature maps

    • 2: polarization maps

    • 3: temperature and polarization maps (see note)

    Values equal to hp.UNSEEN or, if MaskedArray, masked values are neglected during the component separation process.

  • nside – For each pixel of a HEALPix map with this nside, the non-linear parameters are estimated independently

Returns

result – It includes

  • param: (list) - Names of the parameters fitted

  • x: (ndarray) - x[i] is the best-fit (map of) the i-th parameter

  • Sigma: (ndarray) - Sigma[i, j] is the (map of) the semi-analytic covariance between the i-th and the j-th parameter. It is meaningful only in the high signal-to-noise regime and when the cov is the true covariance of the data

  • s: (ndarray) - Component amplitude maps

  • mask_good: (ndarray) - mask of the entries actually used in the component separation

Return type

dict

Note

  • During the component separation, a pixel is masked if at least one of its frequencies is masked.

  • If you provide temperature and polarization maps, they will constrain the same set of parameters. In particular, separation is not done independently for temperature and polarization. If you want an independent fitting for temperature and polarization, please launch

    >>> res_T = basic_comp_sep(component_T, instrument, data[:, 0], **kwargs)
    >>> res_P = basic_comp_sep(component_P, instrument, data[:, 1:], **kwargs)
    
fgbuster.separation_recipes.weighted_comp_sep(components, instrument, data, cov, nside=0, **minimize_kwargs)[source]

Weighted component separation

Parameters
  • components (list or tuple of lists) – List storing the Component s of the mixing matrix

  • instrument

    Object that provides the following as a key or an attribute.

    • frequency

    It can be anything that is convertible to a float numpy array.

  • data (ndarray or MaskedArray) – Data vector to be separated. Shape (n_freq, …, n_pix). can be also absent. Values equal to hp.UNSEEN or, if MaskedArray, masked values are neglected during the component separation process.

  • cov (ndarray or MaskedArray) – Covariance maps. It has to be broadcastable to data. Notice that you can not pass a pixel independent covariance as an array with shape (n_freq,): it has to be (n_freq, …, 1) in order to be broadcastable (consider using basic_comp_sep(), in this case). Values equal to hp.UNSEEN or, if MaskedArray, masked values are neglected during the component separation process.

  • nside – For each pixel of a HEALPix map with this nside, the non-linear parameters are estimated independently

  • patch_ids (array) – For each pixel, the array stores the id of the region over which to perform component separation independently.

Returns

result – It includes

  • param: (list) - Names of the parameters fitted

  • x: (ndarray) - x[i] is the best-fit (map of) the i-th parameter

  • Sigma: (ndarray) - Sigma[i, j] is the (map of) the semi-analytic covariance between the i-th and the j-th parameter It is meaningful only in the high signal-to-noise regime and when the cov is the true covariance of the data

  • s: (ndarray) - Component amplitude maps

  • mask_good: (ndarray) - mask of the entries actually used in the component separation

Return type

dict

Note

During the component separation, a pixel is masked if at least one of its frequencies is masked, either in data or in cov.

fgbuster.separation_recipes.ilc(components, instrument, data, patch_ids=None)[source]

Internal Linear Combination

Parameters
  • components (list or tuple of lists) – Components of the mixing matrix. They must have no free parameter.

  • instrument

    Object that provides the following as a key or an attribute.

    • frequency

    They can be anything that is convertible to a float numpy array.

  • data (ndarray or MaskedArray) – Data vector to be separated. Shape (n_freq, ..., n_pix). ... can be also absent. Values equal to hp.UNSEEN or, if MaskedArray, masked values are neglected during the component separation process.

  • patch_ids (array) – It stores the id of the region over which the ILC weights are computed independently. It must be broadcast-compatible with data.

Returns

result – It includes

  • W: (ndarray) - ILC weights for each component and possibly each patch.

  • freq_cov: (ndarray) - Empirical covariance for each patch

  • s: (ndarray) - Component maps

Return type

dict

Note

  • During the component separation, a pixel is masked if at least one of its frequencies is masked.

fgbuster.separation_recipes.harmonic_ilc(components, instrument, data, lbins=None, weights=None, iter=3)[source]

Harmonic Internal Linear Combination

Parameters
  • components (list or tuple of lists) – Components of the mixing matrix. They must have no free parameter.

  • instrument

    Object that provides the following as a key or an attribute.

    • frequency

    • fwhm (arcmin) they are deconvolved before ILC

    They can be anything that is convertible to a float numpy array.

  • data (ndarray or MaskedArray) – Data vector to be separated. Shape (n_freq, ..., n_pix). ... can be 1, 3 or absent. If 3, the separation is done independently fot T, E and B. Values equal to hp.UNSEEN or, if MaskedArray, masked values are neglected during the component separation process.

  • lbins (array) – It stores the edges of the bins that will have the same ILC weights. If a multipole is not in a bin but is the alms, an independent bin will be assigned to it

  • weights (array) – If provided data are multiplied by the weights map before computing alms

Returns

result – It includes

  • W: (ndarray) - ILC weights for each component and possibly each index of the dimension in the alms.

  • s: (ndarray) - Component maps

  • cl_in: (ndarray) - Spectra of the input alm

  • cl_out: (ndarray) - Spectra of the output alm

  • fsky: (ndarray) - The input fsky used to correct the cls

Return type

dict

Note

  • During the component separation, a pixel is masked if at least one of its frequencies is masked.

  • Output spectra are divided by the fsky. fsky is computed with the MASTER formula if weights is provided, otherwise it is the fraction of unmasked pixels

fgbuster.separation_recipes.harmonic_ilc_alm(components, instrument, alms, lbins=None, fsky=None)[source]

Internal Linear Combination of alms

Parameters
  • components (list or tuple of lists) – Components of the mixing matrix. They must have no free parameter.

  • instrument

    Object that provides the following as a key or an attribute.

    • frequency

    It can be anything that is convertible to a float numpy array.

  • alms (ndarray) – Data vector to be separated. Shape (n_freq, ..., lm). ... can be 1, 3 or absent. The ILC weights are computed independently for each of its indices.

  • lbins (array) – It stores the edges of the bins that will have the same ILC weights. If a multipole is not in a bin but is the alms, an independent bin will be assigned to it

  • fsky (array) – If provided the output power spectra are corrected for this factor

Returns

result – It includes

  • W: (ndarray) - ILC weights for each component and possibly each index of the dimension in the alms.

  • s: (ndarray) - Alms of the cleaned components

  • cl_in: (ndarray) - Spectra of the input alm

  • cl_out: (ndarray) - Spectra of the output alm

  • fsky: (ndarray) - The input fsky used to correct the cls

Return type

dict

fgbuster.separation_recipes.multi_res_comp_sep(components, instrument, data, nsides, **minimize_kwargs)[source]

Basic component separation

Parameters
  • components (list) – List storing the Component s of the mixing matrix

  • instrument

    Object that provides the following as a key or an attribute.

    • frequency

    • depth_i or depth_p (optional, frequencies are inverse-noise weighted according to these noise levels)

    They can be anything that is convertible to a float numpy array.

  • data (ndarray or MaskedArray) –

    Data vector to be separated. Shape (n_freq, …, n_pix). can be

    • absent or 1: temperature maps

    • 2: polarization maps

    • 3: temperature and polarization maps (see note)

    Values equal to hp.UNSEEN or, if MaskedArray, masked values are neglected during the component separation process.

  • nsides (seq) – Specify the nside for each free parameter of the components

Returns

result – It includes

  • param: (list) - Names of the parameters fitted

  • x: (seq) - x[i] is the best-fit (map of) the i-th parameter. The map has nside = nsides[i]

  • Sigma: (ndarray) - Sigma[i, j] is the (map of) the semi-analytic covariance between the i-th and the j-th parameter. It is meaningful only in the high signal-to-noise regime and when the cov is the true covariance of the data

  • s: (ndarray) - Component amplitude maps

  • mask_good: (ndarray) - mask of the entries actually used in the component separation

Return type

dict

Note

  • During the component separation, a pixel is masked if at least one of its frequencies is masked.

  • If you provide temperature and polarization maps, they will constrain the same set of parameters. In particular, separation is not done independently for temperature and polarization. If you want an independent fitting for temperature and polarization, please launch

    >>> res_T = basic_comp_sep(component_T, instrument, data[:, 0], **kwargs)
    >>> res_P = basic_comp_sep(component_P, instrument, data[:, 1:], **kwargs)