Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
kwant
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Joseph Weston
kwant
Commits
261057f2
Commit
261057f2
authored
9 years ago
by
Anton Akhmerov
Browse files
Options
Downloads
Patches
Plain Diff
use PEP 3135 super()
parent
1aaae40f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
kwant/builder.py
+1
-1
1 addition, 1 deletion
kwant/builder.py
kwant/lattice.py
+1
-1
1 addition, 1 deletion
kwant/lattice.py
kwant/plotter.py
+15
-15
15 additions, 15 deletions
kwant/plotter.py
kwant/solvers/common.py
+2
-2
2 additions, 2 deletions
kwant/solvers/common.py
with
19 additions
and
19 deletions
kwant/builder.py
+
1
−
1
View file @
261057f2
...
@@ -173,7 +173,7 @@ class SimpleSiteFamily(SiteFamily):
...
@@ -173,7 +173,7 @@ class SimpleSiteFamily(SiteFamily):
def
__init__
(
self
,
name
=
None
):
def
__init__
(
self
,
name
=
None
):
canonical_repr
=
'
{0}({1})
'
.
format
(
self
.
__class__
,
repr
(
name
))
canonical_repr
=
'
{0}({1})
'
.
format
(
self
.
__class__
,
repr
(
name
))
super
(
SimpleSiteFamily
,
self
).
__init__
(
canonical_repr
,
name
)
super
().
__init__
(
canonical_repr
,
name
)
def
normalize_tag
(
self
,
tag
):
def
normalize_tag
(
self
,
tag
):
tag
=
tuple
(
tag
)
tag
=
tuple
(
tag
)
...
...
This diff is collapsed.
Click to expand it.
kwant/lattice.py
+
1
−
1
View file @
261057f2
...
@@ -427,7 +427,7 @@ class Monatomic(builder.SiteFamily, Polyatomic):
...
@@ -427,7 +427,7 @@ class Monatomic(builder.SiteFamily, Polyatomic):
cl
=
self
.
__module__
+
'
.
'
+
self
.
__class__
.
__name__
cl
=
self
.
__module__
+
'
.
'
+
self
.
__class__
.
__name__
canonical_repr
=
msg
.
format
(
cl
,
short_array_repr
(
prim_vecs
),
canonical_repr
=
msg
.
format
(
cl
,
short_array_repr
(
prim_vecs
),
short_array_repr
(
offset
),
repr
(
name
))
short_array_repr
(
offset
),
repr
(
name
))
super
(
Monatomic
,
self
).
__init__
(
canonical_repr
,
name
)
super
().
__init__
(
canonical_repr
,
name
)
self
.
sublattices
=
[
self
]
self
.
sublattices
=
[
self
]
self
.
_prim_vecs
=
prim_vecs
self
.
_prim_vecs
=
prim_vecs
...
...
This diff is collapsed.
Click to expand it.
kwant/plotter.py
+
15
−
15
View file @
261057f2
...
@@ -82,7 +82,7 @@ def nparray_if_array(var):
...
@@ -82,7 +82,7 @@ def nparray_if_array(var):
if
mpl_enabled
:
if
mpl_enabled
:
class
LineCollection
(
collections
.
LineCollection
):
class
LineCollection
(
collections
.
LineCollection
):
def
__init__
(
self
,
segments
,
reflen
=
None
,
**
kwargs
):
def
__init__
(
self
,
segments
,
reflen
=
None
,
**
kwargs
):
super
(
LineCollection
,
self
).
__init__
(
segments
,
**
kwargs
)
super
().
__init__
(
segments
,
**
kwargs
)
self
.
reflen
=
reflen
self
.
reflen
=
reflen
def
set_linewidths
(
self
,
linewidths
):
def
set_linewidths
(
self
,
linewidths
):
...
@@ -97,14 +97,14 @@ if mpl_enabled:
...
@@ -97,14 +97,14 @@ if mpl_enabled:
else
:
else
:
factor
=
1
factor
=
1
super
(
LineCollection
,
self
).
set_linewidths
(
self
.
linewidths_orig
*
super
().
set_linewidths
(
self
.
linewidths_orig
*
factor
)
factor
)
return
super
(
LineCollection
,
self
).
draw
(
renderer
)
return
super
().
draw
(
renderer
)
class
PathCollection
(
collections
.
PathCollection
):
class
PathCollection
(
collections
.
PathCollection
):
def
__init__
(
self
,
paths
,
sizes
=
None
,
reflen
=
None
,
**
kwargs
):
def
__init__
(
self
,
paths
,
sizes
=
None
,
reflen
=
None
,
**
kwargs
):
super
(
PathCollection
,
self
).
__init__
(
paths
,
sizes
=
sizes
,
**
kwargs
)
super
().
__init__
(
paths
,
sizes
=
sizes
,
**
kwargs
)
self
.
reflen
=
reflen
self
.
reflen
=
reflen
self
.
linewidths_orig
=
nparray_if_array
(
self
.
get_linewidths
())
self
.
linewidths_orig
=
nparray_if_array
(
self
.
get_linewidths
())
...
@@ -177,7 +177,7 @@ if mpl_enabled:
...
@@ -177,7 +177,7 @@ if mpl_enabled:
class
Line3DCollection
(
mplot3d
.
art3d
.
Line3DCollection
):
class
Line3DCollection
(
mplot3d
.
art3d
.
Line3DCollection
):
def
__init__
(
self
,
segments
,
reflen
=
None
,
zorder
=
0
,
**
kwargs
):
def
__init__
(
self
,
segments
,
reflen
=
None
,
zorder
=
0
,
**
kwargs
):
super
(
Line3DCollection
,
self
).
__init__
(
segments
,
**
kwargs
)
super
().
__init__
(
segments
,
**
kwargs
)
self
.
reflen
=
reflen
self
.
reflen
=
reflen
self
.
zorder3d
=
zorder
self
.
zorder3d
=
zorder
...
@@ -185,7 +185,7 @@ if mpl_enabled:
...
@@ -185,7 +185,7 @@ if mpl_enabled:
self
.
linewidths_orig
=
nparray_if_array
(
linewidths
)
self
.
linewidths_orig
=
nparray_if_array
(
linewidths
)
def
do_3d_projection
(
self
,
renderer
):
def
do_3d_projection
(
self
,
renderer
):
super
(
Line3DCollection
,
self
).
do_3d_projection
(
renderer
)
super
().
do_3d_projection
(
renderer
)
# The whole 3D ordering is flawed in mplot3d when several
# The whole 3D ordering is flawed in mplot3d when several
# collections are added. We just use normal zorder. Note the
# collections are added. We just use normal zorder. Note the
# "-" due to the different logic in the 3d plotting, we still
# "-" due to the different logic in the 3d plotting, we still
...
@@ -207,9 +207,9 @@ if mpl_enabled:
...
@@ -207,9 +207,9 @@ if mpl_enabled:
else
:
else
:
factor
=
1
factor
=
1
super
(
Line3DCollection
,
self
).
set_linewidths
(
super
().
set_linewidths
(
self
.
linewidths_orig
*
factor
)
self
.
linewidths_orig
*
factor
)
super
(
Line3DCollection
,
self
).
draw
(
renderer
)
super
().
draw
(
renderer
)
class
Path3DCollection
(
mplot3d
.
art3d
.
Patch3DCollection
):
class
Path3DCollection
(
mplot3d
.
art3d
.
Patch3DCollection
):
...
@@ -220,7 +220,7 @@ if mpl_enabled:
...
@@ -220,7 +220,7 @@ if mpl_enabled:
if
offsets
is
not
None
:
if
offsets
is
not
None
:
kwargs
[
'
offsets
'
]
=
offsets
[:,
:
2
]
kwargs
[
'
offsets
'
]
=
offsets
[:,
:
2
]
super
(
Path3DCollection
,
self
).
__init__
(
paths
,
**
kwargs
)
super
().
__init__
(
paths
,
**
kwargs
)
if
offsets
is
not
None
:
if
offsets
is
not
None
:
self
.
set_3d_properties
(
zs
=
offsets
[:,
2
],
zdir
=
"
z
"
)
self
.
set_3d_properties
(
zs
=
offsets
[:,
2
],
zdir
=
"
z
"
)
...
@@ -246,17 +246,17 @@ if mpl_enabled:
...
@@ -246,17 +246,17 @@ if mpl_enabled:
def
set_array
(
self
,
array
):
def
set_array
(
self
,
array
):
self
.
array_orig
=
nparray_if_array
(
array
)
self
.
array_orig
=
nparray_if_array
(
array
)
super
(
Path3DCollection
,
self
).
set_array
(
array
)
super
().
set_array
(
array
)
def
set_color
(
self
,
colors
):
def
set_color
(
self
,
colors
):
self
.
facecolors_orig
=
nparray_if_array
(
colors
)
self
.
facecolors_orig
=
nparray_if_array
(
colors
)
self
.
edgecolors_orig
=
self
.
facecolors_orig
self
.
edgecolors_orig
=
self
.
facecolors_orig
super
(
Path3DCollection
,
self
).
set_color
(
colors
)
super
().
set_color
(
colors
)
def
set_edgecolors
(
self
,
colors
):
def
set_edgecolors
(
self
,
colors
):
colors
=
matplotlib
.
colors
.
colorConverter
.
to_rgba_array
(
colors
)
colors
=
matplotlib
.
colors
.
colorConverter
.
to_rgba_array
(
colors
)
self
.
edgecolors_orig
=
nparray_if_array
(
colors
)
self
.
edgecolors_orig
=
nparray_if_array
(
colors
)
super
(
Path3DCollection
,
self
).
set_edgecolors
(
colors
)
super
().
set_edgecolors
(
colors
)
def
get_transforms
(
self
):
def
get_transforms
(
self
):
# this is exact only for an isometric projection, for the
# this is exact only for an isometric projection, for the
...
@@ -316,14 +316,14 @@ if mpl_enabled:
...
@@ -316,14 +316,14 @@ if mpl_enabled:
self
.
facecolors_orig
.
shape
[
0
]
>
1
):
self
.
facecolors_orig
.
shape
[
0
]
>
1
):
shape
=
list
(
self
.
facecolors_orig
.
shape
)
shape
=
list
(
self
.
facecolors_orig
.
shape
)
shape
[
0
]
=
vs
.
shape
[
1
]
shape
[
0
]
=
vs
.
shape
[
1
]
super
(
Path3DCollection
,
self
).
set_facecolors
(
super
().
set_facecolors
(
np
.
resize
(
self
.
facecolors_orig
,
shape
)[
indx
])
np
.
resize
(
self
.
facecolors_orig
,
shape
)[
indx
])
if
(
self
.
edgecolors_orig
is
not
None
and
if
(
self
.
edgecolors_orig
is
not
None
and
self
.
edgecolors_orig
.
shape
[
0
]
>
1
):
self
.
edgecolors_orig
.
shape
[
0
]
>
1
):
shape
=
list
(
self
.
edgecolors_orig
.
shape
)
shape
=
list
(
self
.
edgecolors_orig
.
shape
)
shape
[
0
]
=
vs
.
shape
[
1
]
shape
[
0
]
=
vs
.
shape
[
1
]
super
(
Path3DCollection
,
self
).
set_edgecolors
(
super
().
set_edgecolors
(
np
.
resize
(
self
.
edgecolors_orig
,
np
.
resize
(
self
.
edgecolors_orig
,
shape
)[
indx
])
shape
)[
indx
])
else
:
else
:
...
@@ -354,7 +354,7 @@ if mpl_enabled:
...
@@ -354,7 +354,7 @@ if mpl_enabled:
self
.
set_linewidths
(
self
.
linewidths_orig2
*
factor
)
self
.
set_linewidths
(
self
.
linewidths_orig2
*
factor
)
super
(
Path3DCollection
,
self
).
draw
(
renderer
)
super
().
draw
(
renderer
)
# matplotlib helper functions.
# matplotlib helper functions.
...
...
This diff is collapsed.
Click to expand it.
kwant/solvers/common.py
+
2
−
2
View file @
261057f2
...
@@ -714,7 +714,7 @@ class SMatrix(BlockResult):
...
@@ -714,7 +714,7 @@ class SMatrix(BlockResult):
def
__init__
(
self
,
data
,
lead_info
,
out_leads
,
in_leads
,
def
__init__
(
self
,
data
,
lead_info
,
out_leads
,
in_leads
,
current_conserving
=
False
):
current_conserving
=
False
):
sizes
=
[
len
(
i
.
momenta
)
//
2
for
i
in
lead_info
]
sizes
=
[
len
(
i
.
momenta
)
//
2
for
i
in
lead_info
]
super
(
SMatrix
,
self
).
__init__
(
data
,
lead_info
,
out_leads
,
in_leads
,
super
().
__init__
(
data
,
lead_info
,
out_leads
,
in_leads
,
sizes
,
current_conserving
)
sizes
,
current_conserving
)
def
num_propagating
(
self
,
lead
):
def
num_propagating
(
self
,
lead
):
...
@@ -761,7 +761,7 @@ class GreensFunction(BlockResult):
...
@@ -761,7 +761,7 @@ class GreensFunction(BlockResult):
def
__init__
(
self
,
data
,
lead_info
,
out_leads
,
in_leads
,
def
__init__
(
self
,
data
,
lead_info
,
out_leads
,
in_leads
,
current_conserving
=
False
):
current_conserving
=
False
):
sizes
=
[
i
.
shape
[
0
]
for
i
in
lead_info
]
sizes
=
[
i
.
shape
[
0
]
for
i
in
lead_info
]
super
(
GreensFunction
,
self
).
__init__
(
super
().
__init__
(
data
,
lead_info
,
out_leads
,
in_leads
,
sizes
,
current_conserving
)
data
,
lead_info
,
out_leads
,
in_leads
,
sizes
,
current_conserving
)
def
num_propagating
(
self
,
lead
):
def
num_propagating
(
self
,
lead
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment