-
Notifications
You must be signed in to change notification settings - Fork 26
/
_base.py
107 lines (83 loc) · 2.31 KB
/
_base.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
"""
The base classes and interfaces
"""
from typing import Generic, Optional, Tuple
import abc
import numpy as np
from ._types import TData, TExtrapolate, TNu, TProps, TSmooth, TSpline, TXi
class ISplinePPForm(abc.ABC, Generic[TData, TProps]):
"""The interface class for spline representation in PP-form
"""
__module__ = 'csaps'
@property
@abc.abstractmethod
def breaks(self) -> TData:
"""Returns the breaks for the spline
Returns
-------
breaks : Union[np.ndarray, ty.Tuple[np.ndarray, ...]]
Breaks data
"""
@property
@abc.abstractmethod
def coeffs(self) -> np.ndarray:
"""Returns the spline coefficients
Returns
-------
coeffs : np.ndarray
Coefficients n-d array
"""
@property
@abc.abstractmethod
def order(self) -> TProps:
"""Returns the spline order
Returns
-------
order : ty.Union[int, ty.Tuple[int, ...]]
The spline order
"""
@property
@abc.abstractmethod
def pieces(self) -> TProps:
"""Returns the spline pieces data
Returns
-------
pieces : ty.Union[int, ty.Tuple[int, ...]]
The spline pieces data
"""
@property
@abc.abstractmethod
def ndim(self) -> int:
"""Returns the spline dimension count
Returns
-------
ndim : int
The spline dimension count
"""
@property
@abc.abstractmethod
def shape(self) -> Tuple[int, ...]:
"""Returns the source data shape
Returns
-------
shape : tuple of int
The source data shape
"""
class ISmoothingSpline(abc.ABC, Generic[TSpline, TSmooth, TXi, TNu, TExtrapolate]):
"""The interface class for smooting splines
"""
__module__ = 'csaps'
@property
@abc.abstractmethod
def smooth(self) -> TSmooth:
"""Returns smoothing factor(s)
"""
@property
@abc.abstractmethod
def spline(self) -> TSpline:
"""Returns spline representation in PP-form
"""
@abc.abstractmethod
def __call__(self, xi: TXi, nu: Optional[TNu] = None, extrapolate: Optional[TExtrapolate] = None) -> np.ndarray:
"""Evaluates spline on the data sites
"""