get_rss#
- mufasa.UltraCube.get_rss(cube, model, expand=20, usemask=True, mask=None, return_size=True, return_mask=False, include_nosamp=True, planemask=None)[source]#
Calculate the residual sum of squares (RSS) for a spectral cube model fit.
- Parameters:
cube (SpectralCube) – The spectral data cube to analyze.
model (numpy.ndarray) – The model array to compare against the data cube.
expand (int, optional) – Number of channels to expand the region where the RSS is calculated along the spectral dimension. Default is 20.
usemask (bool, optional) – Whether to apply a mask during RSS calculation. Default is True.
mask (numpy.ndarray, optional) – A boolean array specifying which elements to include in the calculation. If None, a default mask based on the model is used.
return_size (bool, optional) – If True, return the size of the valid sample region used in the RSS calculation. Default is True.
return_mask (bool, optional) – If True, return the final mask used during RSS computation. Default is False.
include_nosamp (bool, optional) – Whether to include spectral regions with no sample data by filling gaps with a default mask. Default is True.
planemask (numpy.ndarray, optional) – A 2D mask specifying where to calculate RSS for optimized computation. Default is None.
- Returns:
The calculated RSS values. If return_size or return_mask is True, additional elements include: - Sample size per pixel (if return_size is True). - Final mask used (if return_mask is True).
- Return type: