Skip to content

Commit

Permalink
Merge branch 'main' into more-diagnostics-Fraters2021
Browse files Browse the repository at this point in the history
  • Loading branch information
Patol75 authored Feb 29, 2024
2 parents 61de0a3 + 590ac52 commit cd1907c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/pydrex/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ def resample_orientations(orientations, fractions, n_samples=None, seed=None):
# Cumulative volume fractions.
frac_ascending = frac[sort_ascending]
cumfrac = frac_ascending.cumsum()
# Force cumfrac[-1] to be equal to sum(frac_ascending) i.e. 1.
cumfrac[-1] = 1.0
# Number of new samples with volume less than each cumulative fraction.
count_less = np.searchsorted(cumfrac, rng.random(n_samples))
out_orientations[i, ...] = orient[sort_ascending][count_less]
Expand Down

0 comments on commit cd1907c

Please sign in to comment.