{ } Raw JSON

bundles / scipy 1.17.1 / scipy / interpolate / _fitpack_repro / add_knot

function

scipy.interpolate._fitpack_repro:add_knot

source: /scipy/interpolate/_fitpack_repro.py :74

Signature

def   add_knot ( x t k residuals )

Summary

Add a new knot.

Extended Summary

(Approximately) replicate FITPACK's logic:

  • split the x array into knot intervals, t(j+k) <= x(i) <= t(j+k+1)

  • find the interval with the maximum sum of residuals

  • insert a new knot into the middle of that interval.

NB: a new knot is in fact an x value at the middle of the interval. So the knots are a subset of `x`.

This routine is an analog of https://github.com/scipy/scipy/blob/v1.11.4/scipy/interpolate/fitpack/fpcurf.f#L190-L215 (cf _split function)

and https://github.com/scipy/scipy/blob/v1.11.4/scipy/interpolate/fitpack/fpknot.f

Aliases

  • scipy.interpolate._fitpack_repro.add_knot