-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #152 from kyleabeauchamp/cleaner
Switched to int64, moved logsumexp to utils.
- Loading branch information
Showing
7 changed files
with
121 additions
and
113 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
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,32 @@ | ||
import numpy as np | ||
import pymbar | ||
from pymbar.utils_for_testing import eq | ||
import scipy.misc | ||
from nose import SkipTest | ||
|
||
def test_logsumexp(): | ||
a = np.random.normal(size=(200, 500, 5)) | ||
|
||
for axis in range(a.ndim): | ||
ans_ne = pymbar.utils.logsumexp(a, axis=axis) | ||
ans_no_ne = pymbar.utils.logsumexp(a, axis=axis, use_numexpr=False) | ||
ans_scipy = scipy.misc.logsumexp(a, axis=axis) | ||
eq(ans_ne, ans_no_ne) | ||
eq(ans_ne, ans_scipy) | ||
|
||
def test_logsumexp_b(): | ||
a = np.random.normal(size=(200, 500, 5)) | ||
b = np.random.normal(size=(200, 500, 5)) ** 2. | ||
|
||
for axis in range(a.ndim): | ||
ans_ne = pymbar.utils.logsumexp(a, b=b, axis=axis) | ||
ans_no_ne = pymbar.utils.logsumexp(a, b=b, axis=axis, use_numexpr=False) | ||
ans_scipy = scipy.misc.logsumexp(a, b=b, axis=axis) | ||
eq(ans_ne, ans_no_ne) | ||
eq(ans_ne, ans_scipy) | ||
|
||
def test_logsum(): | ||
u = np.random.normal(size=(200)) | ||
y1 = pymbar.utils.logsumexp(u) | ||
y2 = pymbar.utils._logsum(u) | ||
eq(y1, y2, decimal=12) |
Oops, something went wrong.