-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added option to test poisson data with samples * addressing codestyle * addressing codestyle and fixing wrong path when in tox * addressing wrong path in tox * added test data for test cash lkl * polished test datapath acquisition * skipping unnecessary functions to cover in gaussian * skipped unnecessary functions in cosmpopower for coverage * added simple tes for binner in utils * cosmetics in test_utils * added test for binner in utils * Updated utils test and added utils documentation * documentation updated * cosmetics * cosmetics * cosmetics * codestyle compliant * tody up utils doc --------- Co-authored-by: Martina Gerbino <[email protected]> Co-authored-by: Ian Harrison <[email protected]>
- Loading branch information
1 parent
d6b2512
commit 5950d32
Showing
11 changed files
with
174 additions
and
27 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,7 @@ | ||
Utils | ||
================== | ||
|
||
.. automodule:: soliket.utils | ||
:members: | ||
:show-inheritance: | ||
:private-members: |
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
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,20 @@ | ||
0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 | ||
1.000000000000000000e+00 1.000000000000000000e+00 1.000000000000000000e+00 | ||
2.000000000000000000e+00 2.000000000000000000e+00 2.000000000000000000e+00 | ||
3.000000000000000000e+00 3.000000000000000000e+00 3.000000000000000000e+00 | ||
4.000000000000000000e+00 4.000000000000000000e+00 4.000000000000000000e+00 | ||
5.000000000000000000e+00 5.000000000000000000e+00 5.000000000000000000e+00 | ||
6.000000000000000000e+00 6.000000000000000000e+00 6.000000000000000000e+00 | ||
7.000000000000000000e+00 7.000000000000000000e+00 7.000000000000000000e+00 | ||
8.000000000000000000e+00 8.000000000000000000e+00 8.000000000000000000e+00 | ||
9.000000000000000000e+00 9.000000000000000000e+00 9.000000000000000000e+00 | ||
1.000000000000000000e+01 1.000000000000000000e+01 1.000000000000000000e+01 | ||
1.100000000000000000e+01 1.100000000000000000e+01 1.100000000000000000e+01 | ||
1.200000000000000000e+01 1.200000000000000000e+01 1.200000000000000000e+01 | ||
1.300000000000000000e+01 1.300000000000000000e+01 1.300000000000000000e+01 | ||
1.400000000000000000e+01 1.400000000000000000e+01 1.400000000000000000e+01 | ||
1.500000000000000000e+01 1.500000000000000000e+01 1.500000000000000000e+01 | ||
1.600000000000000000e+01 1.600000000000000000e+01 1.600000000000000000e+01 | ||
1.700000000000000000e+01 1.700000000000000000e+01 1.700000000000000000e+01 | ||
1.800000000000000000e+01 1.800000000000000000e+01 1.800000000000000000e+01 | ||
1.900000000000000000e+01 1.900000000000000000e+01 1.900000000000000000e+01 |
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
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,36 @@ | ||
import numpy as np | ||
|
||
from soliket.utils import binner | ||
|
||
|
||
def naive_binner(bmin, bmax, x, tobin): | ||
|
||
binned = list() | ||
bcent = list() | ||
# All but the last bins are open to the right | ||
for bm, bmx in zip(bmin[:-1], bmax[:-1]): | ||
bcent.append(0.5 * (bmx + bm)) | ||
binned.append(np.mean(tobin[np.where((x >= bm) & (x < bmx))[0]])) | ||
# The last bin is closed to the right | ||
bcent.append(0.5 * (bmax[-1] + bmin[-1])) | ||
binned.append(np.mean(tobin[np.where((x >= bmin[-1]) & (x <= bmax[-1]))[0]])) | ||
|
||
return (np.array(bcent), np.array(binned)) | ||
|
||
|
||
def test_binning(): | ||
|
||
#bmin = np.arange(10, step=3) | ||
#bmax = np.array([2, 5, 8, 12]) | ||
binedge = np.arange(13, step=3) | ||
bmin = binedge[:-1] | ||
bmax = binedge[1:] | ||
ell = np.arange(13) | ||
cell = np.arange(13) | ||
|
||
centers_test, values_test = naive_binner(bmin, bmax, ell, cell) | ||
|
||
bincent, binval = binner(ell, cell, binedge) | ||
|
||
assert np.allclose(bincent, centers_test) | ||
assert np.allclose(binval, values_test) |
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