correctionlib.convert.ndpolyfit

correctionlib.convert.ndpolyfit(points: List[ndarray[Any, Any]], values: ndarray[Any, Any], weights: ndarray[Any, Any], varnames: List[str], degree: Tuple[int]) Tuple[Correction, Any]

Fit an n-dimensional polynomial to data points with weight

Example:

corr, fitresult = convert.ndpolyfit(
    points=[np.array([0.0, 1.0, 0.0, 1.0]), np.array([10., 20., 10., 20.])],
    values=np.array([0.9, 0.95, 0.94, 0.98]),
    weights=np.array([0.1, 0.1, 0.1, 0.1]),
    varnames=["abseta", "pt"],
    degree=(1, 1),
)

Returns a Correction object along with the least squares fit result