Skip to content

Commit 765fe60

Browse files
committed
Merge pull request #37 from phobson/clearout-seaborn-dep
Clearout seaborn dependency
2 parents f46b363 + 02f4b64 commit 765fe60

File tree

15 files changed

+32
-166
lines changed

15 files changed

+32
-166
lines changed

.travis.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ language: python
22

33
matrix:
44
include:
5-
- python: 3.3
6-
env:
7-
- COVERAGE=false
85
- python: 3.4
96
env:
107
- COVERAGE=false
@@ -27,10 +24,9 @@ install:
2724
- conda install --yes coverage docopt requests pyyaml
2825
- pip install coveralls
2926
- pip install .
30-
- cp testing/matplotlibrc .
3127

3228
script:
33-
- nosetests --with-coverage --cover-package=paramnormal --verbose
29+
- python check_paramnormal.py --with-coverage --cover-package=paramnormal --verbose
3430

3531
after_success:
3632
- if [ ${COVERAGE} = true ]; then coveralls; fi

check_paramnormal.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import matplotlib
2+
matplotlib.use('agg')
3+
4+
import nose
5+
nose.main()

conda.recipe/dev/bld.bat

Lines changed: 0 additions & 8 deletions
This file was deleted.

conda.recipe/dev/build.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

conda.recipe/dev/meta.yaml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,23 @@ package:
33
version: v0.2.dev
44

55
source:
6-
git_url: https://github.com/phobson/paramnormal.git
7-
git_tag: master
8-
# patches:
9-
# List any patch files here
10-
# - fix.patch
6+
path: ../..
117

128
build:
139
number: 1
10+
script: python setup.py install
1411

1512
requirements:
1613
build:
1714
- python
18-
- numpy
19-
- scipy
20-
- matplotlib
15+
- setuptools
2116

2217
run:
2318
- python
2419
- numpy
2520
- scipy
2621
- matplotlib
22+
- nose
2723

2824
test:
2925
imports:
@@ -34,7 +30,6 @@ test:
3430

3531
requires:
3632
- nose
37-
- seaborn
3833

3934
about:
4035
home: http://phobson.github.io/paramnormal/

conda.recipe/stable/bld.bat

Lines changed: 0 additions & 8 deletions
This file was deleted.

conda.recipe/stable/build.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

conda.recipe/stable/meta.yaml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,26 @@
11
package:
22
name: paramnormal
3-
version: v0.2.0
3+
version: 0.3.0
44

55
source:
66
git_url: https://github.com/phobson/paramnormal.git
7-
git_tag: v0.2.0
8-
# patches:
9-
# List any patch files here
10-
# - fix.patch
7+
git_tag: v0.3.0
118

129
build:
1310
number: 1
11+
script: python setup.py install
1412

1513
requirements:
1614
build:
1715
- python
18-
- numpy
19-
- scipy
20-
- matplotlib
16+
- setuptools
2117

2218
run:
2319
- python
2420
- numpy
2521
- scipy
2622
- matplotlib
23+
- nose
2724

2825
test:
2926
imports:
@@ -34,13 +31,9 @@ test:
3431

3532
requires:
3633
- nose
37-
- seaborn
3834

3935
about:
4036
home: http://phobson.github.io/paramnormal/
4137
license: BSD License
4238
summary: 'Conventionally parameterized probability distributions.'
4339

44-
# See
45-
# http://docs.continuum.io/conda/build.html for
46-
# more information about meta.yaml/configure

docs/conf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,17 @@
6767

6868
# General information about the project.
6969
project = 'paramnormal'
70-
copyright = '2015, Paul Hobson'
70+
copyright = '2015 - 2016, Paul Hobson'
7171
author = 'Paul Hobson'
7272

7373
# The version info for the project you're documenting, acts as replacement for
7474
# |version| and |release|, also used in various other places throughout the
7575
# built documents.
7676
#
7777
# The short X.Y version.
78-
version = '0.2'
78+
version = '0.3.0'
7979
# The full version, including alpha/beta/rc tags.
80-
release = '0.2'
80+
release = '0.3.0'
8181

