CMM.pipeline module

class CMM.pipeline.Pipeline(comm, seed, seed_noise=None)[source]

Bases: object

Instance to reconstruct component maps using QUBIC abilities.

Parameters:
  • comm (MPI communicator) – MPI common communicator define by MPI.COMM_WORLD.

  • seed (int) – Seed for random CMB realization.

  • seed_noise (int, optional) – Seed for random noise realization, by default None.

Methods

call_pcg(max_iterations, seenpix)

Precontioned Conjugate Gradiant algorithm.

callback(x)

Callback for scipy.minimize.

fisher(ell, Nl)

Fisher Method.

fisher_compute_sigma_r()

Fisher estimation.

get_constrains()

Constraints for scipy.minimize.

get_tod_comp()

Component TOD.

give_intercal(D, d, _invn)

Detectors intercalibration.

main()

Pipeline.

update_components(seenpix)

Method that solves the map-making equation :math:`(H^T .

update_gain()

Update detectors gain.

update_mixing_matrix(beta, ...)

Update Mixing Matrix.

update_spectral_index()

Update spectral index.

get_tod_comp_superpixel

save_data

call_pcg(max_iterations, seenpix)[source]

Precontioned Conjugate Gradiant algorithm.

Method to call the PCG from PyOperators package.

Parameters:
  • max_iterations (int) – Maximum number of iterations for the PCG algorithm.

  • seenpix (array_like) – Boolean array that define the pixels observed by QUBIC.

callback(x)[source]

Callback for scipy.minimize.

Method to make callback function readable by scipy.optimize.minimize.

This method is intended to be used as a callback function during the optimization process. It is called by the optimizer at each iteration.

The method performs the following actions: 1. Synchronizes all processes using a barrier to ensure that all processes reach this point before proceeding. 2. If the current process is the root process (rank 0), it performs the following:

  1. Every 5 iterations (when self.nfev is a multiple of 5), it prints the current iteration number and the parameter values rounded to 5 decimal places.

  1. Increments the iteration counter self.nfev by 1.

Parameters:

x (array_like) – The current parameter values at the current iteration of the optimization.

fisher(ell, Nl)[source]

Fisher Method.

Fisher to compute an estimation of sigma(r) for a given noise power spectrum.

Parameters:
  • ell (array_like) – Array containing the multipole values.

  • Nl (array_like) – Array containing the noise power spectrum values.

Returns:

sigma – Estimated value of sigma(r).

Return type:

float

fisher_compute_sigma_r()[source]

Fisher estimation.

Computes and prints the value of sigma(r) using the Fisher matrix.

get_constrains()[source]

Constraints for scipy.minimize.

Generate constraints readable by scipy.optimize.minimize.

Returns:

constraints – A list of constraint dictionaries for optimize.minimize.

Return type:

list

get_tod_comp()[source]

Component TOD.

Method that produces Time-Ordered Data (TOD) using the component maps computed at the current iteration.

This method initializes a zero-filled numpy array tod_comp with dimensions based on the number of components, the number of sub-components (multiplied by 2), and the product of the number of detectors and samples. It then iterates over each component and sub-component to compute the TOD by applying a convolution operator (if specified) and a mapping operator to the component maps.

Returns:

tod_comp – A numpy array containing the computed TOD for each component and sub-component.

Return type:

array_like

get_tod_comp_superpixel(index)[source]
give_intercal(D, d, _invn)[source]

Detectors intercalibration.

Semi-analytical method for gains estimation. (cf CMM paper)

Parameters:
  • D (array_like) – Simlulated data, given by the formula : \(\vec{D} = H.A.\vec{c}\), where H is the pointing matrix, A the mixing matrix and c the component vector.

  • d (array_like) – Observed data, given by the formula : \(\vec{d} = G.\vec{D} + \vec{n}\), where G is the detectors’ intercalibration matrix and n the noise vector.

  • _invn (Diagonal Operator) – Inverse noise covariance matrix.

Returns:

g – Intercalibration vector.

Return type:

array_like

main()[source]

Pipeline.

Method to run the pipeline by following :

  1. Initialize simulation using PresetSims instance reading params.yml.

  2. Solve map-making equation knowing spectral index and gains.

  3. Fit spectral index knowing components and gains.

  4. Fit gains knowing components and sepctral index.

  5. Repeat 2), 3) and 4) until convergence.

save_data(step)[source]
update_components(seenpix)[source]

Method that solves the map-making equation \((H^T . N^{-1} . H) . x = H^T . N^{-1} . d\), using OpenMP / MPI solver.

This method updates the components of the map by solving the map-making equation using an OpenMP / MPI solver. The equation is of the form \((H^T . N^{-1} . H) . \vec{c} = H^T . N^{-1} . \vec{TOD}\), where H_i is the operator obtained from the preset, U is a reshaped operator, and x_planck and xI are intermediate variables used in the calculations.

Parameters:

seenpix (array_like) – Boolean array that define the pixels observed by QUBIC.

update_gain()[source]

Update detectors gain.

Method that compute and print gains of each detectors using semi-analytical method decribed in “give_intercal” function, using the formula : \(g^i = \frac{TOD_{obs}^i}{TOD_{sim}^i}\).

update_mixing_matrix(beta, previous_mixingmatrix, icomp)[source]

Update Mixing Matrix.

Method to update the mixing matrix using the current fitted value of the beta parameter and the parametric model associated. Only use when hybrid parametric-blind fit is selected !

Parameters:
  • beta (int) – Spectral index.

  • previous_mixingmatrix (array_like) – Mixing Matrix at the previous iteration \((N_{sub} + N_{integr} . N_{Planck}, N_{comp})\).

  • icomp (int) – Component index.

Returns:

updated_mixingmatrix – The updated Mixing Matrix.

Return type:

array_like

update_spectral_index()[source]

Update spectral index.

Method that perform step 3) of the pipeline for 2 possible designs : Two Bands and Ultra Wide Band