From debc7ade5d4987e16d64d72ca8d9e897f61b3d9b Mon Sep 17 00:00:00 2001 From: Christoph Groth <christoph.groth@cea.fr> Date: Fri, 27 Feb 2015 17:20:49 +0100 Subject: [PATCH] docstrings: be clearer about lists, sequences, and sequences of sequences --- kwant/builder.py | 4 ++-- kwant/lattice.py | 38 +++++++++++++++++++------------------- kwant/linalg/lll.py | 16 ++++++++-------- kwant/physics/leads.py | 4 ++-- kwant/system.py | 2 +- 5 files changed, 32 insertions(+), 32 deletions(-) diff --git a/kwant/builder.py b/kwant/builder.py index ea3ad357..b044ffe5 100644 --- a/kwant/builder.py +++ b/kwant/builder.py @@ -505,7 +505,7 @@ class SelfEnergyLead(Lead): ---------- selfenergy_func : function Function which returns the self energy matrix for the interface sites - given the energy and optionally a list of extra arguments. + given the energy and optionally a sequence of extra arguments. interface : sequence of `Site` instances """ def __init__(self, selfenergy_func, interface): @@ -528,7 +528,7 @@ class ModesLead(Lead): modes_func : function Function which returns the modes of the lead as a tuple of `~kwant.physics.PropagatingModes` and `~kwant.physics.StabilizedModes` - given the energy and optionally a list of extra arguments. + given the energy and optionally a sequence of extra arguments. interface : sequence of `Site` instances diff --git a/kwant/lattice.py b/kwant/lattice.py index 46cdf872..dc058746 100644 --- a/kwant/lattice.py +++ b/kwant/lattice.py @@ -26,12 +26,12 @@ def general(prim_vecs, basis=None, name=''): Parameters ---------- - prim_vecs : sequence of sequences of floats - The primitive vectors of the Bravais lattice. - basis : sequence of floats - The coordinates of the basis sites inside the unit cell. + prim_vecs : 2d array-like of floats + The primitive vectors of the Bravais lattice + basis : 2d array-like of floats + The coordinates of the basis sites inside the unit cell name : string or sequence of strings - Name of the lattice, or the list of names of all of the sublattices. + Name of the lattice, or sequence of names of all of the sublattices. If the name of the lattice is given, the names of sublattices (if any) are obtained by appending their number to the name of the lattice. @@ -60,20 +60,20 @@ class Polyatomic(object): Parameters ---------- - prim_vecs : sequence of sequences of floats - The primitive vectors of a Bravais lattice. - basis : sequence of sequences of floats + prim_vecs : 2d array-like of floats + The primitive vectors of the Bravais lattice + basis : 2d array-like of floats The coordinates of the basis sites inside the unit cell. name : string or sequence of strings - The name of the lattice, or a list of the names of all the sublattices. - If the name of the lattice is given, the names of sublattices are - obtained by appending their number to the name of the lattice. + The name of the lattice, or a sequence of the names of all the + sublattices. If the name of the lattice is given, the names of + sublattices are obtained by appending their number to the name of the + lattice. Attributes ---------- - prim_vecs : sequence of vectors + prim_vecs : 2d tinyarray of floats ``prim_vecs[i]`` is the `i`-th primitive basis vector of the lattice - sublattices : list of `Monatomic` Sublattices belonging to this lattice. Raises @@ -118,8 +118,8 @@ class Polyatomic(object): function : callable A function of real space coordinates that returns a truth value: true for coordinates inside the shape, and false otherwise. - start : float vector - The origin for the flood-fill algorithm. + start : 1d array-like + The real-space origin for the flood-fill algorithm. Returns ------- @@ -212,7 +212,7 @@ class Polyatomic(object): Parameters ---------- - center : float vector + center : 1d array-like of floats A point belonging to the axis of the cylinder. radius : float The radius of the cylinder. @@ -272,7 +272,7 @@ class Polyatomic(object): Returns ------- hoppings : list of kwant.builder.HopplingKind objects - A list n-th nearest neighbor hoppings. + The n-th nearest neighbor hoppings. Notes ----- @@ -390,7 +390,7 @@ class Monatomic(builder.SiteFamily, Polyatomic): Parameters ---------- - prim_vecs : sequence of sequences of floats + prim_vecs : 2d array-like of floats Primitive vectors of the Bravais lattice. offset : vector of floats Displacement of the lattice origin from the real space @@ -532,7 +532,7 @@ class TranslationalSymmetry(builder.Symmetry): previously processed site families from `site_family_data` if you want to modify the cache. - other_vectors : list of lists of integers + other_vectors : 2d array-like of integers Bravais lattice vectors used to complement the periods in forming a basis. The fundamental domain consists of all the lattice sites for which the zero coefficients corresponding to the symmetry diff --git a/kwant/linalg/lll.py b/kwant/linalg/lll.py index 30d9a617..f6c51294 100644 --- a/kwant/linalg/lll.py +++ b/kwant/linalg/lll.py @@ -43,8 +43,8 @@ def lll(basis, c=1.34): Parameters ---------- - basis : 2d array-like - An array of lattice basis vectors to be reduced. + basis : 2d array-like of floats + The lattice basis vectors to be reduced. c : float Reduction parameter for the algorithm. Must be larger than 1 1/3, since otherwise a solution is not guaranteed to exist. @@ -116,10 +116,10 @@ def cvp(vec, basis, n=1): Parameters ---------- - vec : 1d array-like - The lattice vectors closest to `vec` have to be found. - basis : 2d array-like - The list of basis vectors. + vec : 1d array-like of floats + The lattice vectors closest to this vector are to be found. + basis : 2d array-like of floats + Sequence of basis vectors n : int Number of lattice vectors closest to the point that need to be found. @@ -167,12 +167,12 @@ def voronoi(basis): Parameters ---------- - basis : 2d array-like + basis : 2d array-like of floats Basis vectors for which the Voronoi neighbors have to be found. Returns ------- - voronoi_neighbors : numpy array + voronoi_neighbors : numpy array of ints All the lattice vectors that may potentially neighbor the origin. Notes diff --git a/kwant/physics/leads.py b/kwant/physics/leads.py index 45467c7f..76d016ee 100644 --- a/kwant/physics/leads.py +++ b/kwant/physics/leads.py @@ -129,7 +129,7 @@ def setup_linsys(h_cell, h_hop, tol=1e6, stabilization=None): tol : float Numbers are considered zero when they are smaller than `tol` times the machine precision. - stabilization : list of 2 booleans or None + stabilization : sequence of 2 booleans or None Which steps of the eigenvalue problem stabilization to perform. If the value is `None`, then Kwant chooses the fastest (and least stable) algorithm that is expected to be sufficient. For any other value, @@ -521,7 +521,7 @@ def modes(h_cell, h_hop, tol=1e6, stabilization=None): tol : float Numbers and differences are considered zero when they are smaller than `tol` times the machine precision. - stabilization : list of 2 booleans or None + stabilization : sequence of 2 booleans or None Which steps of the eigenvalue prolem stabilization to perform. If the value is `None`, then Kwant chooses the fastest (and least stable) algorithm that is expected to be sufficient. For any other value, diff --git a/kwant/system.py b/kwant/system.py index 9c517da4..0749a3af 100644 --- a/kwant/system.py +++ b/kwant/system.py @@ -98,7 +98,7 @@ class FiniteSystem(System): evaluated. args : sequence Additional parameters required for calculating the Hamiltionians - leads : list of integers or None + leads : sequence of integers or None Numbers of the leads to be precalculated. If `None`, all are precalculated. what : 'modes', 'selfenergy', 'all' -- GitLab