Skip to content
Snippets Groups Projects
Commit 0e64bd54 authored by Kostas Vilkelis's avatar Kostas Vilkelis :flamingo:
Browse files

avoid importing from other tests

parent 48268601
No related branches found
No related tags found
1 merge request!4Interface refactoring
Pipeline #174380 failed
# %%
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
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])
# %%
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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment