Commit ca63f1d8 by Joseph Weston

### add matplotlib boilerplate to start of all tutorials

```Currently we just set the default figure size. Matplotlib is
annoying when it comes to setting these default parameters, and we
have to ensure that we set any 'rcParams' in a separate Jupyter cell
and *after* we import pyplot.```
parent 9eb71bb3
 ... ... @@ -52,6 +52,9 @@ a quantum anomalous spin Hall phase: import kwant import kwant.continuum .. jupyter-execute:: ../../tutorial/boilerplate.py :hide-code: .. jupyter-execute:: def make_model(a): ... ...
 import matplotlib import matplotlib.pyplot from IPython.display import set_matplotlib_formats matplotlib.rcParams['figure.figsize'] = matplotlib.pyplot.figaspect(1) * 2 set_matplotlib_formats('svg')
 ... ... @@ -42,6 +42,9 @@ continuum models and for discretizing them into tight-binding models. import kwant .. jupyter-execute:: boilerplate.py :hide-code: .. _tutorial_discretizer_introduction: Discretizing by hand ... ...
 ... ... @@ -14,6 +14,9 @@ into Kwant's structure. import matplotlib from matplotlib import pyplot as plt .. jupyter-execute:: boilerplate.py :hide-code: What is a system, and what is a builder? ======================================== A Kwant system represents a particular tight-binding model. It contains a graph ... ...
 ... ... @@ -88,6 +88,9 @@ In order to use Kwant, we need to import it: # For plotting from matplotlib import pyplot .. jupyter-execute:: boilerplate.py :hide-code: .. jupyter-execute:: import kwant ... ... @@ -452,6 +455,11 @@ file and defining the a square lattice and empty scattering region. # For plotting from matplotlib import pyplot .. jupyter-execute:: boilerplate.py :hide-code: .. jupyter-execute:: a = 1 t = 1.0 W, L = 10, 30 ... ... @@ -661,6 +669,11 @@ return a Kwant ``Builder``: from matplotlib import pyplot import kwant .. jupyter-execute:: boilerplate.py :hide-code: .. jupyter-execute:: def make_system(L, W, a=1, t=1.0): lat = kwant.lattice.square(a) ... ...
 ... ... @@ -47,6 +47,9 @@ explicitly here to show how to define a new lattice: sin_30, cos_30 = (1 / 2, sqrt(3) / 2) .. jupyter-execute:: boilerplate.py :hide-code: .. jupyter-execute:: graphene = kwant.lattice.general([(1, 0), (sin_30, cos_30)], ... ...
 ... ... @@ -39,6 +39,9 @@ KPM method `kwant.kpm`, that is based on the algorithms presented in Ref. [1]_. import scipy from matplotlib import pyplot .. jupyter-execute:: boilerplate.py :hide-code: Introduction ************ ... ... @@ -151,7 +154,7 @@ We start by importing kwant and defining our system. # Plot several density of states curves on the same axes. def plot_dos(labels_to_data): pyplot.figure(figsize=(5,4)) pyplot.figure() for label, (x, y) in labels_to_data: pyplot.plot(x, y.real, label=label, linewidth=2) pyplot.legend(loc=2, framealpha=0.5) ... ... @@ -162,7 +165,7 @@ We start by importing kwant and defining our system. # Plot fill density of states plus curves on the same axes. def plot_dos_and_curves(dos, labels_to_data): pyplot.figure(figsize=(5,4)) pyplot.figure() pyplot.fill_between(dos[0], dos[1], label="DoS [a.u.]", alpha=0.5, color='gray') for label, (x, y) in labels_to_data: ... ...
 ... ... @@ -51,6 +51,9 @@ texture. # letters denote spinor indices sigma = np.rollaxis(np.array([sigma_x, sigma_y, sigma_z]), 1) .. jupyter-execute:: boilerplate.py :hide-code: Introduction ------------ Our starting point will be the following spinful tight-binding model on ... ...
 ... ... @@ -35,6 +35,9 @@ these options can be used to achieve various very different objectives. import kwant .. jupyter-execute:: boilerplate.py :hide-code: We begin by first considering a circular graphene quantum dot (similar to what has been used in parts of the tutorial :ref:`tutorial-graphene`.) In contrast to previous examples, we will also use hoppings beyond next-nearest neighbors: ... ... @@ -216,6 +219,9 @@ visible. The hoppings are also plotted in order to show the underlying lattice. import kwant .. jupyter-execute:: boilerplate.py :hide-code: Zincblende is a very common crystal structure of semiconductors. It is a face-centered cubic crystal with two inequivalent atoms in the unit cell (i.e. two different types of atoms, unlike diamond which has the same crystal ... ...
 ... ... @@ -30,6 +30,9 @@ Band structure calculations # For plotting from matplotlib import pyplot .. jupyter-execute:: boilerplate.py :hide-code: When doing transport simulations, one also often needs to know the band structure of the leads, i.e. the energies of the propagating plane waves in the leads as a function of momentum. This band structure contains information about ... ... @@ -137,6 +140,9 @@ Closed systems from matplotlib import pyplot import kwant .. jupyter-execute:: boilerplate.py :hide-code: Although Kwant is (currently) mainly aimed towards transport problems, it can also easily be used to compute properties of closed systems -- after all, a closed system is nothing more than a scattering region without leads! ... ...
 ... ... @@ -68,6 +68,9 @@ for small arrays.) # For plotting from matplotlib import pyplot .. jupyter-execute:: boilerplate.py :hide-code: .. jupyter-execute:: # For matrix support ... ... @@ -242,6 +245,9 @@ Spatially dependent values through functions # For plotting from matplotlib import pyplot .. jupyter-execute:: boilerplate.py :hide-code: Up to now, all examples had position-independent matrix-elements (and thus translational invariance along the wire, which was the origin of the conductance steps). Now, we consider the ... ... @@ -403,6 +409,9 @@ Nontrivial shapes # For plotting from matplotlib import pyplot .. jupyter-execute:: boilerplate.py :hide-code: Up to now, we only dealt with simple wire geometries. Now we turn to the case of a more complex geometry, namely transport through a quantum ring that is pierced by a magnetic flux :math:`\Phi`: ... ... @@ -594,6 +603,12 @@ period of one flux quantum. import kwant from matplotlib import pyplot .. jupyter-execute:: boilerplate.py :hide-code: .. jupyter-execute:: :hide-code: a = 1 t = 1.0 W = 10 ... ... @@ -643,6 +658,12 @@ period of one flux quantum. import kwant from matplotlib import pyplot .. jupyter-execute:: boilerplate.py :hide-code: .. jupyter-execute:: :hide-code: a = 1 t = 1.0 W = 10 ... ...
 ... ... @@ -35,6 +35,9 @@ Superconductors: orbital degrees of freedom, conservation laws and symmetries tau_y = tinyarray.array([[0, -1j], [1j, 0]]) tau_z = tinyarray.array([[1, 0], [0, -1]]) .. jupyter-execute:: boilerplate.py :hide-code: This example deals with superconductivity on the level of the Bogoliubov-de Gennes (BdG) equation. In this framework, the Hamiltonian is given as ... ...
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!