kinextract.fit_losvd_gauss_hermite
- kinextract.fit_losvd_gauss_hermite(v: ndarray, y: ndarray, fit_h3h4: bool = True) dict[source]
Fit the classic 4-moment Gauss-Hermite model to a non-parametric LOSVD.
This is the standard, publication-facing GH characterization of the recovered non-parametric LOSVD: a bounded least-squares fit of
gauss_hermite_losvd_model()(legacy fortran H3/H4 normalization, matching the original Fortran pipeline pallmc.f) toy(v), giving the mean velocity V, dispersion sigma, and the skewness/kurtosis-like moments h3 and h4. Initial guesses are derived fromgetfwhm_fortran_like(), and sigma is fit in log-space to enforce positivity. This is the fitter used bykinextract.plotting.plot_losvd()and bykinextract.errors.LOSVDErrorEstimatorto characterize both the MAP LOSVD and each bootstrap replicate. For higher-order (h5, h6, …) characterization using the vdM1993 convention instead, seefit_losvd_gauss_hermite_higher().- Parameters:
v (ndarray) – Velocity grid (km/s) on which the LOSVD
yis sampled.y (ndarray) – Non-parametric LOSVD amplitude at each
v(same shape asv).fit_h3h4 (bool, optional) – If True (default), fit h3 and h4 along with amplitude, V, and sigma. If False, h3 and h4 are fixed to zero and only a pure Gaussian (amp, V, sigma) is fit — useful for comparing against a strictly-Gaussian LOSVD assumption.
- Returns:
Dictionary with keys:
vherm,sherm: fitted mean velocity and dispersion (km/s).h3,h4: fitted Gauss-Hermite moments (dimensionless, fortran convention — seefh3_fortran_like()); zero iffit_h3h4=False.amp: fitted overall amplitude/normalization.fwhm_sigma: sigma estimate derived from the FWHM initial guess (km/s), useful as a sanity check againstsherm.v1,v2: flux-weighted centroid and RMS width of the raw LOSVD (km/s), model-free moments fromgetfwhm_fortran_like().fwhm,vmax,ymax,x_left,x_right: raw half-max diagnostics fromgetfwhm_fortran_like().model: the best-fit GH model evaluated on the full inputvgrid (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).
If fewer than 5 finite
(v, y)points are available, all numeric keys are NaN andfit_successis False.- Return type: