get_best_2c_parcube#

mufasa.UltraCube.get_best_2c_parcube(ucube, multicore=True, lnk21_thres=5, lnk20_thres=5, lnk10_thres=5, return_lnks=True, include_1c=True)[source]#

Select the best 2-component parameter cube based on AICc likelihood thresholds.

This function identifies regions in the parameter cube where the 2-component model is justified over simpler models (0- or 1-component) based on log-likelihood ratio thresholds calculated from the AICc. It can also combine results with a 1-component model for regions where 2-component fits are not justified.

Parameters:
  • ucube (UltraCube) – An instance of the UltraCube class containing spectral data and model fits.

  • multicore (bool, optional) – Whether to enable parallel processing for calculations. Default is True.

  • lnk21_thres (float, optional) – Threshold for the log-likelihood ratio between 2-component and 1-component models. Default is 5.

  • lnk20_thres (float, optional) – Threshold for the log-likelihood ratio between 2-component and 0-component models. Default is 5.

  • lnk10_thres (float, optional) – Threshold for the log-likelihood ratio between 1-component and 0-component models. Default is 5.

  • return_lnks (bool, optional) – If True, return the log-likelihood ratio maps (lnk10, lnk20, lnk21) along with the parameter and error cubes. Default is True.

  • include_1c (bool, optional) – If True, include 1-component model results in regions where the 2-component model is not justified. Default is True.

Returns:

If return_lnks is True:
  • parcubenumpy.ndarray

    A 3D array representing the best-fit parameter cube for the justified model in each spatial region.

  • errcubenumpy.ndarray

    A 3D array representing the associated errors for the parameters.

  • lnk10numpy.ndarray

    Log-likelihood ratio map comparing 1-component and 0-component models.

  • lnk20numpy.ndarray

    Log-likelihood ratio map comparing 2-component and 0-component models.

  • lnk21numpy.ndarray

    Log-likelihood ratio map comparing 2-component and 1-component models.

If return_lnks is False:
  • parcube : numpy.ndarray

  • errcube : numpy.ndarray

Return type:

tuple

Notes

  • The function determines the best model for each spatial region by comparing log-likelihood ratios with the specified thresholds.

  • Regions where the 2-component model is not justified (based on lnk21_thres and lnk20_thres) can revert to the 1-component model if include_1c is True.

  • Any region failing to meet the lnk10_thres threshold for the 1-component model is set to NaN in the parameter and error cubes.

Raises:

ValueError – If model fits for 1-component or 2-component models are missing in ucube.