Calibration Module
Calibration analysis module for LAT-SAT cross-spectrum studies.
This module provides classes for fitting calibration parameters (angles and amplitudes) using cross-correlations between Large Aperture Telescope (LAT) and Small Aperture Telescope (SAT) data from CMB observations.
- class BaseSat4LatCross(spec_cross, sat_err, sat_lrange=(None, None), lat_lrange=(None, None), fit_per_split=True, spectra_selection='all', libdir_suffix='BaseSat4LatCross', num_sims=100, verbose=False, cov_mode='diagonal')[source]
Bases:
ABCBase class for LAT-SAT cross-spectrum calibration analyses.
Provides data loading, beam handling, and plotting logic. Subclasses must define:
self.__pnames__ / self.__plabels__
self.theory(theta)
self.lnprior(theta)
- Parameters:
- spec_cross
Cross-spectrum calculation object
- sat_err
Satellite calibration error
- sat_lrange
Satellite ell range for fitting
- lat_lrange
LAT ell range for fitting
- fit_per_split
Whether to fit per split or per frequency
- spectra_selection
Which spectra to include (‘all’, ‘auto_only’, ‘cross_only’)
- libdir
Directory for caching results
- binner
Binning information object
- Lmax
Maximum multipole
- maptags
List of map tags
- freq_groups
Dictionary mapping frequency bases to indices
- freq_bases
List of frequency base names
- mean_spec
Mean spectra from simulations
- std_spec
Standard deviation of spectra
- beam_arr
Beam transfer function array
- __init__(spec_cross, sat_err, sat_lrange=(None, None), lat_lrange=(None, None), fit_per_split=True, spectra_selection='all', libdir_suffix='BaseSat4LatCross', num_sims=100, verbose=False, cov_mode='diagonal')[source]
- cov_mode controls how the data covariance is estimated:
‘diagonal’ – per-bin variance from sims (default, always safe). ‘block_diag’ – one (n_bins × n_bins) block per (i,j) map pair,
each block Hartlap-corrected. Needs N_sims >> n_bins (not N_sims >> n_data). Recommended when you want ell-ell correlations without full-matrix instability.
- ‘shrinkage’ – full (n_data × n_data) covariance shrunk toward the
identity via OAS. Well-conditioned at any N_sims.
- ‘full’ – raw sample covariance + Hartlap correction.
Requires N_sims > n_data + 2; raises ValueError otherwise.
- abstract theory(theta)[source]
Calculate theoretical model spectrum for given parameters.
- Parameters:
theta (numpy.ndarray) – Parameter vector
- Returns:
Model spectrum array with shape matching data
- Return type:
- abstract lnprior(theta)[source]
Calculate log prior probability for given parameters.
- Parameters:
theta (numpy.ndarray) – Parameter vector
- Returns:
Log prior probability
- Return type:
- __all_spectra__(num_sims=100)[source]
Get all spectra data matrix for current ell ranges.
- Returns:
Data matrix array with shape (n_tags, n_tags, n_bins)
- Parameters:
num_sims (int)
- Return type:
- chisq(theta)[source]
Calculate chi-squared statistic for given parameters.
When use_full_cov=True uses the full inverse covariance matrix; otherwise uses diagonal (per-bin) variances.
- Parameters:
theta (numpy.ndarray)
- Return type:
- ln_likelihood(theta)[source]
Calculate log likelihood for given parameters.
- Parameters:
theta (numpy.ndarray)
- Return type:
- ln_prob(theta)[source]
Calculate log posterior probability for given parameters.
- Parameters:
theta (numpy.ndarray)
- Return type:
- run_mcmc(nwalkers=32, nsamples=2000, rerun=False, fiducial_params=None, fname=None, burnin=200, thin=20)[source]
Run (or extend/resume) MCMC using an emcee HDF5 backend.
The backend file grows as you call run_mcmc with larger nsamples — no samples are ever discarded from disk. burnin and thin only affect what is returned; you can change them freely without re-running.
- Parameters:
nwalkers (int) – Number of walkers.
nsamples (int) – Target total number of steps stored in the backend. If the backend already has >= nsamples steps, the chain is returned immediately. If it has fewer, only the remaining steps are run (extending the existing chain).
rerun (bool) – If True, wipe the backend and start from scratch.
fiducial_params (numpy.ndarray | None) – Starting point for walkers (required on first run; ignored when resuming an existing chain).
fname (str | None) – Override the auto-generated backend path (.h5 file).
burnin (int) – Steps to discard from the front when returning the chain.
thin (int) – Thinning factor applied when returning the chain.
- Return type:
- getdist_samples(nwalkers, nsamples, rerun=False, fiducial_params=None, label=None, burnin=200, thin=20)[source]
- plot_posteriors(nwalkers, nsamples, rerun=False, label=None, fiducial_params=None, burnin=200, thin=20)[source]
- plot_spectra_matrix(theta=None, save_path=None, average_split=False)[source]
Plots the mean data spectra with std deviation and optionally a theory curve in a matrix layout corresponding to all cross-correlations.
- Parameters:
theta (numpy.ndarray | None) – Parameter vector (alphas, beta, A_EB, etc.) for theory overlay.
save_path (str | None) – If given, saves the figure instead of showing.
average_split (bool) – If True, average spectra across splits per frequency.
- Return type:
None
- class Sat4LatCross(spec_cross, sat_err, beta_fid, sat_lrange=(None, None), lat_lrange=(None, None), fit_per_split=True, spectra_selection='all', num_sims=100, verbose=False, cov_mode='diagonal')[source]
Bases:
BaseSat4LatCrossCalibration model fitting for birefringence angle β.
This class implements a calibration analysis that fits calibration angles (alphas) and the cosmic birefringence angle β using EB cross-spectra between LAT and SAT.
- Parameters:
- cl_len
Lensed CMB power spectra dictionary
- __init__(spec_cross, sat_err, beta_fid, sat_lrange=(None, None), lat_lrange=(None, None), fit_per_split=True, spectra_selection='all', num_sims=100, verbose=False, cov_mode='diagonal')[source]
Initialize calibration analysis for birefringence angle fitting.
- Parameters:
spec_cross (SpectraCross) – Cross-spectrum calculation object
sat_err (float) – Satellite calibration error
beta_fid (float) – Fiducial birefringence angle for theory calculation
sat_lrange (Tuple[int | None, int | None]) – Satellite ell range for fitting (lmin, lmax)
lat_lrange (Tuple[int | None, int | None]) – LAT ell range for fitting (lmin, lmax)
fit_per_split (bool) – Whether to fit per split or per frequency
spectra_selection (str) – Which spectra to include (‘all’, ‘auto_only’, ‘cross_only’)
num_sims (int) – Number of simulations for mean/std calculation
verbose (bool) – Whether to enable verbose output
cov_mode (str) – Covariance mode (‘diagonal’, ‘block_diag’, ‘shrinkage’, ‘full’)
- Return type:
None
- theory(theta)[source]
Compute theoretical EB spectra between all map pairs using the exact birefringence + miscalibration formula:
- C_ell^{E_iB_j} = cos(2α_i+2β)sin(2α_j+2β)C_EE
sin(2α_i+2β)cos(2α_j+2β)C_BB
Optionally adds a dust foreground power law: A_dust * (ell/80)^alpha_dust
- Parameters:
theta (numpy.ndarray)
- Return type:
- lnprior(theta)[source]
Calculate log prior probability for given parameters.
- Parameters:
theta (numpy.ndarray) – Parameter vector
- Returns:
Log prior probability
- Return type:
- class Sat4LatCross_FGFit(spec_cross, sat_err, beta_fid, sat_lrange=(None, None), lat_lrange=(None, None), fit_per_split=True, spectra_selection='all', num_sims=100, verbose=False, cov_mode='diagonal', fg_model='geometric', A_fg_max=2.0)[source]
Bases:
BaseSat4LatCrossCalibration model fitting for birefringence angle β with shared per-frequency foreground amplitude parameters.
Fits calibration angles (alphas), the cosmic birefringence angle β, and per-frequency foreground scaling amplitudes (A_fg) using EB cross-spectra. Here frequency means only the band value (e.g.
93,145), shared across LAT and SAT. Foreground EB templates are computed as full-sky power spectra from the saved dust Q/U maps and then binned with the same binner.Before initialisation the class verifies that LAT and SAT were simulated with the same dust model; a
ValueErroris raised otherwise.- Parameters:
- freq_values
Unique frequency values extracted from map tags (e.g.
['93', '145']).- Type:
List[str]
- fg_templates_binned
Binned foreground EB templates, shape
(n_freq_values, n_freq_values, n_bins).- Type:
np.ndarray
- __init__(spec_cross, sat_err, beta_fid, sat_lrange=(None, None), lat_lrange=(None, None), fit_per_split=True, spectra_selection='all', num_sims=100, verbose=False, cov_mode='diagonal', fg_model='geometric', A_fg_max=2.0)[source]
Initialise calibration analysis with foreground amplitude fitting.
- Parameters:
spec_cross (SpectraCross) – Cross-spectrum calculation object.
sat_err (float) – Satellite calibration angle prior width (degrees).
beta_fid (float) – Fiducial birefringence angle used to build the CMB template.
sat_lrange (Tuple[int | None, int | None]) – Satellite ell range for fitting
(lmin, lmax).lat_lrange (Tuple[int | None, int | None]) – LAT ell range for fitting
(lmin, lmax).fit_per_split (bool) – Fit one alpha per split-map (True) or per frequency (False).
spectra_selection (str) – Which spectra to include:
'all','auto_only', or'cross_only'.num_sims (int) – Number of simulations used for mean/std estimation.
verbose (bool) – Enable verbose logging.
cov_mode (str) – Covariance mode (‘diagonal’, ‘block_diag’, ‘shrinkage’, ‘full’).
fg_model (str) – Foreground amplitude parametrisation.
'geometric': one amplitude per frequency; cross-frequency scaling via geometric meansqrt(A_i * A_j).'per_pair': one independent amplitude per unique (freq_i, freq_j) pair — more robust, no factorizability assumption.A_fg_max (float) – Hard upper bound (in absolute value) for all A_fg parameters. Flat prior on
(-A_fg_max, A_fg_max).
- Raises:
ValueError – If LAT and SAT use different dust foreground models.
- Return type:
None
- theory(theta)[source]
Theoretical EB model including miscalibration, birefringence, and foregrounds.
\[C_\ell^{E_i B_j} = \cos(2\alpha_i+2\beta)\sin(2\alpha_j+2\beta)\,C_{EE} - \sin(2\alpha_i+2\beta)\cos(2\alpha_j+2\beta)\,C_{BB} + \sqrt{A_{fg,i}A_{fg,j}}\,C_\ell^{fg,\,E_i B_j}\]Parameters are ordered as:
[alphas..., beta, A_fg_per_frequency...].- Parameters:
theta (numpy.ndarray)
- Return type:
- lnprior(theta)[source]
Log prior probability.
Gaussian prior on SAT alpha angles (width =
sat_err).Flat prior on beta in
(-0.5, 0.5)degrees.Flat prior on each A_fg in
(-A_fg_max, A_fg_max). Forfg_model='geometric'A_fg is clipped to[0, A_fg_max]because the geometric mean requires non-negative values.Hard bounds
|alpha| < 0.5degrees for all angles.
- Parameters:
theta (numpy.ndarray)
- Return type:
- class Sat4LatCross_AmplitudeFit(spec_cross, sat_err, temp_model, temp_value, sat_lrange=(None, None), lat_lrange=(None, None), fit_per_split=True, spectra_selection='all', sim_idx=None, alpha_lat_prior='gaussian', fix_alpha=False, num_sims=100, verbose=False, cov_mode='diagonal')[source]
Bases:
BaseSat4LatCrossCalibration model fitting for amplitude parameter A_EB.
This class implements a calibration analysis that fits calibration angles (alphas) and an amplitude parameter A_EB using EB cross-spectra between LAT and SAT.
- Parameters:
- eb_template_unbinned
Unbinned EB template spectrum
- binned_template
Binned EB template spectrum
- cl_len
Lensed CMB power spectra dictionary
- cl_diff_unbinned
Unbinned difference spectrum (EE - BB)/2
- __init__(spec_cross, sat_err, temp_model, temp_value, sat_lrange=(None, None), lat_lrange=(None, None), fit_per_split=True, spectra_selection='all', sim_idx=None, alpha_lat_prior='gaussian', fix_alpha=False, num_sims=100, verbose=False, cov_mode='diagonal')[source]
Initialize calibration analysis for amplitude parameter fitting.
- Parameters:
spec_cross (SpectraCross) – Cross-spectrum calculation object
sat_err (float) – Satellite calibration error
temp_model (str) – Template model (‘iso’ or ‘iso_td’)
temp_value (float) – Template parameter value (beta for ‘iso’, mass for ‘iso_td’)
sat_lrange (Tuple[int | None, int | None]) – Satellite ell range for fitting (lmin, lmax)
lat_lrange (Tuple[int | None, int | None]) – LAT ell range for fitting (lmin, lmax)
fit_per_split (bool) – Whether to fit per split or per frequency
spectra_selection (str) – Which spectra to include (‘all’, ‘auto_only’, ‘cross_only’)
sim_idx (int | None) – Simulation index to use for data (default: 0)
alpha_lat_prior (str) – Prior type for LAT alpha parameters (‘gaussian’ or ‘flat’)
fix_alpha (bool) – Whether to fix alpha parameters (calibration angles) to zero
num_sims (int) – Number of simulations for mean/std calculation
verbose (bool) – Whether to enable verbose output
cov_mode (str) – Covariance mode (‘diagonal’, ‘block_diag’, ‘shrinkage’, ‘full’)
- Return type:
None
- theory(theta)[source]
Calculate theoretical model spectrum for given parameters.
- Parameters:
theta (numpy.ndarray) – Parameter vector
- Returns:
Model spectrum array with shape matching data
- Return type:
- lnprior(theta)[source]
Calculate log prior probability for given parameters.
- Parameters:
theta (numpy.ndarray) – Parameter vector
- Returns:
Log prior probability
- Return type:
- class LatCross(spec_cross, lat_err, beta_fid, lat_lrange=(None, None), fit_per_split=True, spectra_selection='all', num_sims=100, verbose=False, cov_mode='diagonal')[source]
Bases:
BaseSat4LatCrossCalibration model fitting for birefringence angle β using LAT-only data.
This class implements a calibration analysis that fits calibration angles (alphas) and the cosmic birefringence angle β using EB cross-spectra from LAT only.
- Parameters:
- cl_len
Lensed CMB power spectra dictionary
- lat_err
LAT calibration error
- __init__(spec_cross, lat_err, beta_fid, lat_lrange=(None, None), fit_per_split=True, spectra_selection='all', num_sims=100, verbose=False, cov_mode='diagonal')[source]
Initialize LAT-only calibration analysis for birefringence angle fitting.
- Parameters:
spec_cross (SpectraCross) – Cross-spectrum calculation object (must be in LAT-only mode)
lat_err (float) – LAT calibration error
beta_fid (float) – Fiducial birefringence angle for theory calculation
lat_lrange (Tuple[int | None, int | None]) – LAT ell range for fitting (lmin, lmax)
fit_per_split (bool) – Whether to fit per split or per frequency
spectra_selection (str) – Which spectra to include (‘all’, ‘auto_only’, ‘cross_only’)
num_sims (int) – Number of simulations for mean/std calculation
verbose (bool) – Whether to enable verbose output
cov_mode (str) – Covariance mode (‘diagonal’, ‘block_diag’, ‘shrinkage’, ‘full’)
- Return type:
None
- theory(theta)[source]
Compute theoretical EB spectra between all LAT map pairs using the exact birefringence + miscalibration formula:
- C_ell^{E_iB_j} = cos(2α_i+2β)sin(2α_j+2β)C_EE
sin(2α_i+2β)cos(2α_j+2β)C_BB
- Parameters:
theta (numpy.ndarray)
- Return type:
- lnprior(theta)[source]
Calculate log prior for LAT-only analysis. Uses Gaussian prior on all alphas with LAT calibration error.
- Parameters:
theta (numpy.ndarray)
- Return type:
Helper Functions
Base Classes
- class BaseSat4LatCross(spec_cross, sat_err, sat_lrange=(None, None), lat_lrange=(None, None), fit_per_split=True, spectra_selection='all', libdir_suffix='BaseSat4LatCross', num_sims=100, verbose=False, cov_mode='diagonal')[source]
Base class for LAT-SAT cross-spectrum calibration analyses.
Provides data loading, beam handling, and plotting logic. Subclasses must define:
self.__pnames__ / self.__plabels__
self.theory(theta)
self.lnprior(theta)
- Parameters:
- spec_cross
Cross-spectrum calculation object
- sat_err
Satellite calibration error
- sat_lrange
Satellite ell range for fitting
- lat_lrange
LAT ell range for fitting
- fit_per_split
Whether to fit per split or per frequency
- spectra_selection
Which spectra to include (‘all’, ‘auto_only’, ‘cross_only’)
- libdir
Directory for caching results
- binner
Binning information object
- Lmax
Maximum multipole
- maptags
List of map tags
- freq_groups
Dictionary mapping frequency bases to indices
- freq_bases
List of frequency base names
- mean_spec
Mean spectra from simulations
- std_spec
Standard deviation of spectra
- beam_arr
Beam transfer function array
- __init__(spec_cross, sat_err, sat_lrange=(None, None), lat_lrange=(None, None), fit_per_split=True, spectra_selection='all', libdir_suffix='BaseSat4LatCross', num_sims=100, verbose=False, cov_mode='diagonal')[source]
- cov_mode controls how the data covariance is estimated:
‘diagonal’ – per-bin variance from sims (default, always safe). ‘block_diag’ – one (n_bins × n_bins) block per (i,j) map pair,
each block Hartlap-corrected. Needs N_sims >> n_bins (not N_sims >> n_data). Recommended when you want ell-ell correlations without full-matrix instability.
- ‘shrinkage’ – full (n_data × n_data) covariance shrunk toward the
identity via OAS. Well-conditioned at any N_sims.
- ‘full’ – raw sample covariance + Hartlap correction.
Requires N_sims > n_data + 2; raises ValueError otherwise.
- abstract theory(theta)[source]
Calculate theoretical model spectrum for given parameters.
- Parameters:
theta (numpy.ndarray) – Parameter vector
- Returns:
Model spectrum array with shape matching data
- Return type:
- abstract lnprior(theta)[source]
Calculate log prior probability for given parameters.
- Parameters:
theta (numpy.ndarray) – Parameter vector
- Returns:
Log prior probability
- Return type:
- _build_likelihood_mask()[source]
Build boolean mask for likelihood evaluation based on ell ranges.
- Returns:
Boolean mask array with shape (n_tags, n_tags, n_bins)
- Return type:
- __all_spectra__(num_sims=100)[source]
Get all spectra data matrix for current ell ranges.
- Returns:
Data matrix array with shape (n_tags, n_tags, n_bins)
- Parameters:
num_sims (int)
- Return type:
- _calc_mean_std(num_sims=100)[source]
Calculate mean and standard deviation of spectra over simulations.
- Parameters:
num_sims (int) – Number of simulations to use
- Returns:
Tuple of (mean_spectrum, std_spectrum) arrays
- Return type:
- _get_beam_arr()[source]
Calculate beam transfer function array for all map tag combinations.
- Returns:
Beam array with shape (n_tags, n_tags, n_bins)
- Return type:
- _calc_covariance(num_sims=100)[source]
Estimate and cache the data covariance under the likelihood mask.
The mode is controlled by
self.cov_mode:'block_diag': independent (n_bins × n_bins) blocks per (i,j) map pair, each Hartlap-corrected. Only needs N_sims >> n_bins_per_pair.'shrinkage': full covariance regularised by OAS shrinkage toward the scaled identity. Well-conditioned for any N_sims.'full': raw sample covariance + Hartlap. Raises ValueError when N_sims ≤ n_data + 2.
- Return type:
(cov,cov_inv,logdet_cov)- Parameters:
num_sims (int)
- chisq(theta)[source]
Calculate chi-squared statistic for given parameters.
When use_full_cov=True uses the full inverse covariance matrix; otherwise uses diagonal (per-bin) variances.
- Parameters:
theta (numpy.ndarray)
- Return type:
- ln_likelihood(theta)[source]
Calculate log likelihood for given parameters.
- Parameters:
theta (numpy.ndarray)
- Return type:
- ln_prob(theta)[source]
Calculate log posterior probability for given parameters.
- Parameters:
theta (numpy.ndarray)
- Return type:
- run_mcmc(nwalkers=32, nsamples=2000, rerun=False, fiducial_params=None, fname=None, burnin=200, thin=20)[source]
Run (or extend/resume) MCMC using an emcee HDF5 backend.
The backend file grows as you call run_mcmc with larger nsamples — no samples are ever discarded from disk. burnin and thin only affect what is returned; you can change them freely without re-running.
- Parameters:
nwalkers (int) – Number of walkers.
nsamples (int) – Target total number of steps stored in the backend. If the backend already has >= nsamples steps, the chain is returned immediately. If it has fewer, only the remaining steps are run (extending the existing chain).
rerun (bool) – If True, wipe the backend and start from scratch.
fiducial_params (numpy.ndarray | None) – Starting point for walkers (required on first run; ignored when resuming an existing chain).
fname (str | None) – Override the auto-generated backend path (.h5 file).
burnin (int) – Steps to discard from the front when returning the chain.
thin (int) – Thinning factor applied when returning the chain.
- Return type:
- getdist_samples(nwalkers, nsamples, rerun=False, fiducial_params=None, label=None, burnin=200, thin=20)[source]
- plot_posteriors(nwalkers, nsamples, rerun=False, label=None, fiducial_params=None, burnin=200, thin=20)[source]
- plot_spectra_matrix(theta=None, save_path=None, average_split=False)[source]
Plots the mean data spectra with std deviation and optionally a theory curve in a matrix layout corresponding to all cross-correlations.
- Parameters:
theta (numpy.ndarray | None) – Parameter vector (alphas, beta, A_EB, etc.) for theory overlay.
save_path (str | None) – If given, saves the figure instead of showing.
average_split (bool) – If True, average spectra across splits per frequency.
- Return type:
None
- _abc_impl = <_abc._abc_data object>
Calibration Classes
- class Sat4LatCross(spec_cross, sat_err, beta_fid, sat_lrange=(None, None), lat_lrange=(None, None), fit_per_split=True, spectra_selection='all', num_sims=100, verbose=False, cov_mode='diagonal')[source]
Bases:
BaseSat4LatCrossCalibration model fitting for birefringence angle β.
This class implements a calibration analysis that fits calibration angles (alphas) and the cosmic birefringence angle β using EB cross-spectra between LAT and SAT.
- Parameters:
- cl_len
Lensed CMB power spectra dictionary
- __init__(spec_cross, sat_err, beta_fid, sat_lrange=(None, None), lat_lrange=(None, None), fit_per_split=True, spectra_selection='all', num_sims=100, verbose=False, cov_mode='diagonal')[source]
Initialize calibration analysis for birefringence angle fitting.
- Parameters:
spec_cross (SpectraCross) – Cross-spectrum calculation object
sat_err (float) – Satellite calibration error
beta_fid (float) – Fiducial birefringence angle for theory calculation
sat_lrange (Tuple[int | None, int | None]) – Satellite ell range for fitting (lmin, lmax)
lat_lrange (Tuple[int | None, int | None]) – LAT ell range for fitting (lmin, lmax)
fit_per_split (bool) – Whether to fit per split or per frequency
spectra_selection (str) – Which spectra to include (‘all’, ‘auto_only’, ‘cross_only’)
num_sims (int) – Number of simulations for mean/std calculation
verbose (bool) – Whether to enable verbose output
cov_mode (str) – Covariance mode (‘diagonal’, ‘block_diag’, ‘shrinkage’, ‘full’)
- Return type:
None
- theory(theta)[source]
Compute theoretical EB spectra between all map pairs using the exact birefringence + miscalibration formula:
- C_ell^{E_iB_j} = cos(2α_i+2β)sin(2α_j+2β)C_EE
sin(2α_i+2β)cos(2α_j+2β)C_BB
Optionally adds a dust foreground power law: A_dust * (ell/80)^alpha_dust
- Parameters:
theta (numpy.ndarray)
- Return type:
- lnprior(theta)[source]
Calculate log prior probability for given parameters.
- Parameters:
theta (numpy.ndarray) – Parameter vector
- Returns:
Log prior probability
- Return type:
- class Sat4LatCross_AmplitudeFit(spec_cross, sat_err, temp_model, temp_value, sat_lrange=(None, None), lat_lrange=(None, None), fit_per_split=True, spectra_selection='all', sim_idx=None, alpha_lat_prior='gaussian', fix_alpha=False, num_sims=100, verbose=False, cov_mode='diagonal')[source]
Bases:
BaseSat4LatCrossCalibration model fitting for amplitude parameter A_EB.
This class implements a calibration analysis that fits calibration angles (alphas) and an amplitude parameter A_EB using EB cross-spectra between LAT and SAT.
- Parameters:
- eb_template_unbinned
Unbinned EB template spectrum
- binned_template
Binned EB template spectrum
- cl_len
Lensed CMB power spectra dictionary
- cl_diff_unbinned
Unbinned difference spectrum (EE - BB)/2
- __init__(spec_cross, sat_err, temp_model, temp_value, sat_lrange=(None, None), lat_lrange=(None, None), fit_per_split=True, spectra_selection='all', sim_idx=None, alpha_lat_prior='gaussian', fix_alpha=False, num_sims=100, verbose=False, cov_mode='diagonal')[source]
Initialize calibration analysis for amplitude parameter fitting.
- Parameters:
spec_cross (SpectraCross) – Cross-spectrum calculation object
sat_err (float) – Satellite calibration error
temp_model (str) – Template model (‘iso’ or ‘iso_td’)
temp_value (float) – Template parameter value (beta for ‘iso’, mass for ‘iso_td’)
sat_lrange (Tuple[int | None, int | None]) – Satellite ell range for fitting (lmin, lmax)
lat_lrange (Tuple[int | None, int | None]) – LAT ell range for fitting (lmin, lmax)
fit_per_split (bool) – Whether to fit per split or per frequency
spectra_selection (str) – Which spectra to include (‘all’, ‘auto_only’, ‘cross_only’)
sim_idx (int | None) – Simulation index to use for data (default: 0)
alpha_lat_prior (str) – Prior type for LAT alpha parameters (‘gaussian’ or ‘flat’)
fix_alpha (bool) – Whether to fix alpha parameters (calibration angles) to zero
num_sims (int) – Number of simulations for mean/std calculation
verbose (bool) – Whether to enable verbose output
cov_mode (str) – Covariance mode (‘diagonal’, ‘block_diag’, ‘shrinkage’, ‘full’)
- Return type:
None
- theory(theta)[source]
Calculate theoretical model spectrum for given parameters.
- Parameters:
theta (numpy.ndarray) – Parameter vector
- Returns:
Model spectrum array with shape matching data
- Return type:
- lnprior(theta)[source]
Calculate log prior probability for given parameters.
- Parameters:
theta (numpy.ndarray) – Parameter vector
- Returns:
Log prior probability
- Return type: