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
a88cdf0f
Commit
a88cdf0f
authored
7 years ago
by
Joseph Weston
Browse files
Options
Downloads
Patches
Plain Diff
explain the usecases for 'density' and 'map'
Also add reference documentation for 'density'.
parent
3bfa10c3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
doc/source/reference/kwant.plotter.rst
+2
-0
2 additions, 0 deletions
doc/source/reference/kwant.plotter.rst
doc/source/tutorial/operators.rst
+1
-1
1 addition, 1 deletion
doc/source/tutorial/operators.rst
kwant/plotter.py
+21
-3
21 additions, 3 deletions
kwant/plotter.py
with
24 additions
and
4 deletions
doc/source/reference/kwant.plotter.rst
+
2
−
0
View file @
a88cdf0f
...
@@ -11,6 +11,7 @@ Plotting routines
...
@@ -11,6 +11,7 @@ Plotting routines
plot
plot
map
map
density
current
current
bands
bands
spectrum
spectrum
...
@@ -22,6 +23,7 @@ Helper functions
...
@@ -22,6 +23,7 @@ Helper functions
:toctree: generated/
:toctree: generated/
interpolate_current
interpolate_current
interpolate_density
sys_leads_sites
sys_leads_sites
sys_leads_hoppings
sys_leads_hoppings
sys_leads_pos
sys_leads_pos
...
...
This diff is collapsed.
Click to expand it.
doc/source/tutorial/operators.rst
+
1
−
1
View file @
a88cdf0f
...
@@ -124,7 +124,7 @@ is the square matrix referred to previously.
...
@@ -124,7 +124,7 @@ is the square matrix referred to previously.
Below we can see colorplots of the above-calculated quantities. The array that
Below we can see colorplots of the above-calculated quantities. The array that
is returned by evaluating a `~kwant.operator.Density` can be used directly with
is returned by evaluating a `~kwant.operator.Density` can be used directly with
`kwant.plotter.
map
`:
`kwant.plotter.
density
`:
.. image:: /code/figure/spin_densities.*
.. image:: /code/figure/spin_densities.*
...
...
This diff is collapsed.
Click to expand it.
kwant/plotter.py
+
21
−
3
View file @
a88cdf0f
...
@@ -1214,6 +1214,11 @@ def map(sys, value, colorbar=True, cmap=None, vmin=None, vmax=None, a=None,
...
@@ -1214,6 +1214,11 @@ def map(sys, value, colorbar=True, cmap=None, vmin=None, vmax=None, a=None,
calling `~kwant.plotter.mask_interpolate` and show this pixmap using
calling `~kwant.plotter.mask_interpolate` and show this pixmap using
matplotlib.
matplotlib.
This function is similar to `~kwant.plotter.density`, but is more suited
to the case where you want site-level resolution of the quantity that
you are plotting. If your system has many sites you may get more appealing
plots by using `~kwant.plotter.density`.
Parameters
Parameters
----------
----------
sys : kwant.system.FiniteSystem or kwant.builder.Builder
sys : kwant.system.FiniteSystem or kwant.builder.Builder
...
@@ -1269,6 +1274,10 @@ def map(sys, value, colorbar=True, cmap=None, vmin=None, vmax=None, a=None,
...
@@ -1269,6 +1274,10 @@ def map(sys, value, colorbar=True, cmap=None, vmin=None, vmax=None, a=None,
- When plotting a system on a square lattice and `method` is
"
nearest
"
, it
- When plotting a system on a square lattice and `method` is
"
nearest
"
, it
makes sense to set `oversampling` to ``1``. Then, each site will
makes sense to set `oversampling` to ``1``. Then, each site will
correspond to exactly one pixel.
correspond to exactly one pixel.
See Also
--------
kwant.plotter.density
"""
"""
if
not
_p
.
mpl_available
:
if
not
_p
.
mpl_available
:
...
@@ -2035,13 +2044,14 @@ def current(syst, current, relwidth=0.05, **kwargs):
...
@@ -2035,13 +2044,14 @@ def current(syst, current, relwidth=0.05, **kwargs):
current density field where the current density is non-zero only on the
current density field where the current density is non-zero only on the
straight lines that connect sites that are coupled by a hopping term.
straight lines that connect sites that are coupled by a hopping term.
To make this
vecto
r field easier to visualize and interpret at different
To make this
scala
r field easier to visualize and interpret at different
length scales, it is smoothed by convoluting it with the bell-shaped bump
length scales, it is smoothed by convoluting it with the bell-shaped bump
function ``f(r) = max(1 - (2*r / width)**2, 0)**2``. The bump width is
function ``f(r) = max(1 - (2*r / width)**2, 0)**2``. The bump width is
determined by the `relwidth` parameter.
determined by the `relwidth` parameter.
This routine samples the smoothed field on a regular (square or cubic) grid
This function is similar to `~kwant.plotter.map`, but generally gives more
and displays it using an enhanced variant of matplotlib
'
s streamplot.
appealing visual results when used on systems with many sites. If you want
site-level resolution you may be better off using `~kwant.plotter.map`.
Parameters
Parameters
----------
----------
...
@@ -2062,6 +2072,9 @@ def current(syst, current, relwidth=0.05, **kwargs):
...
@@ -2062,6 +2072,9 @@ def current(syst, current, relwidth=0.05, **kwargs):
fig : matplotlib figure
fig : matplotlib figure
A figure with the output if `ax` is not set, else None.
A figure with the output if `ax` is not set, else None.
See Also
--------
kwant.plotter.density
"""
"""
with
_common
.
reraise_warnings
(
4
):
with
_common
.
reraise_warnings
(
4
):
return
streamplot
(
*
interpolate_current
(
syst
,
current
,
relwidth
),
return
streamplot
(
*
interpolate_current
(
syst
,
current
,
relwidth
),
...
@@ -2150,6 +2163,11 @@ def density(syst, density, relwidth=0.05,
...
@@ -2150,6 +2163,11 @@ def density(syst, density, relwidth=0.05,
-------
-------
fig : matplotlib figure
fig : matplotlib figure
A figure with the output if `ax` is not set, else None.
A figure with the output if `ax` is not set, else None.
See Also
--------
kwant.plotter.current
kwant.plotter.map
"""
"""
if
not
_p
.
mpl_available
:
if
not
_p
.
mpl_available
:
raise
RuntimeError
(
"
matplotlib was not found, but is required
"
raise
RuntimeError
(
"
matplotlib was not found, but is required
"
...
...
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