From 0c4d6eea532f6e031ba3672d7bab723051be96c1 Mon Sep 17 00:00:00 2001
From: Christoph Groth <christoph.groth@cea.fr>
Date: Tue, 8 Oct 2013 16:35:54 +0200
Subject: [PATCH] include forgotten noise module in API

---
 doc/source/reference/kwant.physics.rst | 1 +
 kwant/physics/__init__.py              | 2 +-
 kwant/physics/noise.py                 | 8 ++++++--
 kwant/physics/tests/test_noise.py      | 2 +-
 4 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/doc/source/reference/kwant.physics.rst b/doc/source/reference/kwant.physics.rst
index e1c6f901..6d7d734c 100644
--- a/doc/source/reference/kwant.physics.rst
+++ b/doc/source/reference/kwant.physics.rst
@@ -11,5 +11,6 @@ Leads
    Bands
    modes
    selfenergy
+   two_terminal_shotnoise
    PropagatingModes
    StabilizedModes
diff --git a/kwant/physics/__init__.py b/kwant/physics/__init__.py
index 5ae8693c..f438c942 100644
--- a/kwant/physics/__init__.py
+++ b/kwant/physics/__init__.py
@@ -10,7 +10,7 @@
 
 # Merge the public interface of all submodules.
 __all__ = []
-for module in ['leads', 'dispersion']:
+for module in ['leads', 'dispersion', 'noise']:
     exec 'from . import {0}'.format(module)
     exec 'from .{0} import *'.format(module)
     exec '__all__.extend({0}.__all__)'.format(module)
diff --git a/kwant/physics/noise.py b/kwant/physics/noise.py
index 847e2910..4dc96000 100644
--- a/kwant/physics/noise.py
+++ b/kwant/physics/noise.py
@@ -7,6 +7,10 @@
 # http://kwant-project.org/authors.
 
 import numpy as np
+from ..solvers.common import SMatrix
+
+__all__ = ['two_terminal_shotnoise']
+
 
 def two_terminal_shotnoise(smatrix):
     """Compute the shot-noise in a two-terminal setup.
@@ -25,7 +29,7 @@ def two_terminal_shotnoise(smatrix):
         Shot noise measured in noise quanta `2 e^3 |V| / pi hbar`.
     """
 
-    if hasattr(smatrix.lead_info[0], 'shape'):
+    if not isinstance(smatrix, SMatrix):
         raise NotImplementedError("Noise expressions in terms of Green's "
                                   "functions are not implemented.")
 
@@ -41,5 +45,5 @@ def two_terminal_shotnoise(smatrix):
 # voltages at various leads as input.  (See
 # http://arxiv.org/abs/cond-mat/9910158) It could still be based on
 # smatrix._a_ttdagger_a_inv, i.e. be also valid also for self-energy leads,
-# provided that only true transmission blocks are used As long as nobody needs
+# provided that only true transmission blocks are used.  As long as nobody needs
 # it though, it does make little sense to make such a routine.
diff --git a/kwant/physics/tests/test_noise.py b/kwant/physics/tests/test_noise.py
index 18b2c3ae..bdeb7063 100644
--- a/kwant/physics/tests/test_noise.py
+++ b/kwant/physics/tests/test_noise.py
@@ -10,7 +10,7 @@ import numpy as np
 from nose.tools import assert_raises
 from numpy.testing import assert_almost_equal
 import kwant
-from kwant.physics.noise import two_terminal_shotnoise
+from kwant.physics import two_terminal_shotnoise
 
 n = 5
 chain = kwant.lattice.chain()
-- 
GitLab