Permalink
Browse files

changing package structure

  • Loading branch information...
dfm committed May 24, 2016
1 parent 6a0e000 commit a5b6eadf8467cc1cdb13d40955e3ede3b3cb3bd3
Showing with 69 additions and 41 deletions.
  1. BIN corner.png
  2. +36 −0 corner/__init__.py
  3. +3 −27 { → corner}/corner.py
  4. +20 −9 demo.py
  5. +10 −5 setup.py
View
BIN +527 KB (460%) corner.png
Binary file not shown.
View
@@ -0,0 +1,36 @@
# -*- coding: utf-8 -*-
__version__ = "1.0.4.dev0"
__author__ = "Dan Foreman-Mackey (foreman.mackey@gmail.com)"
__copyright__ = "Copyright 2013-2016 Daniel Foreman-Mackey and contributors"
__contributors__ = [
# Alphabetical by first name.
"Adrian Price-Whelan @adrn",
"Brendon Brewer @eggplantbren",
"Ekta Patel @ekta1224",
"Emily Rice @emilurice",
"Geoff Ryan @geoffryan",
"Guillaume @ceyzeriat",
"Gregory Ashton @ga7g08",
"Hanno Rein @hannorein",
"Kelle Cruz @kelle",
"Kyle Barbary @kbarbary",
"Marco Tazzari @mtazzari",
"Matt Pitkin @mattpitkin",
"Phil Marshall @drphilmarshall",
"Pierre Gratier @pirg",
"Stephan Hoyer @shoyer",
"Víctor Zabalza @zblz",
"Will Vousden @willvousden",
"Wolfgang Kerzendorf @wkerzendorf",
]
try:
__CORNER_SETUP__
except NameError:
__CORNER_SETUP__ = False
if not __CORNER_SETUP__:
__all__ = ["corner", "hist2d", "quantile"]
from .corner import corner, hist2d, quantile
@@ -1,32 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import print_function, absolute_import, unicode_literals
__all__ = ["corner", "hist2d"]
__version__ = "1.0.3"
__author__ = "Dan Foreman-Mackey (danfm@nyu.edu)"
__copyright__ = "Copyright 2013-2015 Daniel Foreman-Mackey"
__contributors__ = [
# Alphabetical by first name.
"Adrian Price-Whelan @adrn",
"Brendon Brewer @eggplantbren",
"Ekta Patel @ekta1224",
"Emily Rice @emilurice",
"Geoff Ryan @geoffryan",
"Guillaume @ceyzeriat",
"Gregory Ashton @ga7g08",
"Hanno Rein @hannorein",
"Kelle Cruz @kelle",
"Kyle Barbary @kbarbary",
"Marco Tazzari @mtazzari",
"Matt Pitkin @mattpitkin",
"Phil Marshall @drphilmarshall",
"Pierre Gratier @pirg",
"Stephan Hoyer @shoyer",
"Víctor Zabalza @zblz",
"Will Vousden @willvousden",
"Wolfgang Kerzendorf @wkerzendorf",
]
from __future__ import print_function, absolute_import
import logging
import numpy as np
@@ -40,6 +14,8 @@
except ImportError:
gaussian_filter = None
__all__ = ["corner", "hist2d", "quantile"]
def corner(xs, bins=20, range=None, weights=None, color="k",
smooth=None, smooth1d=None,
View
29 demo.py
@@ -1,25 +1,36 @@
#!/usr/bin/env python
import numpy as np
from matplotlib import rcParams
import corner
rcParams["font.size"] = 16
rcParams["font.family"] = "sans-serif"
rcParams["font.sans-serif"] = ["Computer Modern Sans"]
rcParams["text.usetex"] = True
rcParams["text.latex.preamble"] = r"\usepackage{cmbright}"
np.random.seed(42)
# Set up the parameters of the problem.
ndim, nsamples = 3, 50000
# Generate some fake data.
data1 = np.random.randn(ndim * 4 * nsamples / 5).reshape([4 * nsamples / 5,
ndim])
data2 = (5 * np.random.rand(ndim)[None, :]
+ np.random.randn(ndim * nsamples / 5).reshape([nsamples / 5, ndim]))
data2 = (4 * np.random.rand(ndim)[None, :] +
np.random.randn(ndim * nsamples / 5).reshape([nsamples / 5, ndim]))
data = np.vstack([data1, data2])
# Plot it.
figure = corner.corner(data, labels=[r"$x$", r"$y$", r"$\log \alpha$",
r"$\Gamma \, [\mathrm{parsec}]$"],
truths=[0.0, 0.0, 0.0],
quantiles=[0.16, 0.5, 0.84],
show_titles=True, title_kwargs={"fontsize": 12})
figure.gca().annotate("A Title", xy=(0.5, 1.0), xycoords="figure fraction",
xytext=(0, -5), textcoords="offset points",
ha="center", va="top")
figure.savefig("demo.png")
quantiles=[0.16, 0.5, 0.84],
show_titles=True, title_kwargs={"fontsize": 12})
figure.gca().annotate("a demo corner plot",
xy=(1.0, 1.0), xycoords="figure fraction",
xytext=(-20, -10), textcoords="offset points",
ha="right", va="top")
figure.savefig("demo.png", dpi=300)
View
@@ -1,6 +1,5 @@
#!/usr/bin/env python
import re
import os
import sys
from setuptools import setup
@@ -9,15 +8,21 @@
os.system("python setup.py sdist upload")
sys.exit()
# Hackishly synchronize the version.
version = re.findall(r"__version__ = \"(.*?)\"", open("corner.py").read())[0]
# Hackishly inject a constant into builtins to enable importing of the
# package before the dependencies are installed.
if sys.version_info[0] < 3:
import __builtin__ as builtins
else:
import builtins
builtins.__CORNER_SETUP__ = True
import corner # NOQA
setup(
name="corner",
version=version,
version=corner.__version__,
author="Daniel Foreman-Mackey",
author_email="danfm@nyu.edu",
author_email="foreman.mackey@gmail.com",
url="https://github.com/dfm/corner.py",
py_modules=["corner"],
description="Make some beautiful corner plots of samples.",

0 comments on commit a5b6ead

Please sign in to comment.