- 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:
-
- andarray | Iterable
An Iterable of the mass numbers $A$ of the used isotopes.
- a_refndarray | Iterable
An Iterable of the mass numbers $A_\mathrm{ref}$ of the used reference isotopes.
- xndarray | Iterable
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 andnis 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}$ ifaxis == 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
funcandKing.plot.
- Returns:
-
- (popt, pcov)(ndarray, ndarray)
The optimized parameters and their covariances. The resulting shapes are
(2 * n, )and(2 * n, 2 * n).