Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hpval #4

Merged
merged 3 commits into from
Jan 24, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update docstring for hval as well
  • Loading branch information
zmoon committed Jan 23, 2024
commit 75d75746c09b0f5efd2edd855630ac46ce810852
41 changes: 23 additions & 18 deletions pytspack/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,29 @@


def hval(xp, x, y, yp, sigma):
"""Function which evaluates a Hermite interpolatory ten-
sion spline at a specified point.
"""Function which evaluates a
Hermite interpolatory tension spline (H)
at points `xp`.

Parameters
----------
xp : numpy array or list
xp is the values which hval interpolate to.
x : numpy array or list
x is the original values of the array.
y : numpy array or list
y is the predicted value of the array.
xp : array_like
New X points, at which H is to be evaluated.
x : array_like
Original X points (abscissae). Must be strictly increasing.
y : array_like
Data values at the original X points.
yp : array_like
First derivatives at original X points. HP(X(I)) = YP(I),
where HP is the derivative of H.
sigma : array
Description of parameter `sigma`.
Tension factors, for each interval in the original X points
(as such, length N - 1).

Returns
-------
yp : numpy array
Predicted y values at xp

list of float
H values (estimates of Y(X) at new X points `xp`).
"""
xp = array(xp)
x = array(x)
Expand All @@ -55,27 +59,28 @@ def hval(xp, x, y, yp, sigma):


def hpval(xp, x, y, yp, sigma):
"""Function which evaluates the first derivative of a Hermite
interpolatory tension spline ("HP") at points `xp`.
"""Function which evaluates the first derivative of a
Hermite interpolatory tension spline (HP)
at points `xp`.

Parameters
----------
xp : array_like
New X points at which HP is to be evaluated.
New X points, at which HP is to be evaluated.
x : array_like
Original X points (abscissae).
Original X points (abscissae). Must be strictly increasing.
y : array_like
Data values at the original X points.
yp : array_like
First derivatives of Y at original X points. HP(X(I)) = YP(I).
First derivatives at original X points. HP(X(I)) = YP(I).
sigma : array_like
Tension factors, for each interval in the original X points
(as such, length N - 1).

Returns
-------
list of float
HP values.
HP values (estimates of dY/dX at new X points `xp`).
"""
xp = array(xp)
x = array(x)
Expand Down