get_best_2comp_model#
- mufasa.master_fitter.get_best_2comp_model(reg)[source]#
Retrieve the best-fit model cube for the given Region object.
The method selects between one- and two-component fits based on log-likelihood values.
- Parameters:
reg (Region) – The Region object containing the original spectral cube and the fitted model results.
- Returns:
A 3D array representing the data cube of the best-fit model for each pixel, where the third dimension corresponds to the spectral axis.
- Return type:
Notes
The best-fit model is determined using log-likelihood thresholds:
One-component fits are selected if their relative log-likelihood (lnk10) exceeds 5.
Two-component fits are selected if their relative log-likelihood (lnk21) exceeds 5 and their relative log-likelihood compared to the noise model (lnk20) also exceeds 5.
The function combines the model cubes for one- and two-component fits into a single “best” model cube by assigning the appropriate model to each spatial pixel.
Examples
>>> from region import Region >>> reg = Region('input_cube.fits', 'output_root', fittype='nh3') >>> best_model = get_best_2comp_model(reg) >>> # Returns a 3D NumPy array representing the best-fit model cube.