diff options
author | Anton Khirnov <anton@khirnov.net> | 2023-02-14 18:45:12 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2023-02-14 18:45:12 +0100 |
commit | d7cdeee1065b8063d2d69956f1067e9f136a6f6f (patch) | |
tree | 6c2fb6593dce5d843f92899f6922148615e67df3 | |
parent | ee978594015a08f955cdc11ed5a45c5897518143 (diff) |
interp: allow passing scalars to Interp2D_C
-rw-r--r-- | interp.py | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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) |