rubin_sim.moving_objects.chebfit(t, x, dxdt=None, x_multiplier=None, dx_multiplier=None, n_poly=7)

Fit Chebyshev polynomial constrained at endpoints using Newhall89 approach.

Return Chebyshev coefficients and statistics from fit to array of positions (x) and optional velocities (dx/dt). If both the function and its derivative are specified, then the value and derivative of the interpolating polynomial at the endpoints will be exactly equal to the input endpoint values. Many approximations may be piecewise strung together and the function value and its first derivative will be continuous across boundaries. If derivatives are not provided, only the function value will be continuous across boundaries.

If x_multiplier and dx_multiplier are not provided or are an inappropriate shape for t and x, they will be recomputed. See Newhall, X. X. 1989, Celestial Mechanics, 45, p. 305-310 for details.


Array of regularly sampled independent variable (e.g. time)


Array of regularly sampled dependent variable (e.g. declination)

dxdt`np.ndarray’, optional

Optionally, array of first derivatives of x with respect to t, at the same grid points. (e.g. sky velocity ddecl/dt)

x_multipliernp.ndarray, optional

Optional 2D Matrix with rows of C1^(-1)C2 corresponding to x. Use make_cheb_matrix to compute

dx_multipliernp.ndarray, optional

Optional 2D Matrix with rows of C1^(-1)C2 corresponding to dx/dt. Use make_cheb_matrix to compute

n_polyint, optional

Number of polynomial terms. Degree + 1. Must be >=2 and <=2*n_points, when derivative information is specified, or <=n_points, when no derivative information is specified. Default = 7.


Array of chebyshev coefficients with length=n_poly.


Array of residuals of the tabulated function x minus the approximated function.


The rms of the residuals in the fit.


The maximum of the residals to the fit.