lib.MapMaking.Qmap_plotter module
- lib.MapMaking.Qmap_plotter.Cl2BK(ell, Cl)[source]
Convert C_ell to the bandpower-like quantity 100 * ell * C_ell / (2*pi).
Formula
- —
result = 100 * ell * C_ell / (2*pi)
Parameters
- –
- ellarray_like
Multipole moments (1D). Should match or broadcast with Cl.
- Clarray_like
C_ell values. Can be scalar, 1D or broadcastable to ell. Typical shape in this module: (n_nus, n_nus, n_bins).
Returns
- —
- ndarray
Transformed bandpower values with shape equal to the broadcasted inputs.
- lib.MapMaking.Qmap_plotter.Dl2Cl(ell, Dl)[source]
Convert angular power spectrum from D_ell to C_ell.
Formula
- —
C_ell = D_ell * 2*pi / (ell * (ell + 1))
Parameters
- –
- ellarray_like
Multipole moments (1D). Values must be > 0 (division by zero otherwise).
- Dlarray_like
D_ell values. Can be scalar, 1D (same length as ell) or broadcastable to ell. Typical shape in this module: (n_nus, n_nus, n_bins).
Returns
- —
- ndarray
C_ell values with the same shape as the broadcast result of Dl and ell.
Notes
Uses elementwise broadcasting; ensure ell and Dl shapes are compatible.
No guard is performed for ell == 0; caller must avoid or mask such entries.
- class lib.MapMaking.Qmap_plotter.Plots[source]
Bases:
objectInstance for plotting results of Monte-Carlo Markov Chain (i.e emcee).
Methods
get_convergence(chain, job_id)chain assumed to be not flat with shape (nsamples, nwalkers, nparams)
get_triangle(chain, names, labels, job_id)Make triangle plot of each estimated parameters
Make few list :
get_Dl_plot
- class lib.MapMaking.Qmap_plotter.PlotsCMM(preset, dogif=True)[source]
Bases:
objectInstance to produce plots on the convergence.
Methods
display_maps(input_maps, reconstructed_maps, ...)Display input / output / residual maps at a given iteration.
plot_gain_iteration(gain[, figsize, ki])Method to plot convergence of reconstructed gains.
plot_sed(nus_in, A_in, nus_out, A_out[, ...])Plots the Spectral Energy Distribution (SED) and saves the plot as a svg file.
plot_beta_iteration
plot_rms_iteration
- display_maps(input_maps, reconstructed_maps, seenpix, ki=0, reso=15, view='gnomview')[source]
Display input / output / residual maps at a given iteration.
- plot_gain_iteration(gain, figsize=(8, 6), ki=0)[source]
Method to plot convergence of reconstructed gains.
Arguments :
- —
gain : Array containing gain number (1 per detectors). It has the shape (Niteration, Ndet, 2) for Two Bands design and (Niteration, Ndet) for Wide Band design
alpha : Transparency for curves.
figsize : Tuple to control size of plots.
- plot_sed(nus_in, A_in, nus_out, A_out, figsize=(8, 6), ki=0, gif=False)[source]
Plots the Spectral Energy Distribution (SED) and saves the plot as a svg file.
Parameters: nus (array-like): Array of frequency values. A (array-like): Array of amplitude values. figsize (tuple, optional): Size of the figure. Defaults to (8, 6). truth (array-like, optional): Array of true values for comparison. Defaults to None. ki (int, optional): Iteration index for file naming. Defaults to 0.
Returns: None
- class lib.MapMaking.Qmap_plotter.PlotsFMM(seenpix)[source]
Bases:
objectMethods
plot_FMM_mollview
plot_FMM_old
plot_frequency_maps
- lib.MapMaking.Qmap_plotter.plot_cross_spectrum(nus, ell, Dl, Dl_err, ymodel, Dl2=None, Dl2_err=None, label_model='CMB + Dust', nbins=None, nrec=2, mode='Dl', figsize=None, title=None, name=None, dpi=300)[source]
Plot the upper-triangle matrix of cross-angular power spectra D_ell (and optional model).
The function arranges a len(nus) x len(nus) grid and fills only the upper triangle (including diagonal) with small subplots labelled by the frequency pair nus[i] x nus[j]. It draws data errorbars, an optional second series (Dl - noise if Dl_noise provided), and a model line (from ymodel) either in D_ell units or transformed to the “100 * ell * C_ell / (2*pi)” units depending on mode.
Parameters
- –
- nusarray_like
1D array of frequency identifiers (used for subplot annotations). Length = n_nus.
- ellarray_like
1D array of multipole moments. Length >= nbins (if nbins provided). Must be > 0 to avoid division-by-zero in conversions.
- Dlndarray
Data D_ell values, expected shape (n_nus, n_nus, n_ell) or broadcastable to that.
- Dl_noisendarray or None
Errors on Dl with same shape as Dl (or broadcastable). If provided, an additional series Dl - Dl_noise will be plotted where applicable. Errors are absolute-valued (the function applies np.abs).
- ymodelndarray or None
Model values for plotting. Expected shape (n_nus, n_nus, n_ell) (or broadcastable). If None, no model line is drawn.
- label_modelstr, optional
Legend label for the model line (default: “CMB + Dust”).
- nbinsint or None, optional
Number of ell bins to plot. If None (default) uses len(ell).
- nrecint, optional
Number of “recon” channels used to choose subplot background color and styling. Default is 2.
- mode{“Dl”, …}, optional
If “Dl” the data are plotted in D_ell units. Otherwise the model/data are transformed via _Dl2Cl and _Cl2BK before plotting (matching original behaviour).
- ft_nusint, optional
Font size for the subplot frequency annotations (default: 10).
- figsizetuple, optional
Matplotlib figure size (default: (10, 8)).
- titlestr or None, optional
Suptitle appended to the fixed prefix “Angular Cross-Power Spectra”. If None, only the prefix is used.
- namestr or None, optional
If provided, the figure is saved to this filename as a PDF.
Side effects
Creates a matplotlib figure, shows it with plt.show() and optionally saves it.
Does not return the figure (returns None). If you need the figure object, modify the
function to return fig after creation.
Notes
The function preserves exact plotting order, labels and colours of the original code.
The caller must ensure shapes of nus, ell, Dl, Dl_noise, and ymodel are compatible.