diff --git a/skgstat/Variogram.py b/skgstat/Variogram.py index 1858c70..b530ed4 100644 --- a/skgstat/Variogram.py +++ b/skgstat/Variogram.py @@ -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)] @@ -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