summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2023-02-14 18:45:12 +0100
committerAnton Khirnov <anton@khirnov.net>2023-02-14 18:45:12 +0100
commitd7cdeee1065b8063d2d69956f1067e9f136a6f6f (patch)
tree6c2fb6593dce5d843f92899f6922148615e67df3
parentee978594015a08f955cdc11ed5a45c5897518143 (diff)
interp: allow passing scalars to Interp2D_C
-rw-r--r--interp.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/interp.py b/interp.py
index 9e4049e..c567758 100644
--- a/interp.py
+++ b/interp.py
@@ -101,6 +101,15 @@ class Interp2D_C:
self._ret_c = ctypes.cast(np.ctypeslib.as_ctypes(self._ret), _doubleptr)
def interp(self, x, y):
+ try:
+ x.shape[0]
+ except (AttributeError, IndexError):
+ x = np.array([x])
+ try:
+ y.shape[0]
+ except (AttributeError, IndexError):
+ y = np.array([y])
+
if x.shape != self._x.shape:
self._setup_arrays(x.shape)