Logo

A physics toolbox for laser spectroscopy.

Static Badge Static Badge Static Badge

Static Badge Static Badge

© 2026 Patrick Müller. All rights reserved.

qspec.analyze. King.fit_nd  (  a a_ref x = None axis = 0 optimize_cov = False func = 'linear_nd_fit' show = True ** kwargs  )[source]

Perform $n$-dimensional linear regression to create a King plot. Choose between {"linear_nd_fit" (default), "linear_nd_monte_carlo"} for the fit routine.

Parameters:
ascalar_nd

An Iterable of the mass numbers $A$ of the used isotopes.

a_refscalar_nd

An Iterable of the mass numbers $A_\mathrm{ref}$ of the used reference isotopes.

xscalar_nd | None

The $x$ data as an iterable of vectors with standard deviations of shape (k, n, 2), where k is the number of data points/isotopes and n is the dimension of each vector.

axisint

The vector component to use for the parameterization. For example, a King plot with the isotope shifts of two transitions ["D1", "D2"] yields the slope $F_\mathrm{D2} / F_\mathrm{D1}$ if axis == 0.

optimize_covbool

If True, the origin vector of the straight is optimized to yield the smallest covariances.

funcCallable | str

The fitting routine. Must be one of {"linear_nd_fit" (default), "linear_nd_monte_carlo"}.

showbool

Whether to plot the fit result.

kwargsNone

Additional keyword arguments are passed to func and King.plot.

Returns:
(popt, pcov)tuple[ndarray, ndarray]

The optimized parameters and their covariances. The resulting shapes are (2 * n, ) and (2 * n, 2 * n).

API navigation