Skip to content

Commit

Permalink
Performance enhancement Variogram in _calc_groups() method (scikit-…
Browse files Browse the repository at this point in the history
…gstat mmaelicke#145)
  • Loading branch information
MartinSchobben committed Jul 6, 2023
1 parent bba2210 commit 5ee9e83
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions skgstat/Variogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -1425,7 +1425,7 @@ def lag_classes(self):
# get the groups
groups = self.lag_groups()

# yield all groups
# yield all groups
for i in range(len(self.bins)):
yield diffs[np.where(groups == i)]

Expand Down Expand Up @@ -1822,12 +1822,10 @@ def _calc_groups(self, force=False):
# get the bin edges and distances
bin_edges = self.bins
d = self.distance

# -1 is the group fir distances outside maxlag
self._groups = np.ones(len(d), dtype=int) * -1

for i, bounds in enumerate(zip([0] + list(bin_edges), bin_edges)):
self._groups[np.where((d >= bounds[0]) & (d < bounds[1]))] = i

# -1 is the group for distances outside maxlag
bins = np.digitize(d, bin_edges)
self._groups = np.where(bins == self.n_lags, -1, bins)

def clone(self):
"""Deep copy of self
Expand Down

0 comments on commit 5ee9e83

Please sign in to comment.