From 3530ee76ce08c1aa42b08a1a33fd225dd3d2a903 Mon Sep 17 00:00:00 2001
From: Christoph Groth <christoph.groth@cea.fr>
Date: Tue, 2 Apr 2019 16:45:54 +0200
Subject: [PATCH] clarify whatsnew code snippet

---
 doc/source/pre/whatsnew/1.4.rst | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/doc/source/pre/whatsnew/1.4.rst b/doc/source/pre/whatsnew/1.4.rst
index c962fb97..a2ea4f32 100644
--- a/doc/source/pre/whatsnew/1.4.rst
+++ b/doc/source/pre/whatsnew/1.4.rst
@@ -35,12 +35,12 @@ ensure that the chosen gauge is consistent across the whole system
 directions). This release introduces `kwant.physics.magnetic_gauge`,
 which calculates the Peierls phases for you::
 
-  import numpy as np
-  import kwant
-
   def hopping(a, b, t, peierls):
       return -t * peierls(a, b)
 
+  def B_syst(pos):
+     return np.exp(-np.sum(pos * pos))
+
   syst = make_system(hopping)
   lead = make_lead(hopping).substituted(peierls='peierls_lead')
   syst.attach_lead(lead)
@@ -48,11 +48,7 @@ which calculates the Peierls phases for you::
 
   gauge = kwant.physics.magnetic_gauge(syst)
 
-  def B_syst(pos):
-     return np.exp(-np.sum(pos * pos))
-
   # B_syst in scattering region, 0 in lead.
-  # Ensure that the fields match at the system/lead interface!
   peierls_syst, peierls_lead = gauge(B_syst, 0)
 
   params = dict(t=1, peierls=peierls_syst, peierls_lead=peierls_lead)
-- 
GitLab