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
2a83c618
Commit
2a83c618
authored
7 years ago
by
Joseph Weston
Browse files
Options
Downloads
Patches
Plain Diff
refactor current interpolator test
parent
332b9d2a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
kwant/tests/test_plotter.py
+2
-22
2 additions, 22 deletions
kwant/tests/test_plotter.py
with
2 additions
and
22 deletions
kwant/tests/test_plotter.py
+
2
−
22
View file @
2a83c618
...
...
@@ -435,6 +435,8 @@ def test_current_interpolation():
y
=
ta
.
dot
(
R
(
theta
),
(
0
,
a
))
return
kwant
.
lattice
.
general
([
x
,
y
],
norbs
=
1
)
_test_border_0
(
plotter
.
interpolate_current
)
## Check current through cross section is same for different lattice
## parameters and orientations of the system wrt. the discretization grid
for
a
,
theta
,
width
in
[(
1
,
0
,
1
),
...
...
@@ -508,28 +510,6 @@ def test_current_interpolation():
# 3rd value returned from 'linregress' is 'rvalue'
assert
scipy
.
stats
.
linregress
(
np
.
log
(
data
))[
2
]
<
-
0.8
## Test that the current is always identically zero at the boundaries of the box
syst
=
kwant
.
Builder
()
lat
=
kwant
.
lattice
.
square
()
syst
[[
lat
(
0
,
0
),
lat
(
1
,
0
)]]
=
None
syst
[(
lat
(
0
,
0
),
lat
(
1
,
0
))]
=
None
syst
=
syst
.
finalized
()
current
=
[
1
,
-
1
]
ns
=
[
3
,
4
,
5
,
10
,
100
]
abswidths
=
[
0.01
,
0.1
,
1
,
10
,
100
]
relwidths
=
[
0.01
,
0.1
,
1
,
10
,
100
]
for
n
,
abswidth
in
itertools
.
product
(
ns
,
abswidths
):
field
,
_
=
kwant
.
plotter
.
interpolate_current
(
syst
,
current
,
abswidth
=
abswidth
,
n
=
n
)
assert
_border_is_0
(
field
)
for
n
,
relwidth
in
itertools
.
product
(
ns
,
relwidths
):
field
,
_
=
kwant
.
plotter
.
interpolate_current
(
syst
,
current
,
relwidth
=
relwidth
,
n
=
n
)
assert
_border_is_0
(
field
)
@pytest.mark.skipif
(
not
_plotter
.
mpl_available
,
reason
=
"
Matplotlib unavailable.
"
)
def
test_current
():
...
...
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