From d7cdeee1065b8063d2d69956f1067e9f136a6f6f Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 14 Feb 2023 18:45:12 +0100 Subject: interp: allow passing scalars to Interp2D_C --- interp.py | 9 +++++++++ 1 file changed, 9 insertions(+) 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) -- cgit v1.2.3