import numpy as np import pytest import pyewjn.dielectric import pyewjn.noise.chi from pyewjn.baskets import CalculationParams cutoff_to_use = 5.4596e9 TOO_SLOW_REASON = "These tests are too slow and pretty unhelpful" @pytest.mark.skip(reason=TOO_SLOW_REASON) @pytest.fixture def chi_zz_e_nam_unapproximated(): params = CalculationParams( omega=1e9, v_f=2e6, omega_p=3.544907701811032e15, tau=1e-14, t_rel=0.99999 ) eps_l = pyewjn.dielectric.get_unapproximated_nam_dielectric(cutoff_to_use, params) return pyewjn.noise.chi.get_chi_zz_e(eps_l) @pytest.mark.skip(reason=TOO_SLOW_REASON) @pytest.mark.parametrize( "test_input,expected", [ # z chi_zz_e_nam_unapproximated(z) (1e-5, 4.07695673649665e6), (1e-6, 4.095895777068543e9), # (1e-7, 5.012885033150058e12), commenting this one out because it seems numerically too unstable # (1e-8, 1.441261982619894e16), commenting this one out because it seems numerically too unstable ], ) def test_chi_zz_e_nam_unapproximated(chi_zz_e_nam_unapproximated, test_input, expected): actual = chi_zz_e_nam_unapproximated(test_input) np.testing.assert_allclose( actual, expected, rtol=0.05, err_msg="chi_zz_e is inaccurate for nam_unapproximated case", verbose=True, ) @pytest.mark.skip(reason=TOO_SLOW_REASON) @pytest.mark.parametrize( "test_input,expected", [ # z chi_zz_e_nam_unapproximated(z) (1e-6, 4.095895777068543e9), ], ) def test_chi_zz_e_nam_unapproximated_benchmark( benchmark, chi_zz_e_nam_unapproximated, test_input, expected ): actual = benchmark(chi_zz_e_nam_unapproximated, test_input) np.testing.assert_allclose( actual, expected, rtol=0.05, err_msg="chi_zz_e is inaccurate for nam_unapproximated case", verbose=True, )