Skip to content

Commit

Permalink
Merge pull request #188 from HULO-ai/bug/passing_kwargs_to_distance_f…
Browse files Browse the repository at this point in the history
…unction

possiblility to pass kwargs to distance function
  • Loading branch information
mmaelicke authored Aug 23, 2024
2 parents 6458989 + bb63f88 commit d2aa7f5
Show file tree
Hide file tree
Showing 3 changed files with 161 additions and 118 deletions.
10 changes: 7 additions & 3 deletions skgstat/Kriging.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,12 @@ def __init__(
self.range = variogram['effective_range']
self.nugget = variogram['nugget']
self.sill = variogram['sill']
self.dist_metric = variogram["dist_func"]

if isinstance(coordinates, MetricSpace):
self.dist_metric = coordinates.dist_metric
self.dist_metric_kwargs = coordinates.dist_metric_kwargs
else:
self.dist_metric = variogram["dist_func"]
self.dist_metric_kwargs = {}
# coordinates and semivariance function
if not isinstance(coordinates, MetricSpace):
coordinates, values = self._remove_duplicated_coordinates(coordinates, values)
Expand Down Expand Up @@ -163,7 +167,7 @@ def __init__(
self.perf_solv = list()

def dist(self, x):
return Variogram.wrapped_distance_function(self.dist_metric, x)
return Variogram.wrapped_distance_function(self.dist_metric, x, **self.dist_metric_kwargs)

@classmethod
def _remove_duplicated_coordinates(cls, coords, values):
Expand Down
Loading

0 comments on commit d2aa7f5

Please sign in to comment.