get_best_2comp_residual_cnv#

mufasa.master_fitter.get_best_2comp_residual_cnv(reg, masked=True, window_hwidth=3.5, res_snr_cut=3)[source]#

Generate a convolved residual cube for the best-fit two-component spectral model.

Parameters:
  • reg (Region) – The Region object containing the spectral cube and associated fit results.

  • masked (bool, optional) – If True, masks the convolved residual cube to include only regions where the residual exceeds a signal-to-noise threshold (res_snr_cut). Defaults to True.

  • window_hwidth (float, optional) – Half-width (in km/s) of the velocity window used to define the residual region for masking. Defaults to 3.5.

  • res_snr_cut (float, optional) – Minimum signal-to-noise ratio for a residual peak to be considered excessive and included in the mask. Only applied when masked=True. Defaults to 3.

Returns:

The convolved residual cube.

Return type:

SpectralCube

Raises:

SNRMaskError – If the residual cube has no regions exceeding the specified signal-to-noise threshold.

Notes

  • The convolved residual cube is computed from the best-fit two-component model by subtracting the model from the original spectral cube and applying a convolution with the Region’s convolution factor.

  • When masked=True, the function restricts the convolution to regions where the residual peak SNR exceeds the specified res_snr_cut, which helps focus on significant residuals.

  • The velocity window defined by window_hwidth is used to identify residual regions around the spectral features.

Examples

>>> from region import Region
>>> reg = Region('input_cube.fits', 'output_root', fittype='nh3')
>>> residual_cube = get_best_2comp_residual_cnv(reg, masked=True, window_hwidth=4.0, res_snr_cut=2.5)
>>> # Returns the convolved residual cube, masking regions with low signal-to-noise residuals.