kinextract.fit_losvd_gauss_hermite_higher

kinextract.fit_losvd_gauss_hermite_higher(v: ndarray, y: ndarray, max_order: int = 6) dict[source]

Fit a higher-order Gauss-Hermite model (h3..h_max_order) to a LOSVD.

Least-squares fits gauss_hermite_losvd_model_ho() to the sampled, non-parametric LOSVD y(v), using van der Marel & Franx (1993) normalized Hermite polynomials (vdM1993) — the same convention as pPXF. Including higher-order terms beyond h3/h4 lets the fit absorb non-Gaussian wings that would otherwise bias a truncated 4-moment fit (fit_losvd_gauss_hermite()), typically giving more accurate recovered V and sigma at the cost of extra nuisance parameters. Initial guesses for amplitude, center, and width are derived from getfwhm_fortran_like(); all higher-order h terms start at zero. Bounded least-squares (scipy.optimize.least_squares) is used with log parametrization of sigma to keep it positive.

Parameters:
  • v (ndarray) – Velocity grid (km/s) on which the LOSVD y is sampled.

  • y (ndarray) – Non-parametric LOSVD amplitude at each v (same shape as v).

  • max_order (int, optional) – Highest Gauss-Hermite moment order to fit (minimum enforced value is 4, i.e. at least h3 and h4 are always fit). Default is 6, fitting h3, h4, h5, h6.

Returns:

Dictionary with keys:

  • vherm, sherm : fitted mean velocity and dispersion (km/s).

  • amp : fitted overall amplitude/normalization.

  • h3, h4, … up to h{max_order} : fitted higher-order Gauss-Hermite moments (dimensionless, vdM1993 convention — these differ numerically from the fortran-convention h3/h4 returned by fit_losvd_gauss_hermite()).

  • model : the best-fit model evaluated on the full input v grid (NaN where the fit could not be performed).

  • fit_success : bool, whether the least-squares solver converged.

  • fit_message : str, solver status message (or failure reason).

  • max_order : int, the (possibly clamped) max order actually used.

  • convention : str, always "vdM1993" for this function.

If fewer than 5 finite (v, y) points are available, all numeric keys are NaN and fit_success is False.

Return type:

dict