Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ matrix:
- ARGS="--mpl --verbose --pep8"

before_install:

# Here we just install Miniconda, which you shouldn't have to change.

- wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh
- chmod +x miniconda.sh
- ./miniconda.sh -b -p $HOME/miniconda
Expand All @@ -35,10 +32,6 @@ before_install:
- conda install --yes nomkl

install:

# We just set up a conda environment with the right Python version. This
# should not need changing.

- conda create --yes -n test python=$TRAVIS_PYTHON_VERSION numpy matplotlib docopt requests pyyaml
- source activate test
- conda install --yes --channel=conda-forge pytest-mpl pytest-cov pytest-pep8 ${EXTRATESTERS}
Expand Down
4 changes: 2 additions & 2 deletions conda.recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package:
name: mpl-probscale
version: 0.2.2dev
version: 0.2.3

source:
path: ../

build:
script: python setup.py install
number: 1
number: 0

requirements:
build:
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@
# built documents.
#
# The short X.Y version.
version = '0.2.2'
version = '0.2.3'
# The full version, including alpha/beta/rc tags.
release = '0.2.2'
release = '0.2.3'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
5 changes: 0 additions & 5 deletions docs/tutorial/Makefile

This file was deleted.

12 changes: 6 additions & 6 deletions docs/tutorial/closer_look_at_plot_pos.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
"Additionally, we'll compute the plotting positions two different but commone ways for each plot.\n",
"\n",
"First, in blue circles, we'll show the data with Weibull (α=0, β=0) plotting positions.\n",
"Weibull plotting positions are commonly use in my field, water resources engineering.\n",
"Weibull plotting positions are commonly use in fields such as hydrology and water resources engineering.\n",
"\n",
"In green squares, we'll use Cunnane (α=0.4, β=0.4) plotting positions.\n",
"Cunnane plotting positions are good for normally distributed data and are the default values."
Expand All @@ -154,8 +154,8 @@
},
"outputs": [],
"source": [
"w_opts = {'label': 'Weibull (α=0, β=0)', 'marker': 'o', 'markeredgecolor': 'b'}\n",
"c_opts = {'label': 'Cunnane (α=0.4, β=0.4)', 'marker': 's', 'markeredgecolor': 'g'}\n",
"w_opts = {'label': 'Weibull (a=0, b=0)', 'marker': 'o', 'markeredgecolor': 'b'}\n",
"c_opts = {'label': 'Cunnane (a=0.4, b=0.4)', 'marker': 's', 'markeredgecolor': 'g'}\n",
"\n",
"common_opts = {\n",
" 'markerfacecolor': 'none',\n",
Expand Down Expand Up @@ -198,7 +198,7 @@
},
"outputs": [],
"source": [
"h_opts = {'label': 'Hazen (α=0.5, β=0.5)', 'marker': '^', 'markeredgecolor': 'r'}\n",
"h_opts = {'label': 'Hazen (a=0.5, b=0.5)', 'marker': '^', 'markeredgecolor': 'r'}\n",
"fig, (ax1, ax2) = pyplot.subplots(figsize=(10, 8), ncols=2, sharex=True, sharey=False)\n",
"\n",
"for dist, ax in zip([None, weibull], [ax1, ax2]):\n",
Expand Down Expand Up @@ -280,9 +280,9 @@
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Python [default]",
"display_name": "probscale",
"language": "python",
"name": "python3"
"name": "probscale"
},
"language_info": {
"codemirror_mode": {
Expand Down
8 changes: 4 additions & 4 deletions docs/tutorial/closer_look_at_viz.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"\n",
"## Overview\n",
"\n",
"The `probscale.probplot` function lets you do a couple of things. They are:\n",
"The `probscale.probplot` function let's you do a couple of things. They are:\n",
"\n",
" 1. Creating percentile, quantile, or probability plots.\n",
" 1. Placing your probability scale either axis.\n",
Expand Down Expand Up @@ -200,7 +200,7 @@
" scatter_kws=dict(marker='.', linestyle='none', label='Bill Amount'))\n",
"\n",
"fig = probscale.probplot(tips['total_bill'], ax=ax2, plottype='qq', probax='y',\n",
" datascale='log', problabel='Normal Quantiles',datalabel='Total Bill (USD)',\n",
" datascale='log', problabel='Normal Quantiles', datalabel='Total Bill (USD)',\n",
" scatter_kws=dict(marker='.', linestyle='none', label='Bill Amount'))\n",
"ax.legend(loc='upper left')\n",
"fig.tight_layout()\n",
Expand Down Expand Up @@ -708,9 +708,9 @@
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Python [default]",
"display_name": "probscale",
"language": "python",
"name": "python3"
"name": "probscale"
},
"language_info": {
"codemirror_mode": {
Expand Down
8 changes: 4 additions & 4 deletions docs/tutorial/getting_started.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,11 @@
"\n",
"beta1 = stats.beta(a=3, b=2)\n",
"ax2.set_xscale('prob', dist=beta1)\n",
"ax2.set_xlabel('Beta probability scale (α=3, β=2)')\n",
"ax2.set_xlabel('Beta probability scale (a=3, b=2)')\n",
"\n",
"beta2 = stats.beta(a=2, b=7)\n",
"ax3.set_xscale('prob', dist=beta2)\n",
"ax3.set_xlabel('Beta probability scale (α=2, β=7)')\n",
"ax3.set_xlabel('Beta probability scale (a=2, b=7)')\n",
"\n",
"ax4.set_xticks(ax1.get_xticks()[12:-12])\n",
"ax4.set_xlabel('Linear scale (for reference)')\n",
Expand Down Expand Up @@ -379,9 +379,9 @@
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Python [default]",
"display_name": "probscale",
"language": "python",
"name": "python3"
"name": "probscale"
},
"language_info": {
"codemirror_mode": {
Expand Down
62 changes: 62 additions & 0 deletions docs/tutorial/make.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import os
import glob

import nbformat
from nbconvert import RSTExporter, preprocessors


def cache(nbfile):
basename, _ = os.path.splitext(nbfile)
bakfile = basename + '.bak'
with open(nbfile, 'r') as nb, open(bakfile, 'w') as bak:
bak.write(nb.read())
return bakfile


def process(nbfile, processor):
meta = {'metadata': {'path': '.'}}
with open(nbfile, 'r') as nbf:
nbook = nbformat.read(nbf, as_version=4)

runner = processor(timeout=600, kernel_name='probscale')
runner.preprocess(nbook, meta)

with open(nbfile, 'w') as nbf:
nbformat.write(nbook, nbf)


def convert(nbfile):
basename, _ = os.path.splitext(nbfile)
img_folder = basename + '_files'
os.makedirs(img_folder, exist_ok=True)
print("\tconverting " + nbfile)

with open(nbfile, 'r') as nb:
nbdata = nbformat.reads(nb.read(), as_version=4)

rst = RSTExporter()
body_raw, images = rst.from_notebook_node(nbdata)
body_final = body_raw.replace('.. image:: ', '.. image:: {}/'.format(img_folder))

with open(basename + '.rst', 'w') as rst_out:
rst_out.write(body_final)

for img_name, img_data in images['outputs'].items():
img_path = os.path.join(img_folder, img_name)
with open(img_path, 'wb') as img:
print('\twriting ' + img_path)
img.write(img_data)


if __name__ == '__main__':
for nbfile in glob.glob('*.ipynb'):
bak = cache(nbfile)
success = False
try:
process(nbfile, preprocessors.ExecutePreprocessor)
convert(nbfile)
success = True
finally:
process(nbfile, preprocessors.ClearOutputPreprocessor)
if success:
os.remove(bak)
27 changes: 0 additions & 27 deletions docs/tutorial/tools/nb_to_doc.py

This file was deleted.

31 changes: 0 additions & 31 deletions docs/tutorial/tools/nbstripout

This file was deleted.

24 changes: 14 additions & 10 deletions probscale/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ def axes_object(ax):

def axis_name(axis, axname):
"""
Checks that an axis name is either 'x' or 'y'. Raises an error on
an invalid value. Returns the lower cased verion of valid values.
Checks that an axis name is in ``{'x', 'y'}``. Raises an error on
an invalid value. Returns the lower case verion of valid values.

"""

valid_args = ['x', 'y']
Expand All @@ -37,9 +38,10 @@ def axis_name(axis, axname):

def fit_argument(arg, argname):
"""
Checks that an axis options is either 'x', y', 'both', or None.
Checks that an axis options is in ``{'x', y', 'both', None}``.
Raises an error on an invalid value. Returns the lower case verion
of valid values.

"""

valid_args = ['x', 'y', 'both', None]
Expand All @@ -55,12 +57,14 @@ def fit_argument(arg, argname):
def axis_type(axtype):
"""
Checks that a valid axis type is requested.
pp - percentile axis
qq - quantile axis
prob - probability axis

- *pp* - percentile axis
- *qq* - quantile axis
- *prob* - probability axis

Raises an error on an invalid value. Returns the lower case verion
of valid values.

"""

if axtype.lower() not in ['pp', 'qq', 'prob']:
Expand All @@ -71,21 +75,21 @@ def axis_type(axtype):
def axis_label(label):
"""
Replaces None with an empty string for axis labels.

"""

if label is None:
return ''
else:
return label
return '' if label is None else label


def other_options(options):
"""
Replaces None with an empty dict for plotting options.

"""

return dict() if options is None else options.copy()


def estimator(value):
if value.lower() in ['res', 'resid', 'resids', 'residual', 'residuals']:
msg = 'Bootstrapping the residuals is not ready yet'
Expand Down
Loading