kinextract.build_pspline_design

kinextract.build_pspline_design(x: ndarray, n_interior_knots: int = 10, degree: int = 3) tuple[ndarray, ndarray][source]

Build a B-spline design matrix for the continuum.

Parameters:
  • x (ndarray) – Wavelength (or pixel) array the continuum is defined on, length npix.

  • n_interior_knots (int, optional) – Number of interior knots spanning [x.min(), x.max()]. More knots -> more local flexibility; n_coef = n_interior_knots + degree + 1 coefficients result. Default 10 (with a cubic spline, 14 coefficients) comfortably resolves a handful of continuum “features” across a typical few-hundred-pixel fit window without approaching the LOSVD’s own 29 degrees of freedom.

  • degree (int, optional) – B-spline polynomial degree per segment. Default 3 (cubic), the standard smooth choice (continuous up to the second derivative).

Returns:

  • design (ndarray, shape (npix, n_coef)) – B-spline design matrix (clamped at both boundaries, i.e. the first and last basis functions are supported exactly at the endpoints), so design @ cont_coeffs directly gives the continuum in the same (flux) units as the data.

  • knots (ndarray) – The full (boundary-clamped) knot vector used to build design, returned for reference/reuse.