8282
# The language for content autogenerated by Sphinx. Refer to documentation
8383
# for a list of supported languages.

paramnormal/activity.py

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
import numpy
22
from matplotlib import pyplot
3-
try:
4-
import seaborn.apionly as seaborn
5-
except ImportError: # pragma: no cover
6-
seaborn = None
73

8-
from paramnormal import dist
9-
from paramnormal import utils
4+
from . import dist
5+
from . import utils
106

117

128
def _check_distro(distro, **params):
@@ -33,10 +29,8 @@ def _check_ax(ax):
3329
if ax is None:
3430
fig, ax = pyplot.subplots()
3531
else:
36-
try:
37-
fig = ax.figure
38-
except AttributeError:
39-
raise ValueError("`ax` must be None or a matplotlib Axes.")
32+
ax = pyplot.gca()
33+
fig = ax.figure
4034

4135
return fig, ax
4236

@@ -142,8 +136,7 @@ def _plot_pdf(distro, xlimits, ax=None, xscale='linear', **line_opts):
142136

143137

144138
def plot(distro, data=None, fit_dist=True, ax=None, pad=0.1,
145-
xscale='linear', line_opts=None, distplot=False,
146-
distplot_opts=None, **guesses):
139+
xscale='linear', line_opts=None, **guesses):
147140
"""
148141
Plot the PDF of a dataset and other representations of the
149142
distribution (histogram, kernel density estimate, and rug plot).
@@ -274,11 +267,4 @@ def plot(distro, data=None, fit_dist=True, ax=None, pad=0.1,
274267
ax = _plot_pdf(distro, xlimits, ax=ax, xscale=xscale, **line_opts)
275268
ax.set_xscale(xscale)
276269

277-
distplot_opts = dict() if not distplot_opts else distplot_opts
278-
distplot_opts['kde'] = distplot_opts.pop('kde', True)
279-
if distplot and data is not None and seaborn is not None:
280-
seaborn.distplot(data, ax=ax, **distplot_opts)
281-
if distplot_opts['kde']:
282-
ax.lines[1].set_label('KDE')
283-
284270
return ax

paramnormal/tests/__init__.py

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,3 @@
1-
from warnings import simplefilter
2-
from numpy import errstate
31
from numpy.testing import Tester
42

5-
class _NoseWrapper(Tester): # pragma: no cover
6-
"""
7-
This is simply a monkey patch for numpy.testing.Tester.
8-
It allows extra_argv to be changed from its default None to ['--exe'] so
9-
that the tests can be run the same across platforms. It also takes kwargs
10-
that are passed to numpy.errstate to suppress floating point warnings.
11-
"""
12-
def test(self, label='fast', verbose=1, extra_argv=['--exe'],
13-
doctests=False, coverage=False, **kwargs):
14-
''' Run tests for module using nose
15-
%(test_header)s
16-
doctests : boolean
17-
If True, run doctests in module, default False
18-
coverage : boolean
19-
If True, report coverage of NumPy code, default False
20-
(Requires the coverage module:
21-
http://nedbatchelder.com/code/modules/coverage.html)
22-
kwargs
23-
Passed to numpy.errstate. See its documentation for details.
24-
'''
25-
26-
# cap verbosity at 3 because nose becomes *very* verbose beyond that
27-
verbose = min(verbose, 3)
28-
29-
from numpy.testing import utils
30-
utils.verbose = verbose
31-
32-
if doctests:
33-
print("Running unit tests and doctests for %s" % self.package_name)
34-
else:
35-
print("Running unit tests for %s" % self.package_name)
36-
37-
self._show_system_info()
38-
39-
# reset doctest state on every run
40-
import doctest
41-
from numpy.testing.noseclasses import NumpyTestProgram
42-
43-
doctest.master = None
44-
45-
argv, plugins = self.prepare_test_args(label, verbose, extra_argv,
46-
doctests, coverage)
47-
with errstate(**kwargs):
48-
simplefilter('ignore', category=DeprecationWarning)
49-
t = NumpyTestProgram(argv=argv, exit=False, plugins=plugins)
50-
51-
return t.result
52-
53-
test = _NoseWrapper().test
3+
test = Tester().test
Loading

paramnormal/tests/test_activity.py

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,6 @@ def test_ax(self):
7878
nt.assert_equal(ax, ax1)
7979
nt.assert_equal(fig, fig1)
8080

81-
@nt.raises(ValueError)
82-
@cleanup
83-
def test_error(self):
84-
activity._check_ax('junk')
85-
8681

8782
class Test_random(object):
8883
def test_normal(self):
@@ -139,29 +134,11 @@ def test_plot_fit():
139134
ax2.legend()
140135

141136

142-
@image_comparison(baseline_images=['test_plot_distplot'], extensions=['png'])
143-
@nptest.dec.skipif(sys.version_info.minor < 4)
144-
@seed
145-
def test_plot_distplot():
146-
# third
147-
fig3, ax3 = pyplot.subplots()
148-
data = activity.random('normal', μ=5.4, σ=2.5, shape=37)
149-
ax3 = activity.plot('normal', data=data, distplot=True, ax=ax3)
150-
ax3.legend(loc='upper left')
151-
152-
153-
@image_comparison(baseline_images=['test_plot_distplot_lognormal'], extensions=['png'])
137+
@image_comparison(baseline_images=['test_plot_xlog'], extensions=['png'])
154138
@nptest.dec.skipif(sys.version_info.minor < 4)
155139
@seed
156-
def test_distplot_lognormal():
157-
# fourth
158-
fig4, ax4 = pyplot.subplots()
159-
data = activity.random('lognormal', μ=0.75, σ=1.2, shape=125)
160-
logdata = numpy.log10(data)
161-
bins = numpy.logspace(logdata.min(), logdata.max(), num=30)
162-
distplot_opts = dict(rug=True, kde=False, norm_hist=True, bins=bins)
163-
line_opts = dict(color='firebrick', lw=3.5, label='Fit PDF')
164-
ax4 = activity.plot('lognormal', data=data, distplot=True,
165-
xscale='log', pad=0.01, ax=ax4,
166-
line_opts=line_opts,
167-
distplot_opts=distplot_opts)
140+
def test_plot_xlog():
141+
# first
142+
fig, ax1 = pyplot.subplots()
143+
loc_dist = dist.lognormal(μ=1.25, σ=0.75)
144+
ax1 = activity.plot(loc_dist, ax=ax1, xscale='log')

setup.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,21 @@
99
DESCRIPTION = "paramnormal: Conventionally parameterized probability distributions"
1010
LONG_DESCRIPTION = DESCRIPTION
1111
NAME = "paramnormal"
12-
VERSION = "v0.2.0"
12+
VERSION = "v0.3.0"
1313
AUTHOR = "Paul Hobson"
1414
AUTHOR_EMAIL = "[email protected]"
1515
URL = 'http://phobson.github.io/paramnormal/'
1616
DOWNLOAD_URL = "https://github.com/phobson/paramnormal/archive/master.zip"
1717
LICENSE = "BSD 3-clause"
1818
PACKAGES = find_packages()
19-
PLATFORMS = "Python 3.3 and later."
19+
PLATFORMS = "Python 3.4 and later."
2020
CLASSIFIERS = [
2121
'Programming Language :: Python',
2222
'Operating System :: OS Independent',
2323
'License :: OSI Approved :: BSD License',
2424
'Development Status :: 5 - Production/Stable',
2525
'Intended Audience :: Science/Research',
2626
'Topic :: Scientific/Engineering :: Mathematics',
27-
'Programming Language :: Python :: 3.3',
2827
'Programming Language :: Python :: 3.4',
2928
'Programming Language :: Python :: 3.5',
3029
]

testing/matplotlibrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)