From b5c453afaf3167e90349e7b63b1ee0c509684ef3 Mon Sep 17 00:00:00 2001 From: Philipenko Vladimir Date: Tue, 26 Dec 2023 10:54:54 +0300 Subject: [PATCH] Fix --- imops/interp2d.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/imops/interp2d.py b/imops/interp2d.py index a76726c0..ac079a4f 100644 --- a/imops/interp2d.py +++ b/imops/interp2d.py @@ -58,12 +58,13 @@ def __init__( if not isinstance(points, np.ndarray): raise ValueError(f'Wrong type of `points` argument, expected np.ndarray. Got {type(points)}') - - if not isinstance(self.values, np.ndarray): - raise ValueError(f'Wrong type of `values` argument, expected np.ndarray. Got {type(self.values)}') - if self.values.ndim > 1: - raise ValueError(f'Wrong shape of `values` argument, expected ndim=1. Got shape {self.values.shape}') + if values is not None: + if not isinstance(values, np.ndarray): + raise ValueError(f'Wrong type of `values` argument, expected np.ndarray. Got {type(values)}') + + if values.ndim > 1: + raise ValueError(f'Wrong shape of `values` argument, expected ndim=1. Got shape {values.shape}') super().__init__(points, num_threads, triangles) self.kdtree = KDTree(data=points, **kwargs)