barak.interp.fit_spline¶
- barak.interp.fit_spline(x, y, bins=4, addknots=None, estimator=<function median at 0x1830398>)[source]¶
Find a smooth function that approximates x, y.
bins is the number of bins into which the sample is split. Returns a function f(x) that approximates y from min(x) to max(x).
Parameters : addknots : sequence of float pairs
A sequence of (x,y) pairs values that the spline is forced to pass through. Default is None.
Notes
The sample is split into bins number of sub-samples with evenly spaced x values. The median x and y value within each subsample is measured, and a cubic spline is drawn through these subsample median points.
x must be sorted lowest -> highest, but need not be evenly spaced.