Commit 33710fd3 authored by Christoph Groth's avatar Christoph Groth
Browse files

Merge branch 'stable'

parents 03d7e9b5 89018d64
...@@ -3,8 +3,8 @@ Installation instructions ...@@ -3,8 +3,8 @@ Installation instructions
========================= =========================
Kwant can be installed either using prepared packages (Debian and Ubuntu Kwant can be installed either using prepared packages (Debian and Ubuntu
variants of GNU/Linux, Mac OS X, and Windows), or it can be built and installed variants of GNU/Linux, Mac OS X, and Microsoft Windows), or it can be built
from source. and installed from source.
In general, installation from packages is advisable, especially for novice In general, installation from packages is advisable, especially for novice
users. Expert users may find it helpful to build Kwant from source, as this users. Expert users may find it helpful to build Kwant from source, as this
...@@ -16,19 +16,6 @@ libraries. ...@@ -16,19 +16,6 @@ libraries.
Installing from packages Installing from packages
************************ ************************
Ubuntu (and derivatives)
========================
Execute the following commands::
sudo apt-add-repository ppa:kwant-project/ppa
sudo apt-get update
sudo apt-get install python-kwant python-kwant-doc
This should provide Kwant for all versions of Ubuntu >= 12.04. The HTML
documentation will be installed locally in the directory
``/usr/share/doc/python-kwant-doc``.
Debian (and derivatives) Debian (and derivatives)
======================== ========================
...@@ -75,30 +62,18 @@ This method should work for virtually all Debian-derived systems, even on exotic ...@@ -75,30 +62,18 @@ This method should work for virtually all Debian-derived systems, even on exotic
architectures. architectures.
Windows Ubuntu (and derivatives)
======= ========================
There are multiple distributions of scientific Python software for Windows that
provide the prerequisites for Kwant. We recommend to use the packages kindly
provided by Christoph Gohlke. To install Kwant on Windows
1. Determine whether you have a 32-bit or 64-bit Windows installation by
following these `instructions <http://support.microsoft.com/kb/827218>`_.
2. Download and install Python 2.7 for the appropriate architecture (32-bit or Execute the following commands::
64-bit) from the official `Python download site
<http://www.python.org/download/>`_.
3. Download and install ``scipy-stack``, ``tinyarray``, and ``kwant`` for Python sudo apt-add-repository ppa:kwant-project/ppa
2.7 from `Christoph Gohlke's page sudo apt-get update
<http://www.lfd.uci.edu/~gohlke/pythonlibs/>`_. Once again you should choose sudo apt-get install python-kwant python-kwant-doc
the architecture that is appropriate for your system. ("win32" means 32-bit,
"amd64" means 64-bit -- even if you have a processor from Intel.) If the
download from Gohlke's site is slow, try to download from `our mirror
<http://downloads.kwant-project.org/gohlke-mirror/>`_.
You may see a warning that says "The publisher could not be verified. Do you This should provide Kwant for all versions of Ubuntu >= 12.04. The HTML
want to run this software?". Select "Run". documentation will be installed locally in the directory
``/usr/share/doc/python-kwant-doc``.
Mac OS X Mac OS X
...@@ -239,6 +214,57 @@ Notes: ...@@ -239,6 +214,57 @@ Notes:
and continue with step 2. and continue with step 2.
Microsoft Windows
=================
There are multiple distributions of scientific Python software for Windows that
provide the prerequisites for Kwant. We recommend to use the packages kindly
provided by Christoph Gohlke. To install Kwant on Windows
1. Determine whether you have a 32-bit or 64-bit Windows installation by
following these `instructions <http://support.microsoft.com/kb/827218>`_.
2. Download and install Python 2.7 for the appropriate architecture (32-bit or
64-bit) from the official `Python download site
<http://www.python.org/download/>`_.
3. Open a command prompt, as described in "How do I get a command prompt" at
the `Microsoft Windows website <http://windows.microsoft.com/en-us/windows/command-prompt-faq>`_.
4. In the command prompt window, execute::
C:\Python27\python.exe C:\Python27\Tools\Scripts\win_add2path.py
(Instead of typing this command, you can also just copy it from here and
paste it into the command prompt window). If you did not use the default
location to install Python in step 2, then replace ``C:\Python27`` by the
actual location where Python is installed.
5. Reboot your computer.
6. Download the necessary packages (with the ending ``.whl``) for your
operating system (32 or 64 bit) and Python version (e.g. ``cp27`` for Python
2.7) from the `website of Christoph Gohlke
<http://www.lfd.uci.edu/~gohlke/pythonlibs/>`_. For Kwant, we recommend to download at least `NumPy <http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy>`__, `SciPy <http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy>`__, `Matplotlib <http://www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib>`__, `Nose <http://www.lfd.uci.edu/~gohlke/pythonlibs/#nose>`__, `Tinyarray <http://www.lfd.uci.edu/~gohlke/pythonlibs/#tinyarray>`__, and `Kwant <http://www.lfd.uci.edu/~gohlke/pythonlibs/#kwant>`__ itself.
7. Now open a command prompt with administrator rights, as described in
"How do I run a command with elevated permissions" at the
`Microsoft Windows website <http://windows.microsoft.com/en-us/windows/command-prompt-faq>`_.
In this new command prompt window, execute ::
pip install <filename>
for each of the downloaded files (replacing ``<filename>`` with it).
Now you are done, you can ``import kwant`` from within Python scripts.
(Note that many other userful scientific packages are available in Gohlke’s
repository. For example, you might want to install `IPython
<http://www.lfd.uci.edu/~gohlke/pythonlibs/#ipython>`_ and its various
dependencies so that you can use the `IPython notebook <http://ipython.org/notebook.html>`_.)
*********************************** ***********************************
Building and installing from source Building and installing from source
*********************************** ***********************************
......
...@@ -42,18 +42,30 @@ except ImportError: ...@@ -42,18 +42,30 @@ except ImportError:
"functions will work.", RuntimeWarning) "functions will work.", RuntimeWarning)
mpl_enabled = False mpl_enabled = False
if mpl_enabled and matplotlib.__version__ == "1.4.0":
warnings.warn("matplotlib 1.4.0 has a bug that makes 3D plotting unusable "
"(2D plotting is not affected). Please consider using a "
"different version of matplotlib.", RuntimeWarning)
from . import system, builder, physics from . import system, builder, physics
__all__ = ['plot', 'map', 'bands', 'sys_leads_sites', 'sys_leads_hoppings', __all__ = ['plot', 'map', 'bands', 'sys_leads_sites', 'sys_leads_hoppings',
'sys_leads_pos', 'sys_leads_hopping_pos', 'mask_interpolate'] 'sys_leads_pos', 'sys_leads_hopping_pos', 'mask_interpolate']
# TODO: Remove the following once we depend on matplotlib >= 1.4.1.
def matplotlib_chores():
global pre_1_4_matplotlib
ver = matplotlib.__version__
if ver == "1.4.0":
warnings.warn("Matplotlib 1.4.0 has a bug that makes 3D plotting "
"unusable (2D plotting is not affected). Please "
"consider using a different version of matplotlib.",
RuntimeWarning)
pre_1_4_matplotlib = [int(x) for x in ver.split('.')[:2]] < [1, 4]
if mpl_enabled:
matplotlib_chores()
# Collections that allow for symbols and linewiths to be given in data space # Collections that allow for symbols and linewiths to be given in data space
# (not for general use, only implement what's needed for plotter) # (not for general use, only implement what's needed for plotter)
def isarray(var): def isarray(var):
...@@ -97,9 +109,13 @@ if mpl_enabled: ...@@ -97,9 +109,13 @@ if mpl_enabled:
self.reflen = reflen self.reflen = reflen
self.linewidths_orig = nparray_if_array(self.get_linewidths()) self.linewidths_orig = nparray_if_array(self.get_linewidths())
self.transforms = np.array([ if pre_1_4_matplotlib:
matplotlib.transforms.Affine2D().scale(x).get_matrix() for x self.transforms = [matplotlib.transforms.Affine2D().scale(x)
in sizes]) for x in sizes]
else:
self.transforms = np.array(
[matplotlib.transforms.Affine2D().scale(x).get_matrix()
for x in sizes])
def get_transforms(self): def get_transforms(self):
return self.transforms return self.transforms
...@@ -220,8 +236,12 @@ if mpl_enabled: ...@@ -220,8 +236,12 @@ if mpl_enabled:
self.edgecolors_orig = nparray_if_array(self.get_edgecolors()) self.edgecolors_orig = nparray_if_array(self.get_edgecolors())
Affine2D = matplotlib.transforms.Affine2D Affine2D = matplotlib.transforms.Affine2D
self.orig_transforms = np.array([ if pre_1_4_matplotlib:
Affine2D().scale(x).get_matrix() for x in sizes]) self.orig_transforms = np.array(
[Affine2D().scale(x) for x in sizes], dtype='object')
else:
self.orig_transforms = np.array(
[Affine2D().scale(x).get_matrix() for x in sizes])
self.transforms = self.orig_transforms self.transforms = self.orig_transforms
def set_array(self, array): def set_array(self, array):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment