get_all_lnk_maps#
- mufasa.UltraCube.get_all_lnk_maps(ucube, ncomp_max=2, rest_model_mask=True, multicore=True)[source]#
Compute log-likelihood ratio maps for model comparisons up to a specified number of components.
This function calculates log-likelihood ratio (lnk) maps for comparing spectral models with different numbers of components, based on the Akaike Information Criterion corrected for finite sample sizes (AICc).
- Parameters:
ucube (UltraCube) – An instance of the UltraCube class containing the spectral data and fitted models.
ncomp_max (int, optional) – The maximum number of components to include in the model comparison. Default is 2.
rest_model_mask (bool, optional) – If True, resets and updates the master model mask in ucube for components being compared. Default is True.
multicore (bool, optional) – Whether to enable parallel processing for calculations. Default is True.
- Returns:
lnk_maps – Log-likelihood ratio maps for the model comparisons. The returned maps include: - lnk10: Comparison between 1-component and 0-component models. - lnk20 (if ncomp_max >= 2): Comparison between 2-component and 0-component models. - lnk21 (if ncomp_max >= 2): Comparison between 2-component and 1-component models.
- Return type:
Notes
Log-likelihood ratios are calculated using AICc values for each model as:
\[\ln(\mathcal{L}_A / \mathcal{L}_B) = (AICc_B - AICc_A) / 2\]where \(\mathcal{L}_A\) and \(\mathcal{L}_B\) are the likelihoods of models A and B, respectively.
If ncomp_max is greater than 2, the function does not compute higher-order comparisons and simply returns the log-likelihood maps for up to 2 components.
- Raises:
ValueError – If ncomp_max is less than 1 or if model data for the required number of components is missing in ucube.