bspline#

pypillometry.signal.bspline(txd, knots, spline_degree=3)[source]#

Re-implementation from https://mc-stan.org/users/documentation/case-studies/splines_in_stan.html. Similar behaviour as R’s bs() function from the splines-library.

Parameters:
  • txd (np.ndarray) – time-vector (any unit, same as knots)

  • knots (np.ndarray) – location of the knots (including the boundary knots)

  • spline_degree (int) – degree of the spline (default 3, cubic)

Returns:

B (np.ndarray) – matrix of basis functions, shape (len(txd), len(knots)+spline_degree-1)