Skip to content

Commit fea71eb

Browse files
committed
Gap ratio return update for uncertainty.
1 parent e9340eb commit fea71eb

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

NEWS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
v0.2.33
2+
3+
* `mean_adjacent_gap_ratio`, return ratios matrix as well.
4+
This is to quantify uncertainty on `adjacent_gap_ratio`.
5+
16
v0.2.32
27

38
* Addition of `mean_adjacent_gap_ratio` and test.

leymosun/spectral.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,12 @@ def mean_adjacent_gap_ratio(eigenvalues):
200200
201201
"""
202202
adjacent_gap_ratios = []
203+
adjacent_gap_ratios_mean = []
203204
for eigens in eigenvalues:
204205
eigens_sorted = np.sort(eigens)
205206
spacings = np.diff(eigens_sorted)
206207
adjacent_gap_ratio = np.minimum(spacings[:-1], spacings[1:]) /(np.maximum(spacings[:-1], spacings[1:])+1e-9)
207-
adjacent_gap_ratios.append(np.mean(adjacent_gap_ratio))
208-
bar_adjacent_gap_ratio = np.mean(adjacent_gap_ratios)
209-
return bar_adjacent_gap_ratio
208+
adjacent_gap_ratios.append(adjacent_gap_ratio)
209+
adjacent_gap_ratios_mean.append(np.mean(adjacent_gap_ratio))
210+
bar_adjacent_gap_ratio = np.mean(adjacent_gap_ratios_mean)
211+
return bar_adjacent_gap_ratio, adjacent_gap_ratios

leymosun/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__="0.2.32"
1+
__version__="0.2.33"

tests/test_spectral.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,5 @@ def test_nnsd():
6464

6565
def test_mean_adjacent_gap_ratio():
6666
sim_e2 = np.array([normal(size=1000) for _ in range(10)])
67-
r = mean_adjacent_gap_ratio(sim_e2)
67+
r, _ = mean_adjacent_gap_ratio(sim_e2)
6868
assert r > 0.0

0 commit comments

Comments
 (0)