get_2comp_wide_guesses#

mufasa.master_fitter.get_2comp_wide_guesses(reg, window_hwidth=3.5, snr_min=3, savefit=True, planemask=None)[source]#

Generate initial guesses for fitting a two-component spectral model with wide velocity separation.

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

  • window_hwidth (float, optional) – Half-width (in km/s) of the velocity window used for moment-based guesses. Defaults to 3.5.

  • snr_min (float, optional) – Minimum signal-to-noise ratio for selecting pixels to refit. Defaults to 3.

  • savefit (bool, optional) – If True, saves the residual fit results to disk. Defaults to True.

  • planemask (numpy.ndarray, optional) – Boolean mask specifying which spatial pixels to fit. Pixels outside the mask are excluded. Defaults to None.

Returns:

A 2D array of shape (n_parameters, spatial_dim_1, spatial_dim_2) containing the initial parameter guesses for the two-component fit.

Return type:

numpy.ndarray

Raises:
  • SNRMaskError – If no valid pixels meet the signal-to-noise threshold for fitting.

  • StartFitError – If no pixels successfully start fitting due to poor initial guesses or insufficient signal.

Notes

  • The function prioritizes using residual fits to generate guesses. If residual fitting fails, it falls back to moment-based guesses from the spectral cube.

  • The method refines guesses to ensure they are within parameter limits and compatible with the model.

Examples

>>> from region import Region
>>> reg = Region('input_cube.fits', 'output_root', fittype='nh3')
>>> guesses = get_2comp_wide_guesses(reg, window_hwidth=4.0, snr_min=2.5)
>>> # Generates initial guesses for two-component wide separation fits.