moment_guesses#
- mufasa.moment_guess.moment_guesses(moment1, moment2, ncomp, sigmin=0.07, tex_guess=3.2, tau_guess=0.5, moment0=None, linetype='nh3', mom0_floor=None)[source]#
Generate reasonable initial guesses for multiple component fits based on moment maps.
- Parameters:
moment1 (numpy.ndarray) – The first moment (velocity centroid) map.
moment2 (numpy.ndarray) – The second moment (velocity dispersion) map.
ncomp (int) – Number of components for the fit.
sigmin (float, optional) – Minimum velocity dispersion (in km/s). Default is 0.07 km/s, the spectral resolution of the GAS channels.
tex_guess (float, optional) – Initial guess for the excitation temperature (T_ex). Default is 3.2 K.
tau_guess (float, optional) – Initial guess for the optical depth (tau). Default is 0.5.
moment0 (numpy.ndarray, optional) – Zeroth moment (integrated intensity) map. If provided, this will be used to modify the guesses for T_ex and tau. Default is None.
linetype (str, optional) – Line type, either ‘nh3’ or ‘n2hp’. Determines parameter limits. Default is ‘nh3’.
mom0_floor (float, optional) – Minimum floor value for moment0 when normalizing. If not provided, a default normalization is applied. Default is None.
- Returns:
A 2D array of shape (ncomp * 4, moment1.shape) containing the guesses for each parameter: - Component velocity centroids. - Velocity dispersions. - Excitation temperatures. - Optical depths.
- Return type:
Notes
For ncomp == 1, the method uses a single-component guess based on the provided moments.
For ncomp == 2, the method applies a recipe for a bright and faint component with offsets in velocity and reduced T_ex and tau for the faint component.
For ncomp > 2, components are evenly spaced in velocity, and parameter guesses are scaled accordingly.
If moment0 is provided, the guesses for T_ex and tau are scaled based on the normalized moment0 values.
Examples
>>> import numpy as np >>> moment1 = np.array([[1.0, 2.0], [3.0, 4.0]]) >>> moment2 = np.array([[0.1, 0.2], [0.3, 0.4]]) >>> ncomp = 2 >>> guesses = moment_guesses(moment1, moment2, ncomp, tex_guess=4.0, tau_guess=0.8)
>>> moment0 = np.array([[1.5, 2.5], [3.5, 4.5]]) >>> guesses_with_mom0 = moment_guesses(moment1, moment2, ncomp, moment0=moment0, mom0_floor=0.1)
- Raises:
ValueError – If ncomp is less than 1 or other parameters are invalid.