Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
horta committed Aug 14, 2018
2 parents 0afeaf7 + ba05edc commit bdad57a
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 34 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.pytest_cache/
.mypy_cache/

# Byte-compiled / optimized / DLL files
Expand Down
6 changes: 0 additions & 6 deletions .pytest_cache/v/cache/nodeids

This file was deleted.

3 changes: 0 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
numpy>=1.14.5
optimix>=1.2.23
pytest-runner>=4.2
pytest>=3.6.2
scipy>=1.1.0
setuptools>=39.2.0
sphinx_rtd_theme>=0.4.0
sphinx>=1.7.5
toolz>=0.9.0
4 changes: 2 additions & 2 deletions scipy_sugar/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from __future__ import absolute_import as _
from __future__ import absolute_import

from . import stats
from ._testit import test

__version__ = "1.0.7"
__version__ = "1.0.8"

__all__ = ["__version__", "test", "stats"]
8 changes: 4 additions & 4 deletions scipy_sugar/_testit.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ def test(verbose=True):
Exit code: ``0`` for success.
"""

args = ['--doctest-modules', '-x']
args = ["--doctest-modules", "--doctest-plus"]
if not verbose:
args += ['--quiet']
args += ["--quiet"]

args += ['--pyargs', __name__.split('.')[0]]
args += ["--pyargs", __name__.split(".")[0]]

return __import__('pytest').main(args)
return __import__("pytest").main(args)
2 changes: 1 addition & 1 deletion scipy_sugar/stats/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

from ._normalize import quantile_gaussianize

__all__ = ['quantile_gaussianize']
__all__ = ["quantile_gaussianize"]
2 changes: 1 addition & 1 deletion scipy_sugar/stats/_normalize.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import absolute_import, division

from numpy import asarray, empty_like, isfinite
from scipy.stats import norm, rankdata


def quantile_gaussianize(x):
Expand All @@ -21,6 +20,7 @@ def quantile_gaussianize(x):
>>> print(quantile_gaussianize([-1, 0, 2]))
[-0.67448975 0. 0.67448975]
"""
from scipy.stats import norm, rankdata

x = asarray(x, float).copy()
ok = isfinite(x)
Expand Down
31 changes: 20 additions & 11 deletions scipy_sugar/stats/test/test_normalize.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@
import scipy
from numpy.testing import assert_allclose


def test_quantile_gaussianize():
from scipy_sugar.stats import quantile_gaussianize

x = [
1.76405235, 0.40015721, 0.97873798, 2.2408932, 1.86755799, -0.97727788,
0.95008842, -0.15135721, -0.10321885, 0.4105985
1.76405235,
0.40015721,
0.97873798,
2.2408932,
1.86755799,
-0.97727788,
0.95008842,
-0.15135721,
-0.10321885,
0.4105985,
]

y = [
0.6045853465832371, -0.3487556955170447, 0.3487556955170447,
1.335177736118937, 0.9084578685373851, -1.3351777361189363,
0.1141852943214284, -0.9084578685373853, -0.6045853465832371,
-0.1141852943214282
0.6045853465832371,
-0.3487556955170447,
0.3487556955170447,
1.335177736118937,
0.9084578685373851,
-1.3351777361189363,
0.1141852943214284,
-0.9084578685373853,
-0.6045853465832371,
-0.1141852943214282,
]

assert_allclose(quantile_gaussianize(x), y)
Expand All @@ -34,7 +47,3 @@ def test_quantile_gaussianize_empty():
x = []
y = []
assert_allclose(quantile_gaussianize(x), y)


if __name__ == '__main__':
__import__('pytest').main([__file__, '-s'])
15 changes: 11 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,29 @@ packages = find:
setup_requires =
pytest-runner>=4.2
install_requires =
numpy>=1.14.5
numpy>=1.14.3
optimix>=1.2.23
pytest>=3.6.2
scipy>=1.1.0
toolz>=0.9.0
pytest-doctestplus>=0.1.3
scipy>=1.0.1


[aliases]
test = pytest

[tool:pytest]
addopts =
-x
--doctest-modules
--doctest-plus
--doctest-glob='*.rst'
--ignore="setup.py"
--ignore="doc/conf.py"
doctest_plus = enabled
norecursedirs = .eggs .git *.egg-info build .ropeproject
pep8ignore = E402 E501

[flake8]
ignore = E501 E741 E203

[doc8]
max-line-length = 88
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from setuptools import setup

if __name__ == '__main__':
if __name__ == "__main__":
setup()
2 changes: 1 addition & 1 deletion version.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def get():
if len(pkgnames) == 0:
return "unknown"
pkgname = pkgnames[0]
content = open(join(pkgname, '__init__.py')).read()
content = open(join(pkgname, "__init__.py")).read()
c = re.compile(r"__version__ *= *('[^']+'|\"[^\"]+\")")
m = c.search(content)
if m is None:
Expand Down

0 comments on commit bdad57a

Please sign in to comment.