From c66173c36f463ee0d532eeba9dbb2c9d2b1c6b25 Mon Sep 17 00:00:00 2001 From: Anton Akhmerov <anton.akhmerov@gmail.com> Date: Sun, 18 Nov 2012 15:01:10 -0500 Subject: [PATCH] pep8 and typo fix for tutorials --- doc/source/images/2-quantum_well.py.diff | 2 +- doc/source/images/2-spin_orbit.py.diff | 2 +- doc/source/images/4-graphene.py.diff | 4 ++-- doc/source/images/5-superconductor_band_structure.py.diff | 4 ++-- doc/source/tutorial/1-quantum_wire_revisited.py | 4 ++-- doc/source/tutorial/2-quantum_well.py | 1 + doc/source/tutorial/2-spin_orbit.py | 1 + doc/source/tutorial/4-graphene.py | 4 ++-- doc/source/tutorial/5-superconductor_band_structure.py | 1 - 9 files changed, 12 insertions(+), 11 deletions(-) diff --git a/doc/source/images/2-quantum_well.py.diff b/doc/source/images/2-quantum_well.py.diff index 40988f9f..b3e158e4 100644 --- a/doc/source/images/2-quantum_well.py.diff +++ b/doc/source/images/2-quantum_well.py.diff @@ -8,7 +8,7 @@ # global variable governing the behavior of potential() in # make_system() -@@ -75,19 +76,26 @@ +@@ -76,19 +77,26 @@ smatrix = kwant.solve(sys, energy) data.append(smatrix.transmission(1, 0)) diff --git a/doc/source/images/2-spin_orbit.py.diff b/doc/source/images/2-spin_orbit.py.diff index fb74b9ce..ec1bbd82 100644 --- a/doc/source/images/2-spin_orbit.py.diff +++ b/doc/source/images/2-spin_orbit.py.diff @@ -8,7 +8,7 @@ # define Pauli-matrices for convenience sigma_0 = numpy.eye(2) -@@ -72,19 +73,25 @@ +@@ -73,19 +74,25 @@ smatrix = kwant.solve(sys, energy) data.append(smatrix.transmission(1, 0)) diff --git a/doc/source/images/4-graphene.py.diff b/doc/source/images/4-graphene.py.diff index b2e31cb2..c86c7b55 100644 --- a/doc/source/images/4-graphene.py.diff +++ b/doc/source/images/4-graphene.py.diff @@ -50,10 +50,10 @@ - pyplot.figure() + fig = pyplot.figure() pyplot.plot(momenta, energy_list) -- pyplot.xlabel("momentum [in untis of (lattice constant)^-1]") +- pyplot.xlabel("momentum [in units of (lattice constant)^-1]") - pyplot.ylabel("energy [in units of t]") - pyplot.show() -+ pyplot.xlabel("momentum [in untis of (lattice constant)^-1]", ++ pyplot.xlabel("momentum [in units of (lattice constant)^-1]", + fontsize=latex.mpl_label_size) + pyplot.ylabel("energy [in units of t]", + fontsize=latex.mpl_label_size) diff --git a/doc/source/images/5-superconductor_band_structure.py.diff b/doc/source/images/5-superconductor_band_structure.py.diff index 8b8d6e5a..ee2fbdd6 100644 --- a/doc/source/images/5-superconductor_band_structure.py.diff +++ b/doc/source/images/5-superconductor_band_structure.py.diff @@ -1,6 +1,6 @@ --- original +++ modified -@@ -17,6 +17,7 @@ +@@ -16,6 +16,7 @@ # For plotting from matplotlib import pyplot @@ -8,7 +8,7 @@ tau_x = np.array([[0, 1], [1, 0]]) tau_z = np.array([[1, 0], [0, -1]]) -@@ -47,12 +48,20 @@ +@@ -46,12 +47,20 @@ # the bandstructure energy_list = [lead.energies(k) for k in momenta] diff --git a/doc/source/tutorial/1-quantum_wire_revisited.py b/doc/source/tutorial/1-quantum_wire_revisited.py index 2e7da1aa..f673dc7f 100644 --- a/doc/source/tutorial/1-quantum_wire_revisited.py +++ b/doc/source/tutorial/1-quantum_wire_revisited.py @@ -59,10 +59,10 @@ def make_system(a=1, t=1.0, W=10, L=30): sys.attach_lead(lead1) return sys - #HIDDEN_END_yxot -#HIDDEN_BEGIN_ayuk + +#HIDDEN_BEGIN_ayuk def plot_conductance(sys, energies): # Compute conductance data = [] diff --git a/doc/source/tutorial/2-quantum_well.py b/doc/source/tutorial/2-quantum_well.py index 5bbead7d..38b100eb 100644 --- a/doc/source/tutorial/2-quantum_well.py +++ b/doc/source/tutorial/2-quantum_well.py @@ -19,6 +19,7 @@ from matplotlib import pyplot #HIDDEN_BEGIN_ehso pot = 0 + def make_system(a=1, t=1.0, W=10, L=30, L_well=10): # Start with an empty tight-binding system and a single square lattice. # `a` is the lattice constant (by default set to 1 for simplicity. diff --git a/doc/source/tutorial/2-spin_orbit.py b/doc/source/tutorial/2-spin_orbit.py index a37e5acc..8d42f1d8 100644 --- a/doc/source/tutorial/2-spin_orbit.py +++ b/doc/source/tutorial/2-spin_orbit.py @@ -73,6 +73,7 @@ def make_system(a=1, t=1.0, alpha=0.5, e_z=0.08, W=10, L=30): return sys + def plot_conductance(sys, energies): # Compute conductance data = [] diff --git a/doc/source/tutorial/4-graphene.py b/doc/source/tutorial/4-graphene.py index 635dedbf..e024b7f0 100644 --- a/doc/source/tutorial/4-graphene.py +++ b/doc/source/tutorial/4-graphene.py @@ -25,9 +25,9 @@ sin_30, cos_30 = (1 / 2, sqrt(3) / 2) graphene = kwant.make_lattice([(1, 0), (sin_30, cos_30)], [(0, 0), (0, 1 / sqrt(3))]) a, b = graphene.sublattices - #HIDDEN_END_hnla + #HIDDEN_BEGIN_shzy def make_system(r=10, w=2.0, pot=0.1): @@ -135,7 +135,7 @@ def plot_bandstructure(flead, momenta): pyplot.figure() pyplot.plot(momenta, energy_list) - pyplot.xlabel("momentum [in untis of (lattice constant)^-1]") + pyplot.xlabel("momentum [in units of (lattice constant)^-1]") pyplot.ylabel("energy [in units of t]") pyplot.show() diff --git a/doc/source/tutorial/5-superconductor_band_structure.py b/doc/source/tutorial/5-superconductor_band_structure.py index a0dca9e7..79badae5 100644 --- a/doc/source/tutorial/5-superconductor_band_structure.py +++ b/doc/source/tutorial/5-superconductor_band_structure.py @@ -13,7 +13,6 @@ import kwant import numpy as np -from math import pi # For plotting from matplotlib import pyplot -- GitLab