Logo

A physics toolbox for laser spectroscopy.

Static Badge Static Badge Static Badge

Static Badge Static Badge

© 2025 Patrick Müller. All rights reserved.

qspec.analyze.linear_nd_fit  (  x cov = None p0 = None axis = None optimize_cov = False ** kwargs  )[source]

Parameters:
xndarray | Iterable

The data vectors. Must have shape (k, n), where k is the number of data points and n is the number of dimensions of each point.

covndarray | Iterable

The covariance matrices of the data vectors. Must have shape (k, n, n). Use 'covariance_matrix' to construct covariance matrices.

p0ndarray | Iterable

The start parameters for the linear fit. Must have shape (2n, ). The first n elements specify the origin vector of the straight, the second n elements specify the direction of the straight.

axisint

The component of the n-dimensional vectors which are fixed for fitting. This is required since a straight in n dimensions is fully described by 2 (n - 1) parameters. If None, the best axis is determined from the data and the direction vector of the straight is normalized.

optimize_covbool

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

kwargsNone

Additional keyword arguments.

Returns:
outNone

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

API navigation