fit_residual

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

Calculates the residual of a polynomial fit to data.

The residual is calculated using the matrix operation Y - CX where Y is the dataset, C are the coefficients and X is the phi polynomial terms.

Parameters:
datanumpy.ndarray (n_samples,)

Data from which coefficients were derived.

phinumpy.ndarray (n_terms, n_samples)

Polynomial terms of independent values of each sample.

coefficientsnumpy.ndarray (n_terms,)

Coefficient values.

Returns:
residualnumpy.ndarray (n_samples,)

The residual