All checks were successful
gitea-physics/pysuperconductor/pipeline/head This commit looks good
82 lines
2.2 KiB
Python
82 lines
2.2 KiB
Python
import pysuperconductor.os_gap_calc
|
|
import numpy
|
|
import pytest
|
|
|
|
|
|
def test_gap_integrand_function():
|
|
actual = pysuperconductor.os_gap_calc.gap_integrand_function(10, 1, 5, 2)
|
|
numpy.testing.assert_almost_equal(
|
|
actual, 0.04471214382962651,
|
|
decimal=7, err_msg='gap integrand function is off', verbose=True
|
|
)
|
|
|
|
|
|
def test_gap_integrand_function_zero_temp():
|
|
actual = None
|
|
with pytest.warns(None) as record:
|
|
actual = pysuperconductor.os_gap_calc.gap_integrand_function(10, 0, 5, 2)
|
|
numpy.testing.assert_almost_equal(
|
|
actual, 0.0447213595499958,
|
|
decimal=7, err_msg='gap integrand function fails at zero temp', verbose=True
|
|
)
|
|
assert not record
|
|
|
|
|
|
def test_gap_integral():
|
|
actual = pysuperconductor.os_gap_calc.gap_integral(1, 5, 2, 10)
|
|
numpy.testing.assert_almost_equal(
|
|
actual, 1.390972295468881,
|
|
decimal=7, err_msg='gap integral is off', verbose=True
|
|
)
|
|
|
|
|
|
def test_equilibrium_gap_zero_temp():
|
|
actual = pysuperconductor.os_gap_calc.equilibrium_gap(0, 100, .2)
|
|
numpy.testing.assert_almost_equal(
|
|
actual, 1.3476505830587,
|
|
decimal=7, err_msg='gap finding at zero temp equilibrium is wrong',
|
|
verbose=True
|
|
)
|
|
|
|
|
|
def test_gap():
|
|
actual = pysuperconductor.os_gap_calc.find_gap(.5, .1, 100, .2)
|
|
numpy.testing.assert_almost_equal(
|
|
actual, 1.108996409216592,
|
|
decimal=7, err_msg='had trouble with gap at non-zero temp and mustar',
|
|
verbose=True
|
|
)
|
|
|
|
|
|
def test_n_integrand_function():
|
|
actual = pysuperconductor.os_gap_calc.n_integrand_function(1, 2, 2, 1)
|
|
numpy.testing.assert_almost_equal(
|
|
actual, 0.1038525814172795,
|
|
decimal=7, err_msg='did not find correct n integrand value',
|
|
verbose=True
|
|
)
|
|
|
|
|
|
def test_n_integral():
|
|
actual = None
|
|
with pytest.warns(None) as record:
|
|
actual = pysuperconductor.os_gap_calc.n_integral(2, 2, 1)
|
|
numpy.testing.assert_almost_equal(
|
|
actual, 0.478130649727604,
|
|
decimal=7, err_msg='did not find correct n integral value',
|
|
verbose=True
|
|
)
|
|
assert not record
|
|
|
|
|
|
def test_find_n_gap():
|
|
actual = None
|
|
with pytest.warns(None) as record:
|
|
actual = pysuperconductor.os_gap_calc.find_gap_for_n(.3, .1, 100, .2)
|
|
numpy.testing.assert_almost_equal(
|
|
actual[0], 1.0296692197710933,
|
|
decimal=7, err_msg="did not find correct delta",
|
|
verbose=True
|
|
)
|
|
assert not record
|