Skip to content

Commit

Permalink
fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeybelkov committed Feb 1, 2024
1 parent 15dca7d commit aa0c6a9
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions imops/interp2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def __call__(self, points: np.ndarray, values: np.ndarray = None, fill_value: fl
points: np.ndarray
2-D array of data point coordinates to interpolate at
values: np.ndarray
1-D array of fp32/fp64 values to use at initial points. If passed, existing values will NOT be rewritten
1-D array of fp32/fp64 values to use at initial points
fill_value: float
value to fill past edges
Expand All @@ -90,16 +90,17 @@ def __call__(self, points: np.ndarray, values: np.ndarray = None, fill_value: fl
new_values: np.ndarray
interpolated values at given points
"""
x_values = values if values is not None else self.values
if values is None:
values = self.values

if x_values is None:
if values is None:
raise ValueError('`values` argument was never passed neither in __init__ or __call__ methods')

if not isinstance(x_values, np.ndarray):
raise TypeError(f'Wrong type of `values` argument, expected np.ndarray. Got {type(x_values)}')
if not isinstance(values, np.ndarray):
raise TypeError(f'Wrong type of `values` argument, expected np.ndarray. Got {type(values)}')

if x_values.ndim > 1:
raise ValueError(f'Wrong shape of `values` argument, expected ndim=1. Got shape {x_values.shape}')
if values.ndim > 1:
raise ValueError(f'Wrong shape of `values` argument, expected ndim=1. Got shape {values.shape}')

_, neighbors = self.kdtree.query(
points, 1, **{'workers': self.num_threads} if python_version()[:3] != '3.6' else {}
Expand All @@ -108,4 +109,4 @@ def __call__(self, points: np.ndarray, values: np.ndarray = None, fill_value: fl
if not isinstance(points, np.ndarray):
raise TypeError(f'Wrong type of `points` argument, expected np.ndarray. Got {type(points)}')

Check warning on line 110 in imops/interp2d.py

View check run for this annotation

Codecov / codecov/patch

imops/interp2d.py#L110

Added line #L110 was not covered by tests

return super().__call__(points, x_values, neighbors, fill_value)
return super().__call__(points, values, neighbors, fill_value)

0 comments on commit aa0c6a9

Please sign in to comment.