- 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. The data are modified with the mass factors $\mu$, see
qspec.physics.mass_factor. 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 data as an iterable of vectors with standard deviations of shape
(k, n, 2), wherekis the number of data points/isotopes andnis the dimension of each vector. IfNone,xis inherited fromKing.x_abs.- 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 line 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.
- kwargs
Additional keyword arguments are passed to
funcandKing.plot.
- Returns:
- Raises:
-
- ValueError
If neither
xnorKing.x_absare given or iffuncis not supported.