From ee1038d2266920ef8ed6ca29fda5344fdac011e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93scar=20N=C3=A1jera?= Date: Tue, 15 Mar 2016 00:32:03 +0100 Subject: [PATCH 1/2] Quantum mechanics example that fail unicode --- examples/plot_quantum.py | 52 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 examples/plot_quantum.py diff --git a/examples/plot_quantum.py b/examples/plot_quantum.py new file mode 100644 index 000000000..0b4609be5 --- /dev/null +++ b/examples/plot_quantum.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +r""" +====================== +Some Quantum Mechanics +====================== + +We start with a two spin system :math:`\uparrow` and :math:`\downarrow` + +""" +# Author: Óscar Nájera + +from __future__ import division, absolute_import, print_function + + +def hamiltonian(M, mu): + r"""Generate a single orbital isolated atom Hamiltonian in particle-hole + symmetry. Include chemical potential for grand Canonical calculations + + .. math:: + \mathcal{H} - \mu N = M(n_\uparrow - n_\downarrow) + - \mu(n_\uparrow + n_\downarrow) + """ + pass + +############################################################################### +# Double occupation +# ----------------- +# +# To find out the double occupation one uses the relation +# (Works in Sphinx-Gallery) + +import matplotlib.pylab as plt +import numpy as np +x = np.linspace(0, 1, 20) +plt.plot(x, (1 - x**2) / 4) +plt.ylabel('$\\langle n_\\uparrow n_\\downarrow \\rangle$') +plt.show() + +############################################################################### +# +# .. math:: \langle n_\uparrow n_\downarrow \rangle = \frac{2\langle V \rangle}{U}+\frac{1}{4} + +print('pass') + +############################################################################### +# (Does not work in Sphinx-Gallery) +# --------------------------------- + +plt.plot(x, (1 - x) / 4) +plt.ylabel(r'$\langle n_\uparrow n_\downarrow \rangle$') +plt.xlabel('U') +plt.show() From c3ab4a8a4c55895b47943b0c57a1b24c388d1399 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93scar=20N=C3=A1jera?= Date: Tue, 15 Mar 2016 00:48:00 +0100 Subject: [PATCH 2/2] Pyface pip update to pass travis Mayavi build The conda virtualenv for Mayavi forces a version of pyface that clashes with sphinx. The manual update of pyface within conda is no longer enough to update to a new version that does not clash with sphinx. Thus the update is forced through pip. Mayavi is an experimentally supported use case of Sphinx-Gallery --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 59ca464fe..943cfde58 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,7 +39,7 @@ install: if [ "$PYTHON_VERSION" == "2.7" ]; then conda install --yes --quiet mayavi; conda upgrade --yes --all; - conda upgrade --yes pyface; + pip install --upgrade pyface; fi; fi; - pip install -r requirements.txt