- qspec.analyze.King. fit ( a , a_ref , x=None , y=None , xy=(0, 1) , func=york_fit , alpha=0 , find_alpha=False , show=True , **kwargs )[source]
-
Perform $2$-dimensional linear regression to create a King plot, see
linear_alpha_fit. The data are modified with the mass factors $\mu$, seeqspec.physics.mass_factor. Choose between{"york_fit" (default), "linear_fit", "linear_monte_carlo"}for the fit routine. Use a parameteralphato optimize the correlation coefficient between the $y$-intercept and the slope.- Parameters:
-
- aarray_like
An iterable of the mass numbers $A$ of the used isotopes.
- a_refarray_like
An iterable of the mass numbers $A_\mathrm{ref}$ of the used reference isotopes.
- xarray_like | None
The $x$ data and their standard deviations as shape
(len(a), 2)arrays. Either the differences of mean-square nuclear charge radii $\delta\langle r^2\rangle^{A,A_\mathrm{ref}}$ or $\Lambda^{A,A_\mathrm{ref}}$ (fm$^2$), plotted withmode="radii", or isotope shifts $\delta\nu_x^{A,A_\mathrm{ref}}$ (MHz), plotted withmode="shifts", seeKing.plot. IfNone,xis inherited fromKing.x_abs.- yarray_like | None
The isotope shifts $\delta\nu_y^{A,A_\mathrm{ref}}$ and their standard deviations as shape
(len(a), 2)arrays (MHz). IfNone,yis inherited fromKing.x_abs.- xytuple[int, int]
A 2-tuple of indices
(ix, iy), used to select the two plot axes fromKing.x_abs. Only used ifxoryis not specified. The default value is(0, 1), fitting the second against the first axis.- funcstr | Callable
The fitting routine. Must be one of
{"york_fit" (default), "linear_fit", "linear_monte_carlo"}.- alphascalar
An $x$-axis offset $\alpha$ to reduce the correlation coefficient between the $y$-intercept and the slope. Expected unit: (u fm$^2$) or (u MHz).
- find_alphabool
Whether to search for the best
alpha. Uses the givenalphaas a starting point. May not give the desired result ifalphawas initialized too far from its optimal value.- showbool
Whether to plot the fit result.
- kwargs
Additional keyword arguments are passed to
King.plot.
- Returns:
- Raises:
-
- ValueError
If less than 3 data points are given, if neither
x(y) norKing.x_absare given, or iffuncis not supported.