fit_phi_value

sofia_redux.toolkit.resampling.fit_phi_value(phi, coefficients)[source]

Returns the dot product of phi and coefficients.

A utility function for use in calculating the polynomial fit based on the polynomial terms of the independent values (phi), and a set of calculated coefficients.

The return value for phi (\(\Phi\)) terms and coefficients (\(c\)) each consisting of \(L\) terms is:

\[y = \sum_{l=1}^{L}{c_l \Phi_l}\]

The polynomial terms \(\Phi\) are pre-calculated and used in place of regular independent values \(x\) in the resampling algorithm to avoid the unnecessary recalculation of terms in a polynomial equation. For example, if fitting

\[y = 5 x_0 x_1 + 6 x_0 x_3^2 + 7 x_1^3 x_4^2 + 8 x_0 x_1 x_2 x_3\]

we set

\[ \begin{align}\begin{aligned}c = [5,\, 6,\, 7,\, 8]\\\Phi = [x_0 x_1,\, x_0 x_3^2,\, x_1^3 x_4^2,\, x_0 x_1 x_2 x_3]\end{aligned}\end{align} \]

and then only need to perform the simple fast calculation

\[y = c \cdot \Phi\]
Parameters:
phinumpy.ndarray (n_coefficients,)

Polynomial terms of independent values.

coefficientsnumpy.ndarray (n_coefficients,)

Coefficients used to determine fit.

Returns:
fitfloat

The fitted value.