Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
MeanFi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Quantum Tinkerer
MeanFi
Commits
0e64bd54
Commit
0e64bd54
authored
11 months ago
by
Kostas Vilkelis
Browse files
Options
Downloads
Patches
Plain Diff
avoid importing from other tests
parent
48268601
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!4
Interface refactoring
Pipeline
#174380
failed
11 months ago
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
codes/params/test_params.py
+17
-0
17 additions, 0 deletions
codes/params/test_params.py
codes/tb/tb.py
+7
-0
7 additions, 0 deletions
codes/tb/tb.py
codes/tb/test_tb.py
+1
-1
1 addition, 1 deletion
codes/tb/test_tb.py
with
25 additions
and
1 deletion
codes/params/test_params.py
0 → 100644
+
17
−
0
View file @
0e64bd54
# %%
from
codes.params.rparams
import
mf2rParams
,
rParams2mf
from
codes.kwant_helper.utils
import
generate_guess
from
codes.tb.tb
import
compareDicts
import
pytest
repeatNumber
=
10
# %%
ndof
=
10
vectors
=
((
0
,
0
),
(
1
,
0
),
(
-
1
,
0
),
(
0
,
1
),
(
0
,
-
1
),
(
1
,
-
1
),
(
-
1
,
1
),
(
1
,
1
),
(
-
1
,
-
1
))
@pytest.mark.repeat
(
repeatNumber
)
def
test_parametrisation
():
mf_guess
=
generate_guess
(
vectors
,
ndof
)
mf_params
=
mf2rParams
(
mf_guess
)
mf_new
=
rParams2mf
(
mf_params
,
vectors
,
ndof
)
compareDicts
(
mf_guess
,
mf_new
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
codes/tb/tb.py
+
7
−
0
View file @
0e64bd54
import
numpy
as
np
def
addTb
(
tb1
,
tb2
):
"""
Add up two tight-binding models together.
...
...
@@ -15,3 +17,8 @@ def addTb(tb1, tb2):
Sum of the two tight-binding models.
"""
return
{
k
:
tb1
.
get
(
k
,
0
)
+
tb2
.
get
(
k
,
0
)
for
k
in
frozenset
(
tb1
)
|
frozenset
(
tb2
)}
def
compareDicts
(
dict1
,
dict2
):
for
key
in
dict1
.
keys
():
assert
np
.
allclose
(
dict1
[
key
],
dict2
[
key
])
This diff is collapsed.
Click to expand it.
codes/tb/test_tb.py
+
1
−
1
View file @
0e64bd54
# %%
import
numpy
as
np
from
codes.
params.test_params
import
compareDicts
from
codes.
tb.tb
import
compareDicts
import
itertools
as
it
from
codes.tb.transforms
import
kfunc2tb
,
tb2kfunc
import
pytest
...
...
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