Liking cljdoc? Tell your friends :D
Clojure only.

fastmath.interpolation.akima

Akima and modified Akima (makima) piecewise cubic interpolation of one dimensional data.

Akima and modified Akima (makima) piecewise cubic interpolation of one dimensional data.
raw docstring

akimaclj

(akima xs ys)
(akima xs ys {:keys [method]})

Creates a one dimensional Akima (or modified Akima) piecewise cubic interpolator.

The interpolant is a cubic Hermite spline. The slope at every node is a weighted average of the two neighbouring secant slopes, where the weights are the absolute differences of the more distant secant slopes. This makes the curve local and much less prone to overshoot and wiggles than the natural cubic spline, but it is only C1 continuous. The slopes at the ends are computed from two additional secant slopes obtained by linear extrapolation of the nearest ones, so the end intervals are treated the same way as the interior ones. The result equals scipy.interpolate.Akima1DInterpolator.

Parameters:

  • xs (sequence of numbers): nodes, finite and strictly increasing, at least 5 points
  • ys (sequence of numbers): values at the nodes, the same count as xs; NaN and infinite values are allowed and make the curve NaN only near them (up to three intervals on both sides), the rest of the curve is unaffected
  • opts (map, optional):
    • :method (keyword, default: :akima): :akima for the original weights or :makima for the modified Akima algorithm, in which each weight additionally contains half of the absolute sum of the two secant slopes. :makima has no jump of the slope when the weights nearly vanish and gives smaller overshoot near plateaus. It equals Akima1DInterpolator(method='makima'). nil means the default.

Returns a function f of one argument x returning the interpolated double value. The curve passes through all nodes. Outside of the domain the first or the last cubic polynomial is continued (extrapolation like scipy), NaN input gives NaN. When the weights of a node vanish (for example four equal consecutive slopes) the slope is the mean of the two surrounding more distant secant slopes. Data lying exactly on a line is reproduced exactly.

Throws ex-info (with :type :invalid-input, :method :akima and a :property) when the lengths differ (:length-mismatch), there are fewer than 5 points (:too-few-points), xs contains a non-finite value (:not-finite), xs is not strictly increasing (:not-increasing) or :method is unknown (:unknown-method).

See also [[cubic]], [[monotone]], [[linear]], [[interpolation]].

Creates a one dimensional Akima (or modified Akima) piecewise cubic interpolator.

The interpolant is a cubic Hermite spline. The slope at every node is a weighted average of the two neighbouring secant slopes, where the weights are the absolute differences of the more distant secant slopes. This makes the curve local and much less prone to overshoot and wiggles than the natural cubic spline, but it is only C1 continuous. The slopes at the ends are computed from two additional secant slopes obtained by linear extrapolation of the nearest ones, so the end intervals are treated the same way as the interior ones. The result equals `scipy.interpolate.Akima1DInterpolator`.

Parameters:

- `xs` (sequence of numbers): nodes, finite and strictly increasing, at least 5 points
- `ys` (sequence of numbers): values at the nodes, the same count as `xs`; `NaN` and infinite values are allowed and make the curve `NaN` only near them (up to three intervals on both sides), the rest of the curve is unaffected
- `opts` (map, optional):
    - `:method` (keyword, default: `:akima`): `:akima` for the original weights or `:makima` for the modified Akima algorithm, in which each weight additionally contains half of the absolute sum of the two secant slopes. `:makima` has no jump of the slope when the weights nearly vanish and gives smaller overshoot near plateaus. It equals `Akima1DInterpolator(method='makima')`. `nil` means the default.

Returns a function `f` of one argument `x` returning the interpolated `double` value. The curve passes through all nodes. Outside of the domain the first or the last cubic polynomial is continued (extrapolation like scipy), `NaN` input gives `NaN`. When the weights of a node vanish (for example four equal consecutive slopes) the slope is the mean of the two surrounding more distant secant slopes. Data lying exactly on a line is reproduced exactly.

Throws `ex-info` (with `:type` `:invalid-input`, `:method` `:akima` and a `:property`) when the lengths differ (`:length-mismatch`), there are fewer than 5 points (`:too-few-points`), `xs` contains a non-finite value (`:not-finite`), `xs` is not strictly increasing (`:not-increasing`) or `:method` is unknown (`:unknown-method`).

See also [[cubic]], [[monotone]], [[linear]], [[interpolation]].
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close