Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance enhancement Variogram in _calc_groups() method (scikit-gstat #145) #148

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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