-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENH(fields): return angular power spectrum by index pair (#120)
Add a function `getcl()` that takes a list of angular power spectra in GLASS order and returns the entry corresponding to a pair of indices `i` and `j`. Closes: #112 Added: Function `getcl()` to return angular power spectra by index from a list using GLASS ordering.
- Loading branch information
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
def test_getcl(): | ||
from glass.fields import getcl | ||
# make a mock Cls array with the index pairs as entries | ||
cls = [{i, j} for i in range(10) for j in range(i, -1, -1)] | ||
# make sure indices are retrieved correctly | ||
for i in range(10): | ||
for j in range(10): | ||
assert getcl(cls, i, j) == {i, j} |