Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
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
14 changes: 8 additions & 6 deletions src/splipy/basis.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
from .utils import ensure_listlike_old

if TYPE_CHECKING:
from .typing import ArrayLike, FloatArray, Scalar
from splipy.typing import Knots

from .typing import FloatArray, Scalar

__all__ = ["BSplineBasis"]

Expand All @@ -41,7 +43,7 @@ class BSplineBasis:
def __init__(
self,
order: int = 2,
knots: ArrayLike | None = None,
knots: Knots | None = None,
periodic: int = -1,
) -> None:
"""Construct a B-Spline basis with a given order and knot vector.
Expand Down Expand Up @@ -151,15 +153,15 @@ def greville(self, index: int | None = None) -> float | FloatArray:
@overload
def evaluate(
self,
t: ArrayLike | Scalar,
t: Knots | Scalar,
d: int = 0,
from_right: bool = ...,
) -> npt.NDArray[np.double]: ...

@overload
def evaluate(
self,
t: ArrayLike | Scalar,
t: Knots | Scalar,
Copy link
Copy Markdown
Member

@VikingScientist VikingScientist Jan 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is one of the places where I object to referring to parametric evaluation points t as knots. They simply are not knots and it is more misleading to call them as such.

d: int = 0,
from_right: bool = ...,
sparse: Literal[False] = ...,
Expand All @@ -168,15 +170,15 @@ def evaluate(
@overload
def evaluate(
self,
t: ArrayLike | Scalar,
t: Knots | Scalar,
d: int = 0,
from_right: bool = ...,
sparse: Literal[True] = ...,
) -> csr_matrix[np.float64]: ...

def evaluate(
self,
t: ArrayLike | Scalar,
t: Knots | Scalar,
d: int = 0,
from_right: bool = True,
sparse: bool = False,
Expand Down
4 changes: 2 additions & 2 deletions src/splipy/curve.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from .utils import ensure_listlike, is_singleton

if TYPE_CHECKING:
from collections.abc import Sequence
from collections.abc import Callable, Sequence

from .typing import ArrayLike, Direction, FloatArray, Scalar

Expand Down Expand Up @@ -494,7 +494,7 @@ def closest_point(self, pt: ArrayLike, t0: Scalar = None) -> tuple[FloatArray, f
break
return self(t), t

def error(self, target: Curve) -> tuple[FloatArray, float]:
def error(self, target: Curve | Callable[[FloatArray], FloatArray]) -> tuple[FloatArray, float]:
"""Computes the L2 (squared and per knot span) and max error between
this curve and a target curve

Expand Down
Loading