feat!: Renames to pyewjn
All checks were successful
gitea-physics/pyewjn/pipeline/head This commit looks good
All checks were successful
gitea-physics/pyewjn/pipeline/head This commit looks good
This commit is contained in:
8
Jenkinsfile
vendored
8
Jenkinsfile
vendored
@@ -1,7 +1,7 @@
|
|||||||
pipeline {
|
pipeline {
|
||||||
agent {
|
agent {
|
||||||
kubernetes {
|
kubernetes {
|
||||||
label 'pynam' // all your pods will be named with this prefix, followed by a unique id
|
label 'pyewjn' // all your pods will be named with this prefix, followed by a unique id
|
||||||
idleMinutes 5 // how long the pod will live after no jobs have run on it
|
idleMinutes 5 // how long the pod will live after no jobs have run on it
|
||||||
yamlFile 'jenkins/ci-agent-pod.yaml' // path to the pod definition relative to the root of our project
|
yamlFile 'jenkins/ci-agent-pod.yaml' // path to the pod definition relative to the root of our project
|
||||||
defaultContainer 'poetry' // define a default container if more than a few stages use it, will default to jnlp container
|
defaultContainer 'poetry' // define a default container if more than a few stages use it, will default to jnlp container
|
||||||
@@ -30,12 +30,12 @@ pipeline {
|
|||||||
}
|
}
|
||||||
stage('lint') {
|
stage('lint') {
|
||||||
steps {
|
steps {
|
||||||
sh 'poetry run flake8 pynam tests'
|
sh 'poetry run flake8 pyewjn tests'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('mypy') {
|
stage('mypy') {
|
||||||
steps {
|
steps {
|
||||||
sh 'poetry run mypy pynam'
|
sh 'poetry run mypy pyewjn'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -43,7 +43,7 @@ pipeline {
|
|||||||
|
|
||||||
stage('Deploy') {
|
stage('Deploy') {
|
||||||
environment {
|
environment {
|
||||||
PYPI=credentials("pypi-pynam")
|
PYPI=credentials("pypi-pyewjn")
|
||||||
}
|
}
|
||||||
|
|
||||||
when {
|
when {
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
# pynam
|
# pyewjn
|
||||||
|
|
||||||
python port of `nam_analysis`
|
python port of `nam_analysis`
|
||||||
|
|||||||
4
do.sh
4
do.sh
@@ -16,8 +16,8 @@ fmt() {
|
|||||||
|
|
||||||
test() {
|
test() {
|
||||||
echo "I am ${FUNCNAME[0]}ing"
|
echo "I am ${FUNCNAME[0]}ing"
|
||||||
poetry run flake8 pynam tests
|
poetry run flake8 pyewjn tests
|
||||||
poetry run mypy pynam
|
poetry run mypy pyewjn
|
||||||
poetry run pytest
|
poetry run pytest
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
4
pyewjn/dielectric/__init__.py
Normal file
4
pyewjn/dielectric/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
from pyewjn.dielectric.nam_dielectric_coefficient_approximator import get_nam_dielectric
|
||||||
|
from pyewjn.dielectric.lindhard_dielectric import get_lindhard_dielectric
|
||||||
|
|
||||||
|
__all__ = ["get_nam_dielectric", "get_lindhard_dielectric"]
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
from pynam.baskets import CalculationConstants, CalculationParams
|
from pyewjn.baskets import CalculationConstants, CalculationParams
|
||||||
|
|
||||||
LINDHARD_SERIES_THRESHOLD = 1e4
|
LINDHARD_SERIES_THRESHOLD = 1e4
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
from numpy.lib.scimath import sqrt as csqrt
|
from numpy.lib.scimath import sqrt as csqrt
|
||||||
|
|
||||||
import pynam.util
|
import pyewjn.util
|
||||||
|
|
||||||
|
|
||||||
def g(w, wp):
|
def g(w, wp):
|
||||||
@@ -35,7 +35,7 @@ def i2(w, wp, k, v):
|
|||||||
|
|
||||||
|
|
||||||
def a(w, k, v, t):
|
def a(w, k, v, t):
|
||||||
return pynam.util.complex_quad(
|
return pyewjn.util.complex_quad(
|
||||||
lambda wp: np.tanh((w + wp) / (2 * t)) * (i1(w, wp, k, v)), 1 - w, 1
|
lambda wp: np.tanh((w + wp) / (2 * t)) * (i1(w, wp, k, v)), 1 - w, 1
|
||||||
)[0]
|
)[0]
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ def b_int(wp, w, k, v, t):
|
|||||||
|
|
||||||
|
|
||||||
def b(w, k, v, t, b_max=np.inf):
|
def b(w, k, v, t, b_max=np.inf):
|
||||||
return pynam.util.complex_quad(lambda wp: b_int(wp, w, k, v, t), 1, b_max)[0]
|
return pyewjn.util.complex_quad(lambda wp: b_int(wp, w, k, v, t), 1, b_max)[0]
|
||||||
|
|
||||||
|
|
||||||
def sigma_nam_alk(w, k, v, t):
|
def sigma_nam_alk(w, k, v, t):
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
import pynam.dielectric.sigma_nam
|
import pyewjn.dielectric.sigma_nam
|
||||||
import pynam.dielectric.low_k_nam
|
import pyewjn.dielectric.low_k_nam
|
||||||
|
|
||||||
from pynam.baskets import CalculationParams, CalculationConstants
|
from pyewjn.baskets import CalculationParams, CalculationConstants
|
||||||
|
|
||||||
from typing import Tuple
|
from typing import Tuple
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ def get_small_momentum_coefficients(
|
|||||||
dedim_params: DedimensionalisedParameters,
|
dedim_params: DedimensionalisedParameters,
|
||||||
) -> Tuple[float, float]:
|
) -> Tuple[float, float]:
|
||||||
prefactor = 4j * np.pi * dedim_params.b
|
prefactor = 4j * np.pi * dedim_params.b
|
||||||
s = pynam.dielectric.low_k_nam.sigma_nam_alk(
|
s = pyewjn.dielectric.low_k_nam.sigma_nam_alk(
|
||||||
dedim_params.xi, 0, dedim_params.nu, dedim_params.t
|
dedim_params.xi, 0, dedim_params.nu, dedim_params.t
|
||||||
)
|
)
|
||||||
conductivity = prefactor * s
|
conductivity = prefactor * s
|
||||||
@@ -81,7 +81,7 @@ def get_big_momentum_coefficients(
|
|||||||
dedim_params: DedimensionalisedParameters,
|
dedim_params: DedimensionalisedParameters,
|
||||||
) -> Tuple[float, float]:
|
) -> Tuple[float, float]:
|
||||||
prefactor = 4j * np.pi * dedim_params.b * FIXED_LARGE_MOMENTUM / dedim_params.a
|
prefactor = 4j * np.pi * dedim_params.b * FIXED_LARGE_MOMENTUM / dedim_params.a
|
||||||
s = pynam.dielectric.sigma_nam.sigma_nam(
|
s = pyewjn.dielectric.sigma_nam.sigma_nam(
|
||||||
dedim_params.xi, FIXED_LARGE_MOMENTUM, dedim_params.nu, dedim_params.t
|
dedim_params.xi, FIXED_LARGE_MOMENTUM, dedim_params.nu, dedim_params.t
|
||||||
)
|
)
|
||||||
conductivity = prefactor * s
|
conductivity = prefactor * s
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
from numpy.lib.scimath import sqrt as csqrt
|
from numpy.lib.scimath import sqrt as csqrt
|
||||||
|
|
||||||
import pynam.util
|
import pyewjn.util
|
||||||
|
|
||||||
|
|
||||||
def g(w, wp):
|
def g(w, wp):
|
||||||
@@ -41,7 +41,7 @@ def i2(w, wp, k, v):
|
|||||||
|
|
||||||
|
|
||||||
def a(w, k, v, t):
|
def a(w, k, v, t):
|
||||||
result = pynam.util.complex_quad(
|
result = pyewjn.util.complex_quad(
|
||||||
lambda wp: np.tanh((w + wp) / (2 * t)) * (i1(w, wp, k, v)),
|
lambda wp: np.tanh((w + wp) / (2 * t)) * (i1(w, wp, k, v)),
|
||||||
1 - w,
|
1 - w,
|
||||||
1,
|
1,
|
||||||
@@ -58,7 +58,7 @@ def b_int(wp, w, k, v, t):
|
|||||||
|
|
||||||
|
|
||||||
def b(w, k, v, t, b_max=np.inf):
|
def b(w, k, v, t, b_max=np.inf):
|
||||||
return pynam.util.complex_quad(lambda wp: b_int(wp, w, k, v, t), 1, b_max)[0]
|
return pyewjn.util.complex_quad(lambda wp: b_int(wp, w, k, v, t), 1, b_max)[0]
|
||||||
|
|
||||||
|
|
||||||
def sigma_nam(w, k, v, t):
|
def sigma_nam(w, k, v, t):
|
||||||
@@ -3,11 +3,11 @@ from typing import Callable
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
import scipy.integrate
|
import scipy.integrate
|
||||||
|
|
||||||
import pynam.noise.im_ref
|
import pyewjn.noise.im_ref
|
||||||
|
|
||||||
|
|
||||||
def get_chi_zz_e(eps: Callable[[float], complex]) -> Callable[[float], float]:
|
def get_chi_zz_e(eps: Callable[[float], complex]) -> Callable[[float], float]:
|
||||||
im_ref_p = pynam.noise.im_ref.get_im_ref_p(eps)
|
im_ref_p = pyewjn.noise.im_ref.get_im_ref_p(eps)
|
||||||
|
|
||||||
def chi_zz_e(z: float) -> float:
|
def chi_zz_e(z: float) -> float:
|
||||||
def integrand(y: float) -> float:
|
def integrand(y: float) -> float:
|
||||||
@@ -2,11 +2,11 @@ from typing import Callable
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
import pynam.noise.zeta
|
import pyewjn.noise.zeta
|
||||||
|
|
||||||
|
|
||||||
def get_im_ref_p(eps: Callable[[float], complex]) -> Callable[[float], float]:
|
def get_im_ref_p(eps: Callable[[float], complex]) -> Callable[[float], float]:
|
||||||
zeta_p = pynam.noise.zeta.get_zeta_p_function(eps)
|
zeta_p = pyewjn.noise.zeta.get_zeta_p_function(eps)
|
||||||
|
|
||||||
def im_ref_p(u: float) -> float:
|
def im_ref_p(u: float) -> float:
|
||||||
zeta_p_val = zeta_p(u)
|
zeta_p_val = zeta_p(u)
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import pynam.util
|
import pyewjn.util
|
||||||
|
|
||||||
from typing import Callable
|
from typing import Callable
|
||||||
import numpy as np
|
import numpy as np
|
||||||
@@ -64,16 +64,16 @@ def get_zeta_p_function(eps: Callable[[float], complex]):
|
|||||||
def zeta_p(u: float) -> complex:
|
def zeta_p(u: float) -> complex:
|
||||||
# zeta_p_integrand = get_zeta_p_integrand(eps)
|
# zeta_p_integrand = get_zeta_p_integrand(eps)
|
||||||
|
|
||||||
i1_small = pynam.util.complex_quad(
|
i1_small = pyewjn.util.complex_quad(
|
||||||
lambda x: integrand1_small_x(x, u), 0, SMALL_X_BOUNDARY, epsabs=1e-12
|
lambda x: integrand1_small_x(x, u), 0, SMALL_X_BOUNDARY, epsabs=1e-12
|
||||||
)
|
)
|
||||||
i1_big = pynam.util.complex_quad(
|
i1_big = pyewjn.util.complex_quad(
|
||||||
lambda x: integrand1_big_x(x, u), SMALL_X_BOUNDARY, np.inf, epsabs=1e-12
|
lambda x: integrand1_big_x(x, u), SMALL_X_BOUNDARY, np.inf, epsabs=1e-12
|
||||||
)
|
)
|
||||||
i2_small = pynam.util.complex_quad(
|
i2_small = pyewjn.util.complex_quad(
|
||||||
lambda x: integrand2_small_x(x, u), 0, SMALL_X_BOUNDARY, epsabs=1e-12
|
lambda x: integrand2_small_x(x, u), 0, SMALL_X_BOUNDARY, epsabs=1e-12
|
||||||
)
|
)
|
||||||
i2_big = pynam.util.complex_quad(
|
i2_big = pyewjn.util.complex_quad(
|
||||||
lambda x: integrand2_big_x(x, u), SMALL_X_BOUNDARY, np.inf, epsabs=1e-12
|
lambda x: integrand2_big_x(x, u), SMALL_X_BOUNDARY, np.inf, epsabs=1e-12
|
||||||
)
|
)
|
||||||
|
|
||||||
3
pyewjn/util/__init__.py
Normal file
3
pyewjn/util/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
from pyewjn.util.complex_integrate import complex_quad, complex_quadrature
|
||||||
|
|
||||||
|
__all__ = ["complex_quad", "complex_quadrature"]
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
from pynam.dielectric.nam_dielectric_coefficient_approximator import get_nam_dielectric
|
|
||||||
from pynam.dielectric.lindhard_dielectric import get_lindhard_dielectric
|
|
||||||
|
|
||||||
__all__ = ["get_nam_dielectric", "get_lindhard_dielectric"]
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
from pynam.util.complex_integrate import complex_quad, complex_quadrature
|
|
||||||
|
|
||||||
__all__ = ["complex_quad", "complex_quadrature"]
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "pynam"
|
name = "pyewjn"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
description = ""
|
description = ""
|
||||||
authors = ["Deepak <dmallubhotla+github@gmail.com>"]
|
authors = ["Deepak <dmallubhotla+github@gmail.com>"]
|
||||||
@@ -23,7 +23,7 @@ build-backend = "poetry.masonry.api"
|
|||||||
|
|
||||||
[tool.pytest.ini_options]
|
[tool.pytest.ini_options]
|
||||||
testpaths = ["tests"]
|
testpaths = ["tests"]
|
||||||
addopts = "--junitxml pytest.xml --cov pynam --cov-report=xml:coverage.xml --cov-fail-under=50 --cov-report=html"
|
addopts = "--junitxml pytest.xml --cov pyewjn --cov-report=xml:coverage.xml --cov-fail-under=50 --cov-report=html"
|
||||||
junit_family = "xunit1"
|
junit_family = "xunit1"
|
||||||
|
|
||||||
[tool.mypy]
|
[tool.mypy]
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import pynam.dielectric
|
import pyewjn.dielectric
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pytest
|
import pytest
|
||||||
from pynam.baskets import CalculationParams
|
from pyewjn.baskets import CalculationParams
|
||||||
|
|
||||||
|
|
||||||
def get_common_lindhard_dielectric():
|
def get_common_lindhard_dielectric():
|
||||||
params = CalculationParams(omega=1e9, omega_p=3.5e15, tau=1e-14, v_f=2e6)
|
params = CalculationParams(omega=1e9, omega_p=3.5e15, tau=1e-14, v_f=2e6)
|
||||||
return pynam.dielectric.get_lindhard_dielectric(params)
|
return pyewjn.dielectric.get_lindhard_dielectric(params)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
@@ -52,4 +52,4 @@ def zeta_p_i_epsilon():
|
|||||||
params = CalculationParams(
|
params = CalculationParams(
|
||||||
omega=1e9, omega_p=3.544907701811032e15, tau=1e-14, v_f=2e6
|
omega=1e9, omega_p=3.544907701811032e15, tau=1e-14, v_f=2e6
|
||||||
)
|
)
|
||||||
return pynam.dielectric.get_lindhard_dielectric(params)
|
return pyewjn.dielectric.get_lindhard_dielectric(params)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import pynam.dielectric.low_k_nam
|
import pyewjn.dielectric.low_k_nam
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
@@ -9,7 +9,7 @@ import pytest
|
|||||||
)
|
)
|
||||||
def test_g(test_input, expected):
|
def test_g(test_input, expected):
|
||||||
np.testing.assert_almost_equal(
|
np.testing.assert_almost_equal(
|
||||||
pynam.dielectric.low_k_nam.g(*test_input),
|
pyewjn.dielectric.low_k_nam.g(*test_input),
|
||||||
expected,
|
expected,
|
||||||
decimal=7,
|
decimal=7,
|
||||||
err_msg="g function is off",
|
err_msg="g function is off",
|
||||||
@@ -22,7 +22,7 @@ def test_g(test_input, expected):
|
|||||||
)
|
)
|
||||||
def test_f(test_input, expected):
|
def test_f(test_input, expected):
|
||||||
np.testing.assert_almost_equal(
|
np.testing.assert_almost_equal(
|
||||||
pynam.dielectric.low_k_nam.f(*test_input),
|
pyewjn.dielectric.low_k_nam.f(*test_input),
|
||||||
expected,
|
expected,
|
||||||
decimal=7,
|
decimal=7,
|
||||||
err_msg="f function is off",
|
err_msg="f function is off",
|
||||||
@@ -35,7 +35,7 @@ def test_f(test_input, expected):
|
|||||||
)
|
)
|
||||||
def test_i1(test_input, expected):
|
def test_i1(test_input, expected):
|
||||||
np.testing.assert_almost_equal(
|
np.testing.assert_almost_equal(
|
||||||
pynam.dielectric.low_k_nam.i1(*test_input),
|
pyewjn.dielectric.low_k_nam.i1(*test_input),
|
||||||
expected,
|
expected,
|
||||||
decimal=7,
|
decimal=7,
|
||||||
err_msg="i1 function is off",
|
err_msg="i1 function is off",
|
||||||
@@ -48,7 +48,7 @@ def test_i1(test_input, expected):
|
|||||||
)
|
)
|
||||||
def test_i2(test_input, expected):
|
def test_i2(test_input, expected):
|
||||||
np.testing.assert_almost_equal(
|
np.testing.assert_almost_equal(
|
||||||
pynam.dielectric.low_k_nam.i2(*test_input),
|
pyewjn.dielectric.low_k_nam.i2(*test_input),
|
||||||
expected,
|
expected,
|
||||||
decimal=7,
|
decimal=7,
|
||||||
err_msg="i1 function is off",
|
err_msg="i1 function is off",
|
||||||
@@ -62,7 +62,7 @@ def test_i2(test_input, expected):
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_a(test_input, expected):
|
def test_a(test_input, expected):
|
||||||
actual = np.real_if_close(pynam.dielectric.low_k_nam.a(*test_input))
|
actual = np.real_if_close(pyewjn.dielectric.low_k_nam.a(*test_input))
|
||||||
np.testing.assert_almost_equal(
|
np.testing.assert_almost_equal(
|
||||||
actual, expected, decimal=6, err_msg="a function is off"
|
actual, expected, decimal=6, err_msg="a function is off"
|
||||||
)
|
)
|
||||||
@@ -76,7 +76,7 @@ def test_a(test_input, expected):
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_b_int(test_input, expected):
|
def test_b_int(test_input, expected):
|
||||||
actual = np.real_if_close(pynam.dielectric.low_k_nam.b_int(*test_input))
|
actual = np.real_if_close(pyewjn.dielectric.low_k_nam.b_int(*test_input))
|
||||||
np.testing.assert_almost_equal(
|
np.testing.assert_almost_equal(
|
||||||
actual, expected, decimal=6, err_msg="b int function is off"
|
actual, expected, decimal=6, err_msg="b int function is off"
|
||||||
)
|
)
|
||||||
@@ -90,7 +90,7 @@ def test_b_int(test_input, expected):
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_b(test_input, expected):
|
def test_b(test_input, expected):
|
||||||
actual = np.real_if_close(pynam.dielectric.low_k_nam.b(*test_input))
|
actual = np.real_if_close(pyewjn.dielectric.low_k_nam.b(*test_input))
|
||||||
np.testing.assert_almost_equal(
|
np.testing.assert_almost_equal(
|
||||||
actual, expected, decimal=6, err_msg="b function is off"
|
actual, expected, decimal=6, err_msg="b function is off"
|
||||||
)
|
)
|
||||||
@@ -104,14 +104,14 @@ def test_b(test_input, expected):
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_sigma_alk(test_input, expected):
|
def test_sigma_alk(test_input, expected):
|
||||||
actual = np.real_if_close(pynam.dielectric.low_k_nam.sigma_nam_alk(*test_input))
|
actual = np.real_if_close(pyewjn.dielectric.low_k_nam.sigma_nam_alk(*test_input))
|
||||||
np.testing.assert_almost_equal(
|
np.testing.assert_almost_equal(
|
||||||
actual, expected, decimal=6, err_msg="b function is off"
|
actual, expected, decimal=6, err_msg="b function is off"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_sigma_alk_benchmark(benchmark):
|
def test_sigma_alk_benchmark(benchmark):
|
||||||
result = benchmark(pynam.dielectric.low_k_nam.sigma_nam_alk, 1, 2, 3, 4)
|
result = benchmark(pyewjn.dielectric.low_k_nam.sigma_nam_alk, 1, 2, 3, 4)
|
||||||
np.testing.assert_almost_equal(
|
np.testing.assert_almost_equal(
|
||||||
result, 0.98358 + 0.648221j, decimal=6, err_msg="b function is off"
|
result, 0.98358 + 0.648221j, decimal=6, err_msg="b function is off"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import pytest
|
import pytest
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pynam.dielectric.nam_dielectric_coefficient_approximator
|
import pyewjn.dielectric.nam_dielectric_coefficient_approximator
|
||||||
from pynam.baskets import CalculationParams
|
from pyewjn.baskets import CalculationParams
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
@@ -24,7 +24,7 @@ from pynam.baskets import CalculationParams
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_dedimensionalise_parameters(test_input, expected):
|
def test_dedimensionalise_parameters(test_input, expected):
|
||||||
actual_parameters = pynam.dielectric.nam_dielectric_coefficient_approximator.get_dedimensionalised_parameters(
|
actual_parameters = pyewjn.dielectric.nam_dielectric_coefficient_approximator.get_dedimensionalised_parameters(
|
||||||
*test_input
|
*test_input
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ def test_dedimensionalise_parameters(test_input, expected):
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_nam_coefficients(test_input, expected):
|
def test_nam_coefficients(test_input, expected):
|
||||||
actual_coefficients = pynam.dielectric.nam_dielectric_coefficient_approximator.get_nam_dielectric_coefficients(
|
actual_coefficients = pyewjn.dielectric.nam_dielectric_coefficient_approximator.get_nam_dielectric_coefficients(
|
||||||
*test_input
|
*test_input
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ def test_nam_coefficients(test_input, expected):
|
|||||||
def test_nam_eps():
|
def test_nam_eps():
|
||||||
u_c = 1e15
|
u_c = 1e15
|
||||||
eps_to_test = (
|
eps_to_test = (
|
||||||
pynam.dielectric.nam_dielectric_coefficient_approximator.get_nam_dielectric(
|
pyewjn.dielectric.nam_dielectric_coefficient_approximator.get_nam_dielectric(
|
||||||
u_c,
|
u_c,
|
||||||
CalculationParams(
|
CalculationParams(
|
||||||
omega=1e9, omega_p=3.54491e15, tau=1e-14, v_f=2e6, t_rel=0.8, t_c=1e11
|
omega=1e9, omega_p=3.54491e15, tau=1e-14, v_f=2e6, t_rel=0.8, t_c=1e11
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import pynam.dielectric.sigma_nam
|
import pyewjn.dielectric.sigma_nam
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
@@ -9,7 +9,7 @@ import pytest
|
|||||||
)
|
)
|
||||||
def test_g(test_input, expected):
|
def test_g(test_input, expected):
|
||||||
np.testing.assert_almost_equal(
|
np.testing.assert_almost_equal(
|
||||||
pynam.dielectric.sigma_nam.g(*test_input),
|
pyewjn.dielectric.sigma_nam.g(*test_input),
|
||||||
expected,
|
expected,
|
||||||
decimal=7,
|
decimal=7,
|
||||||
err_msg="g function is off",
|
err_msg="g function is off",
|
||||||
@@ -21,7 +21,7 @@ def test_g(test_input, expected):
|
|||||||
)
|
)
|
||||||
def test_s(test_input, expected):
|
def test_s(test_input, expected):
|
||||||
np.testing.assert_almost_equal(
|
np.testing.assert_almost_equal(
|
||||||
pynam.dielectric.sigma_nam.s(*test_input),
|
pyewjn.dielectric.sigma_nam.s(*test_input),
|
||||||
expected,
|
expected,
|
||||||
decimal=7,
|
decimal=7,
|
||||||
err_msg="s function is off",
|
err_msg="s function is off",
|
||||||
@@ -41,7 +41,7 @@ def test_s(test_input, expected):
|
|||||||
)
|
)
|
||||||
def test_f(test_input, expected):
|
def test_f(test_input, expected):
|
||||||
np.testing.assert_almost_equal(
|
np.testing.assert_almost_equal(
|
||||||
pynam.dielectric.sigma_nam.f(*test_input),
|
pyewjn.dielectric.sigma_nam.f(*test_input),
|
||||||
expected,
|
expected,
|
||||||
decimal=7,
|
decimal=7,
|
||||||
err_msg="f function is off",
|
err_msg="f function is off",
|
||||||
@@ -62,7 +62,7 @@ def test_f(test_input, expected):
|
|||||||
)
|
)
|
||||||
def test_i1(test_input, expected):
|
def test_i1(test_input, expected):
|
||||||
np.testing.assert_almost_equal(
|
np.testing.assert_almost_equal(
|
||||||
pynam.dielectric.sigma_nam.i1(*test_input),
|
pyewjn.dielectric.sigma_nam.i1(*test_input),
|
||||||
expected,
|
expected,
|
||||||
decimal=7,
|
decimal=7,
|
||||||
err_msg="i1 function is off",
|
err_msg="i1 function is off",
|
||||||
@@ -83,7 +83,7 @@ def test_i1(test_input, expected):
|
|||||||
)
|
)
|
||||||
def test_i2(test_input, expected):
|
def test_i2(test_input, expected):
|
||||||
np.testing.assert_almost_equal(
|
np.testing.assert_almost_equal(
|
||||||
pynam.dielectric.sigma_nam.i2(*test_input),
|
pyewjn.dielectric.sigma_nam.i2(*test_input),
|
||||||
expected,
|
expected,
|
||||||
decimal=7,
|
decimal=7,
|
||||||
err_msg="i1 function is off",
|
err_msg="i1 function is off",
|
||||||
@@ -101,7 +101,7 @@ def test_i2(test_input, expected):
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_a(test_input, expected):
|
def test_a(test_input, expected):
|
||||||
actual = np.real_if_close(pynam.dielectric.sigma_nam.a(*test_input))
|
actual = np.real_if_close(pyewjn.dielectric.sigma_nam.a(*test_input))
|
||||||
np.testing.assert_allclose(actual, expected, rtol=1e-5, err_msg="a function is off")
|
np.testing.assert_allclose(actual, expected, rtol=1e-5, err_msg="a function is off")
|
||||||
|
|
||||||
|
|
||||||
@@ -117,7 +117,7 @@ def test_a(test_input, expected):
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_b_int(test_input, expected):
|
def test_b_int(test_input, expected):
|
||||||
actual = np.real_if_close(pynam.dielectric.sigma_nam.b_int(*test_input))
|
actual = np.real_if_close(pyewjn.dielectric.sigma_nam.b_int(*test_input))
|
||||||
np.testing.assert_almost_equal(
|
np.testing.assert_almost_equal(
|
||||||
actual, expected, decimal=6, err_msg="b int function is off"
|
actual, expected, decimal=6, err_msg="b int function is off"
|
||||||
)
|
)
|
||||||
@@ -131,7 +131,7 @@ def test_b_int(test_input, expected):
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_b(test_input, expected):
|
def test_b(test_input, expected):
|
||||||
actual = np.real_if_close(pynam.dielectric.sigma_nam.b(*test_input))
|
actual = np.real_if_close(pyewjn.dielectric.sigma_nam.b(*test_input))
|
||||||
np.testing.assert_almost_equal(
|
np.testing.assert_almost_equal(
|
||||||
actual, expected, decimal=6, err_msg="b function is off"
|
actual, expected, decimal=6, err_msg="b function is off"
|
||||||
)
|
)
|
||||||
@@ -149,14 +149,14 @@ def test_b(test_input, expected):
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_sigma_nam(test_input, expected):
|
def test_sigma_nam(test_input, expected):
|
||||||
actual = np.real_if_close(pynam.dielectric.sigma_nam.sigma_nam(*test_input))
|
actual = np.real_if_close(pyewjn.dielectric.sigma_nam.sigma_nam(*test_input))
|
||||||
np.testing.assert_allclose(
|
np.testing.assert_allclose(
|
||||||
actual, expected, rtol=1e-3, err_msg="sigma_nam function is off"
|
actual, expected, rtol=1e-3, err_msg="sigma_nam function is off"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_sigma_nam_benchmark(benchmark):
|
def test_sigma_nam_benchmark(benchmark):
|
||||||
result = benchmark(pynam.dielectric.sigma_nam.sigma_nam, 1, 2, 3, 4)
|
result = benchmark(pyewjn.dielectric.sigma_nam.sigma_nam, 1, 2, 3, 4)
|
||||||
np.testing.assert_almost_equal(
|
np.testing.assert_almost_equal(
|
||||||
result,
|
result,
|
||||||
0.984117 + 0.647951j,
|
0.984117 + 0.647951j,
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import pynam.dielectric
|
import pyewjn.dielectric
|
||||||
import pynam.noise.chi
|
import pyewjn.noise.chi
|
||||||
from pynam.baskets import CalculationParams
|
from pyewjn.baskets import CalculationParams
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
@@ -11,8 +11,8 @@ def chi_zz_e_lindhard():
|
|||||||
params = CalculationParams(
|
params = CalculationParams(
|
||||||
omega=1e9, v_f=2e6, omega_p=3.544907701811032e15, tau=1e-14
|
omega=1e9, v_f=2e6, omega_p=3.544907701811032e15, tau=1e-14
|
||||||
)
|
)
|
||||||
eps_l = pynam.dielectric.get_lindhard_dielectric(params)
|
eps_l = pyewjn.dielectric.get_lindhard_dielectric(params)
|
||||||
return pynam.noise.chi.get_chi_zz_e(eps_l)
|
return pyewjn.noise.chi.get_chi_zz_e(eps_l)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import pynam.dielectric
|
import pyewjn.dielectric
|
||||||
import pynam.noise.im_ref
|
import pyewjn.noise.im_ref
|
||||||
from pynam.baskets import CalculationParams
|
from pyewjn.baskets import CalculationParams
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
@@ -11,8 +11,8 @@ def im_ref_p_lindhard():
|
|||||||
params = CalculationParams(
|
params = CalculationParams(
|
||||||
omega=1e9, v_f=2e6, omega_p=3.544907701811032e15, tau=1e-14
|
omega=1e9, v_f=2e6, omega_p=3.544907701811032e15, tau=1e-14
|
||||||
)
|
)
|
||||||
eps_l = pynam.dielectric.get_lindhard_dielectric(params)
|
eps_l = pyewjn.dielectric.get_lindhard_dielectric(params)
|
||||||
return pynam.noise.im_ref.get_im_ref_p(eps_l)
|
return pyewjn.noise.im_ref.get_im_ref_p(eps_l)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import pynam.dielectric
|
import pyewjn.dielectric
|
||||||
import pynam.noise.zeta
|
import pyewjn.noise.zeta
|
||||||
from pynam.baskets import CalculationParams
|
from pyewjn.baskets import CalculationParams
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
@@ -11,8 +11,8 @@ def zeta_p_integrand_lindhard():
|
|||||||
params = CalculationParams(
|
params = CalculationParams(
|
||||||
omega=1e9, v_f=2e6, omega_p=3.544907701811032e15, tau=1e-14
|
omega=1e9, v_f=2e6, omega_p=3.544907701811032e15, tau=1e-14
|
||||||
)
|
)
|
||||||
eps_l = pynam.dielectric.get_lindhard_dielectric(params)
|
eps_l = pyewjn.dielectric.get_lindhard_dielectric(params)
|
||||||
return pynam.noise.zeta.get_zeta_p_integrand(eps_l)
|
return pyewjn.noise.zeta.get_zeta_p_integrand(eps_l)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
@@ -41,8 +41,8 @@ def zeta_p_lindhard():
|
|||||||
params = CalculationParams(
|
params = CalculationParams(
|
||||||
omega=1e9, v_f=2e6, omega_p=3.544907701811032e15, tau=1e-14
|
omega=1e9, v_f=2e6, omega_p=3.544907701811032e15, tau=1e-14
|
||||||
)
|
)
|
||||||
eps_l = pynam.dielectric.get_lindhard_dielectric(params)
|
eps_l = pyewjn.dielectric.get_lindhard_dielectric(params)
|
||||||
return pynam.noise.zeta.get_zeta_p_function(eps_l)
|
return pyewjn.noise.zeta.get_zeta_p_function(eps_l)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from pynam import __version__
|
from pyewjn import __version__
|
||||||
|
|
||||||
|
|
||||||
def test_version():
|
def test_version():
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
import pynam.util.complex_integrate
|
import pyewjn.util.complex_integrate
|
||||||
|
|
||||||
|
|
||||||
def test_complex_quad():
|
def test_complex_quad():
|
||||||
actual = pynam.util.complex_integrate.complex_quad(
|
actual = pyewjn.util.complex_integrate.complex_quad(
|
||||||
lambda x: x**2 + 1j * x**3, 0, 6
|
lambda x: x**2 + 1j * x**3, 0, 6
|
||||||
)[0]
|
)[0]
|
||||||
# int_1^6 dx x^2 + i x^3 should equal (1/3)6^3 + (i/4)6^4
|
# int_1^6 dx x^2 + i x^3 should equal (1/3)6^3 + (i/4)6^4
|
||||||
@@ -17,7 +17,7 @@ def test_complex_quad():
|
|||||||
|
|
||||||
|
|
||||||
def test_complex_quadrature():
|
def test_complex_quadrature():
|
||||||
actual = pynam.util.complex_integrate.complex_quadrature(
|
actual = pyewjn.util.complex_integrate.complex_quadrature(
|
||||||
lambda x: x**2 + 1j * x**3, 0, 6
|
lambda x: x**2 + 1j * x**3, 0, 6
|
||||||
)[0]
|
)[0]
|
||||||
# int_1^6 dx x^2 + i x^3 should equal (1/3)6^3 + (i/4)6^4
|
# int_1^6 dx x^2 + i x^3 should equal (1/3)6^3 + (i/4)6^4
|
||||||
|
|||||||
Reference in New Issue
Block a user