Separate release test workflows for PyPI and Conda-forge #1318
5 fail, 6 skipped, 1 055 pass in 1h 27m 41s
33 files 33 suites 1h 27m 41s ⏱️
1 066 tests 1 055 ✅ 6 💤 5 ❌
34 573 runs 34 371 ✅ 187 💤 15 ❌
Results for commit c13c818.
Annotations
github-actions / Test Results
3 out of 33 runs failed: test_calculate_qpoint_phonon_modes_from_phonopy[False-0-fc_kwargs0-NaCl-all_args0-NaCl_reciprocal_qpoi…non_modes.json] (euphonic_test.test_force_constants_calculate_qpoint_phonon_modes.TestForceConstantsCalculateQPointPhononModes)
artifacts/Unit test results windows-latest 3.10/junit_report_1734558617.xml [took 1s]
artifacts/Unit test results windows-latest 3.11/junit_report_1734558604.xml [took 1s]
artifacts/Unit test results windows-latest 3.12/junit_report_1734558626.xml [took 1s]
Raw output
AssertionError
self = <tests_and_analysis.test.euphonic_test.test_force_constants_calculate_qpoint_phonon_modes.TestForceConstantsCalculateQPointPhononModes object at 0x000001AAD828A9B0>
fc_kwargs = {'path': 'D:\\a\\Euphonic\\Euphonic\\tests_and_analysis\\test\\data\\phonopy_files\\NaCl', 'summary_name': 'phonopy_nacl.yaml'}
material = 'NaCl'
all_args = [array([[ 0. , 0. , 0. ],
[ 0. , 0. , 0.5 ],
[-0.25 , 0.5 , 0.... , 0.5 ],
[ 1.75 , 0.5 , 2.5 ]]), {'asr': 'reciprocal', 'reduce_qpts': False, 'use_c': False}]
expected_qpoint_phonon_modes_file = 'NaCl_reciprocal_qpoint_phonon_modes.json'
reduce_qpts = False, n_threads = 0
@pytest.mark.phonopy_reader
@pytest.mark.parametrize(
'fc_kwargs, material, all_args, expected_qpoint_phonon_modes_file',
[({'path': get_phonopy_path('NaCl'),
'summary_name': 'phonopy_nacl.yaml'},
'NaCl',
[get_test_qpts(), {'asr': 'reciprocal'}],
'NaCl_reciprocal_qpoint_phonon_modes.json'),
({'path': get_phonopy_path('CaHgO2'),
'summary_name': 'mp-7041-20180417.yaml'},
'CaHgO2',
[get_test_qpts(), {'asr': 'reciprocal'}],
'CaHgO2_reciprocal_qpoint_phonon_modes.json')])
@pytest.mark.parametrize(
'reduce_qpts, n_threads',
[(False, 0), (True, 0), (True, 1), (True, 2)])
def test_calculate_qpoint_phonon_modes_from_phonopy(
self, fc_kwargs, material, all_args,
expected_qpoint_phonon_modes_file, reduce_qpts, n_threads):
fc = ForceConstants.from_phonopy(**fc_kwargs)
> self.calculate_and_check_qpoint_phonon_modes(
fc, material, all_args, expected_qpoint_phonon_modes_file,
reduce_qpts, n_threads)
tests_and_analysis\test\euphonic_test\test_force_constants_calculate_qpoint_phonon_modes.py:137:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests_and_analysis\test\euphonic_test\test_force_constants_calculate_qpoint_phonon_modes.py:100: in calculate_and_check_qpoint_phonon_modes
check_qpt_ph_modes(qpoint_phonon_modes,
tests_and_analysis\test\euphonic_test\test_qpoint_phonon_modes.py:135: in check_qpt_ph_modes
check_frequencies_at_qpts(
tests_and_analysis\test\utils.py:108: in check_frequencies_at_qpts
check_mode_values_at_qpts(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
qpts = array([[ 0. , 0. , 0. ],
[ 0. , 0. , 0.5 ],
[-0.25 , 0.5 , 0.5...[ 0.6 , 0. , 0.2 ],
[ 2. , 2. , 0.5 ],
[ 1.75 , 0.5 , 2.5 ]])
values = array([[-1.70326077, -1.30887859, -1.13733528, 9.9764666 , 9.97796055,
9.98104103, 9.98703386, 10.72126782...6568, 19.2705943 , 19.61966436, 21.13014723, 21.81223186,
22.60168321, 24.11325099, 25.03546098, 25.34212861]])
expected_values = array([[-1.18181071e-05, -5.77236107e-07, 1.22073354e-01,
9.98104103e+00, 9.98104103e+00, 9.98104103e+00,
... 1.96649815e+01, 1.96733585e+01, 2.53424813e+01,
2.53424813e+01, 2.53451626e+01, 2.53495615e+01]])
atol = 0.01, rtol = 1e-07, gamma_atol = 0.55, gamma_operator = <ufunc 'less'>
gamma_idx_limit = 3
def check_mode_values_at_qpts(qpts, values, expected_values, atol, rtol,
gamma_atol=None, gamma_operator=np.less,
gamma_idx_limit=None):
"""
Utility function for comparing difficult to test values (e.g.
frequencies, structure factors) which are often unstable at the
gamma point
Parameters
----------
qpts : (n_qpts, 3) float ndarray
Q-points at which values have been calculated
values : (n_qpts, Any) float ndarray
Values to test
expected_values : (n_qpts, Any) float ndarray
What the values should be
atol : float
Absolute tolerance (is passed to npt.assert_allclose)
rtol : float
Relative tolerance (is passed to npt.assert_allclose)
gamma_atol : float, optional default None
Absolute tolerance to test gamma point acoustic mode values
against
gamma_operator : numpy.ufunc, optional, default numpy.less
The function to compare the test values and expected values at
the gamma point. Should be numpy.less or numpy.greater
gamma_idx_limit : int, optional default 1
Required if gamma_atol is set. Describes which gamma-point values
to test with gamma_atol e.g. gamma_idx_limit = 3 will test the
first 3 values (i.e. the acoustic modes) at each gamma qpoint
"""
values_to_test = np.ones(values.shape, dtype=bool)
if gamma_atol:
gamma_points = (np.sum(np.absolute(qpts - np.rint(qpts)), axis=-1)
< 1e-10)
values_to_test[gamma_points, :gamma_idx_limit] = False
# Don't use the gamma_atol method where values == 0 e.g. structure
# factors at q=[0., 0., 0.] should be 0. so would fail if testing
# that they are more than gamma_atol
values_to_test[np.where(values == 0.)] = True
> assert np.all(gamma_operator(
np.absolute(values[~values_to_test]),
gamma_atol))
E AssertionError
tests_and_analysis\test\utils.py:161: AssertionError
github-actions / Test Results
3 out of 33 runs failed: test_calculate_qpoint_phonon_modes_from_phonopy[True-0-fc_kwargs0-NaCl-all_args0-NaCl_reciprocal_qpoin…non_modes.json] (euphonic_test.test_force_constants_calculate_qpoint_phonon_modes.TestForceConstantsCalculateQPointPhononModes)
artifacts/Unit test results windows-latest 3.10/junit_report_1734558617.xml [took 1s]
artifacts/Unit test results windows-latest 3.11/junit_report_1734558604.xml [took 1s]
artifacts/Unit test results windows-latest 3.12/junit_report_1734558626.xml [took 1s]
Raw output
AssertionError
self = <tests_and_analysis.test.euphonic_test.test_force_constants_calculate_qpoint_phonon_modes.TestForceConstantsCalculateQPointPhononModes object at 0x000001AAD8288A60>
fc_kwargs = {'path': 'D:\\a\\Euphonic\\Euphonic\\tests_and_analysis\\test\\data\\phonopy_files\\NaCl', 'summary_name': 'phonopy_nacl.yaml'}
material = 'NaCl'
all_args = [array([[ 0. , 0. , 0. ],
[ 0. , 0. , 0.5 ],
[-0.25 , 0.5 , 0.... , 0.5 ],
[ 1.75 , 0.5 , 2.5 ]]), {'asr': 'reciprocal', 'reduce_qpts': True, 'use_c': False}]
expected_qpoint_phonon_modes_file = 'NaCl_reciprocal_qpoint_phonon_modes.json'
reduce_qpts = True, n_threads = 0
@pytest.mark.phonopy_reader
@pytest.mark.parametrize(
'fc_kwargs, material, all_args, expected_qpoint_phonon_modes_file',
[({'path': get_phonopy_path('NaCl'),
'summary_name': 'phonopy_nacl.yaml'},
'NaCl',
[get_test_qpts(), {'asr': 'reciprocal'}],
'NaCl_reciprocal_qpoint_phonon_modes.json'),
({'path': get_phonopy_path('CaHgO2'),
'summary_name': 'mp-7041-20180417.yaml'},
'CaHgO2',
[get_test_qpts(), {'asr': 'reciprocal'}],
'CaHgO2_reciprocal_qpoint_phonon_modes.json')])
@pytest.mark.parametrize(
'reduce_qpts, n_threads',
[(False, 0), (True, 0), (True, 1), (True, 2)])
def test_calculate_qpoint_phonon_modes_from_phonopy(
self, fc_kwargs, material, all_args,
expected_qpoint_phonon_modes_file, reduce_qpts, n_threads):
fc = ForceConstants.from_phonopy(**fc_kwargs)
> self.calculate_and_check_qpoint_phonon_modes(
fc, material, all_args, expected_qpoint_phonon_modes_file,
reduce_qpts, n_threads)
tests_and_analysis\test\euphonic_test\test_force_constants_calculate_qpoint_phonon_modes.py:137:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests_and_analysis\test\euphonic_test\test_force_constants_calculate_qpoint_phonon_modes.py:100: in calculate_and_check_qpoint_phonon_modes
check_qpt_ph_modes(qpoint_phonon_modes,
tests_and_analysis\test\euphonic_test\test_qpoint_phonon_modes.py:135: in check_qpt_ph_modes
check_frequencies_at_qpts(
tests_and_analysis\test\utils.py:108: in check_frequencies_at_qpts
check_mode_values_at_qpts(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
qpts = array([[ 0. , 0. , 0. ],
[ 0. , 0. , 0.5 ],
[-0.25 , 0.5 , 0.5...[ 0.6 , 0. , 0.2 ],
[ 2. , 2. , 0.5 ],
[ 1.75 , 0.5 , 2.5 ]])
values = array([[-1.70326077, -1.30887859, -1.13733528, 9.9764666 , 9.97796055,
9.98104103, 9.98703386, 10.72126782...6568, 19.2705943 , 19.61966436, 21.13014723, 21.81223186,
22.60168321, 24.11325099, 25.03546098, 25.34212861]])
expected_values = array([[-1.18181071e-05, -5.77236107e-07, 1.22073354e-01,
9.98104103e+00, 9.98104103e+00, 9.98104103e+00,
... 1.96649815e+01, 1.96733585e+01, 2.53424813e+01,
2.53424813e+01, 2.53451626e+01, 2.53495615e+01]])
atol = 0.01, rtol = 1e-07, gamma_atol = 0.55, gamma_operator = <ufunc 'less'>
gamma_idx_limit = 3
def check_mode_values_at_qpts(qpts, values, expected_values, atol, rtol,
gamma_atol=None, gamma_operator=np.less,
gamma_idx_limit=None):
"""
Utility function for comparing difficult to test values (e.g.
frequencies, structure factors) which are often unstable at the
gamma point
Parameters
----------
qpts : (n_qpts, 3) float ndarray
Q-points at which values have been calculated
values : (n_qpts, Any) float ndarray
Values to test
expected_values : (n_qpts, Any) float ndarray
What the values should be
atol : float
Absolute tolerance (is passed to npt.assert_allclose)
rtol : float
Relative tolerance (is passed to npt.assert_allclose)
gamma_atol : float, optional default None
Absolute tolerance to test gamma point acoustic mode values
against
gamma_operator : numpy.ufunc, optional, default numpy.less
The function to compare the test values and expected values at
the gamma point. Should be numpy.less or numpy.greater
gamma_idx_limit : int, optional default 1
Required if gamma_atol is set. Describes which gamma-point values
to test with gamma_atol e.g. gamma_idx_limit = 3 will test the
first 3 values (i.e. the acoustic modes) at each gamma qpoint
"""
values_to_test = np.ones(values.shape, dtype=bool)
if gamma_atol:
gamma_points = (np.sum(np.absolute(qpts - np.rint(qpts)), axis=-1)
< 1e-10)
values_to_test[gamma_points, :gamma_idx_limit] = False
# Don't use the gamma_atol method where values == 0 e.g. structure
# factors at q=[0., 0., 0.] should be 0. so would fail if testing
# that they are more than gamma_atol
values_to_test[np.where(values == 0.)] = True
> assert np.all(gamma_operator(
np.absolute(values[~values_to_test]),
gamma_atol))
E AssertionError
tests_and_analysis\test\utils.py:161: AssertionError
github-actions / Test Results
3 out of 33 runs failed: test_calculate_qpoint_phonon_modes_from_phonopy[True-1-fc_kwargs0-NaCl-all_args0-NaCl_reciprocal_qpoin…non_modes.json] (euphonic_test.test_force_constants_calculate_qpoint_phonon_modes.TestForceConstantsCalculateQPointPhononModes)
artifacts/Unit test results windows-latest 3.10/junit_report_1734558617.xml [took 1s]
artifacts/Unit test results windows-latest 3.11/junit_report_1734558604.xml [took 1s]
artifacts/Unit test results windows-latest 3.12/junit_report_1734558626.xml [took 1s]
Raw output
AssertionError
self = <tests_and_analysis.test.euphonic_test.test_force_constants_calculate_qpoint_phonon_modes.TestForceConstantsCalculateQPointPhononModes object at 0x000001AAD828A8C0>
fc_kwargs = {'path': 'D:\\a\\Euphonic\\Euphonic\\tests_and_analysis\\test\\data\\phonopy_files\\NaCl', 'summary_name': 'phonopy_nacl.yaml'}
material = 'NaCl'
all_args = [array([[ 0. , 0. , 0. ],
[ 0. , 0. , 0.5 ],
[-0.25 , 0.5 , 0....
[ 1.75 , 0.5 , 2.5 ]]), {'asr': 'reciprocal', 'n_threads': 1, 'reduce_qpts': True, 'use_c': True}]
expected_qpoint_phonon_modes_file = 'NaCl_reciprocal_qpoint_phonon_modes.json'
reduce_qpts = True, n_threads = 1
@pytest.mark.phonopy_reader
@pytest.mark.parametrize(
'fc_kwargs, material, all_args, expected_qpoint_phonon_modes_file',
[({'path': get_phonopy_path('NaCl'),
'summary_name': 'phonopy_nacl.yaml'},
'NaCl',
[get_test_qpts(), {'asr': 'reciprocal'}],
'NaCl_reciprocal_qpoint_phonon_modes.json'),
({'path': get_phonopy_path('CaHgO2'),
'summary_name': 'mp-7041-20180417.yaml'},
'CaHgO2',
[get_test_qpts(), {'asr': 'reciprocal'}],
'CaHgO2_reciprocal_qpoint_phonon_modes.json')])
@pytest.mark.parametrize(
'reduce_qpts, n_threads',
[(False, 0), (True, 0), (True, 1), (True, 2)])
def test_calculate_qpoint_phonon_modes_from_phonopy(
self, fc_kwargs, material, all_args,
expected_qpoint_phonon_modes_file, reduce_qpts, n_threads):
fc = ForceConstants.from_phonopy(**fc_kwargs)
> self.calculate_and_check_qpoint_phonon_modes(
fc, material, all_args, expected_qpoint_phonon_modes_file,
reduce_qpts, n_threads)
tests_and_analysis\test\euphonic_test\test_force_constants_calculate_qpoint_phonon_modes.py:137:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests_and_analysis\test\euphonic_test\test_force_constants_calculate_qpoint_phonon_modes.py:100: in calculate_and_check_qpoint_phonon_modes
check_qpt_ph_modes(qpoint_phonon_modes,
tests_and_analysis\test\euphonic_test\test_qpoint_phonon_modes.py:135: in check_qpt_ph_modes
check_frequencies_at_qpts(
tests_and_analysis\test\utils.py:108: in check_frequencies_at_qpts
check_mode_values_at_qpts(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
qpts = array([[ 0. , 0. , 0. ],
[ 0. , 0. , 0.5 ],
[-0.25 , 0.5 , 0.5...[ 0.6 , 0. , 0.2 ],
[ 2. , 2. , 0.5 ],
[ 1.75 , 0.5 , 2.5 ]])
values = array([[-1.30887681, -1.29880803, -0.52575934, 9.86606231, 9.97646833,
9.98103906, 9.98104103, 10.30824928...5889, 19.41189784, 19.65280273, 19.65506572, 19.65697321,
25.34067378, 25.34182014, 25.34259372, 25.34416257]])
expected_values = array([[-1.18181071e-05, -5.77236107e-07, 1.22073354e-01,
9.98104103e+00, 9.98104103e+00, 9.98104103e+00,
... 1.96649815e+01, 1.96733585e+01, 2.53424813e+01,
2.53424813e+01, 2.53451626e+01, 2.53495615e+01]])
atol = 0.01, rtol = 1e-07, gamma_atol = 0.55, gamma_operator = <ufunc 'less'>
gamma_idx_limit = 3
def check_mode_values_at_qpts(qpts, values, expected_values, atol, rtol,
gamma_atol=None, gamma_operator=np.less,
gamma_idx_limit=None):
"""
Utility function for comparing difficult to test values (e.g.
frequencies, structure factors) which are often unstable at the
gamma point
Parameters
----------
qpts : (n_qpts, 3) float ndarray
Q-points at which values have been calculated
values : (n_qpts, Any) float ndarray
Values to test
expected_values : (n_qpts, Any) float ndarray
What the values should be
atol : float
Absolute tolerance (is passed to npt.assert_allclose)
rtol : float
Relative tolerance (is passed to npt.assert_allclose)
gamma_atol : float, optional default None
Absolute tolerance to test gamma point acoustic mode values
against
gamma_operator : numpy.ufunc, optional, default numpy.less
The function to compare the test values and expected values at
the gamma point. Should be numpy.less or numpy.greater
gamma_idx_limit : int, optional default 1
Required if gamma_atol is set. Describes which gamma-point values
to test with gamma_atol e.g. gamma_idx_limit = 3 will test the
first 3 values (i.e. the acoustic modes) at each gamma qpoint
"""
values_to_test = np.ones(values.shape, dtype=bool)
if gamma_atol:
gamma_points = (np.sum(np.absolute(qpts - np.rint(qpts)), axis=-1)
< 1e-10)
values_to_test[gamma_points, :gamma_idx_limit] = False
# Don't use the gamma_atol method where values == 0 e.g. structure
# factors at q=[0., 0., 0.] should be 0. so would fail if testing
# that they are more than gamma_atol
values_to_test[np.where(values == 0.)] = True
> assert np.all(gamma_operator(
np.absolute(values[~values_to_test]),
gamma_atol))
E AssertionError
tests_and_analysis\test\utils.py:161: AssertionError
github-actions / Test Results
3 out of 33 runs failed: test_calculate_qpoint_phonon_modes_from_phonopy[True-2-fc_kwargs0-NaCl-all_args0-NaCl_reciprocal_qpoin…non_modes.json] (euphonic_test.test_force_constants_calculate_qpoint_phonon_modes.TestForceConstantsCalculateQPointPhononModes)
artifacts/Unit test results windows-latest 3.10/junit_report_1734558617.xml [took 1s]
artifacts/Unit test results windows-latest 3.11/junit_report_1734558604.xml [took 1s]
artifacts/Unit test results windows-latest 3.12/junit_report_1734558626.xml [took 1s]
Raw output
AssertionError
self = <tests_and_analysis.test.euphonic_test.test_force_constants_calculate_qpoint_phonon_modes.TestForceConstantsCalculateQPointPhononModes object at 0x000001AAD828B190>
fc_kwargs = {'path': 'D:\\a\\Euphonic\\Euphonic\\tests_and_analysis\\test\\data\\phonopy_files\\NaCl', 'summary_name': 'phonopy_nacl.yaml'}
material = 'NaCl'
all_args = [array([[ 0. , 0. , 0. ],
[ 0. , 0. , 0.5 ],
[-0.25 , 0.5 , 0....
[ 1.75 , 0.5 , 2.5 ]]), {'asr': 'reciprocal', 'n_threads': 2, 'reduce_qpts': True, 'use_c': True}]
expected_qpoint_phonon_modes_file = 'NaCl_reciprocal_qpoint_phonon_modes.json'
reduce_qpts = True, n_threads = 2
@pytest.mark.phonopy_reader
@pytest.mark.parametrize(
'fc_kwargs, material, all_args, expected_qpoint_phonon_modes_file',
[({'path': get_phonopy_path('NaCl'),
'summary_name': 'phonopy_nacl.yaml'},
'NaCl',
[get_test_qpts(), {'asr': 'reciprocal'}],
'NaCl_reciprocal_qpoint_phonon_modes.json'),
({'path': get_phonopy_path('CaHgO2'),
'summary_name': 'mp-7041-20180417.yaml'},
'CaHgO2',
[get_test_qpts(), {'asr': 'reciprocal'}],
'CaHgO2_reciprocal_qpoint_phonon_modes.json')])
@pytest.mark.parametrize(
'reduce_qpts, n_threads',
[(False, 0), (True, 0), (True, 1), (True, 2)])
def test_calculate_qpoint_phonon_modes_from_phonopy(
self, fc_kwargs, material, all_args,
expected_qpoint_phonon_modes_file, reduce_qpts, n_threads):
fc = ForceConstants.from_phonopy(**fc_kwargs)
> self.calculate_and_check_qpoint_phonon_modes(
fc, material, all_args, expected_qpoint_phonon_modes_file,
reduce_qpts, n_threads)
tests_and_analysis\test\euphonic_test\test_force_constants_calculate_qpoint_phonon_modes.py:137:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests_and_analysis\test\euphonic_test\test_force_constants_calculate_qpoint_phonon_modes.py:100: in calculate_and_check_qpoint_phonon_modes
check_qpt_ph_modes(qpoint_phonon_modes,
tests_and_analysis\test\euphonic_test\test_qpoint_phonon_modes.py:135: in check_qpt_ph_modes
check_frequencies_at_qpts(
tests_and_analysis\test\utils.py:108: in check_frequencies_at_qpts
check_mode_values_at_qpts(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
qpts = array([[ 0. , 0. , 0. ],
[ 0. , 0. , 0.5 ],
[-0.25 , 0.5 , 0.5...[ 0.6 , 0. , 0.2 ],
[ 2. , 2. , 0.5 ],
[ 1.75 , 0.5 , 2.5 ]])
values = array([[-1.30887681, -1.29880803, -0.52575934, 9.86606231, 9.97646833,
9.98103906, 9.98104103, 10.30824928...5889, 19.41189784, 19.65280273, 19.65506572, 19.65697321,
25.34067378, 25.34182014, 25.34259372, 25.34416257]])
expected_values = array([[-1.18181071e-05, -5.77236107e-07, 1.22073354e-01,
9.98104103e+00, 9.98104103e+00, 9.98104103e+00,
... 1.96649815e+01, 1.96733585e+01, 2.53424813e+01,
2.53424813e+01, 2.53451626e+01, 2.53495615e+01]])
atol = 0.01, rtol = 1e-07, gamma_atol = 0.55, gamma_operator = <ufunc 'less'>
gamma_idx_limit = 3
def check_mode_values_at_qpts(qpts, values, expected_values, atol, rtol,
gamma_atol=None, gamma_operator=np.less,
gamma_idx_limit=None):
"""
Utility function for comparing difficult to test values (e.g.
frequencies, structure factors) which are often unstable at the
gamma point
Parameters
----------
qpts : (n_qpts, 3) float ndarray
Q-points at which values have been calculated
values : (n_qpts, Any) float ndarray
Values to test
expected_values : (n_qpts, Any) float ndarray
What the values should be
atol : float
Absolute tolerance (is passed to npt.assert_allclose)
rtol : float
Relative tolerance (is passed to npt.assert_allclose)
gamma_atol : float, optional default None
Absolute tolerance to test gamma point acoustic mode values
against
gamma_operator : numpy.ufunc, optional, default numpy.less
The function to compare the test values and expected values at
the gamma point. Should be numpy.less or numpy.greater
gamma_idx_limit : int, optional default 1
Required if gamma_atol is set. Describes which gamma-point values
to test with gamma_atol e.g. gamma_idx_limit = 3 will test the
first 3 values (i.e. the acoustic modes) at each gamma qpoint
"""
values_to_test = np.ones(values.shape, dtype=bool)
if gamma_atol:
gamma_points = (np.sum(np.absolute(qpts - np.rint(qpts)), axis=-1)
< 1e-10)
values_to_test[gamma_points, :gamma_idx_limit] = False
# Don't use the gamma_atol method where values == 0 e.g. structure
# factors at q=[0., 0., 0.] should be 0. so would fail if testing
# that they are more than gamma_atol
values_to_test[np.where(values == 0.)] = True
> assert np.all(gamma_operator(
np.absolute(values[~values_to_test]),
gamma_atol))
E AssertionError
tests_and_analysis\test\utils.py:161: AssertionError
Check warning on line 0 in script_tests.test_dispersion.TestRegression
github-actions / Test Results
3 out of 33 runs failed: test_dispersion_plot_data_from_phonopy[dispersion_args9] (script_tests.test_dispersion.TestRegression)
artifacts/Unit test results windows-latest 3.10/junit_report_1734558617.xml [took 2s]
artifacts/Unit test results windows-latest 3.11/junit_report_1734558604.xml [took 2s]
artifacts/Unit test results windows-latest 3.12/junit_report_1734558626.xml [took 1s]
Raw output
AssertionError:
Not equal to tolerance rtol=1e-07, atol=2.22045e-16
Mismatched elements: 56 / 116 (48.3%)
Max absolute difference among violations: 35506.24449909
Max relative difference among violations: 1.00004762
ACTUAL: array([[ 0. , 0.018158, 0.036315, 0.054473, 0.072631, 0.090789,
0.108946, 0.127104, 0.145262, 0.163419, 0.181577, 0.199735,
0.217893, 0.23605 , 0.254208, 0.272366, 0.290523, 0.308681,...
DESIRED: array([[ 0.000000e+00, 1.815771e-02, 3.631543e-02, 5.447314e-02,
7.263085e-02, 9.078856e-02, 1.089463e-01, 1.271040e-01,
1.452617e-01, 1.634194e-01, 1.815771e-01, 1.997348e-01,...
self = <tests_and_analysis.test.script_tests.test_dispersion.TestRegression object at 0x000001AADC229090>
inject_mocks = None
dispersion_args = ['D:\\a\\Euphonic\\Euphonic\\tests_and_analysis\\test\\data\\phonopy_files\\NaCl_cli_test\\force_constants.hdf5']
@pytest.mark.phonopy_reader
@pytest.mark.multiple_extras
@pytest.mark.parametrize('dispersion_args', disp_params_from_phonopy)
def test_dispersion_plot_data_from_phonopy(
self, inject_mocks, dispersion_args):
> self.run_dispersion_and_test_result(dispersion_args)
tests_and_analysis\test\script_tests\test_dispersion.py:110:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tests_and_analysis.test.script_tests.test_dispersion.TestRegression object at 0x000001AADC229090>
dispersion_args = ['D:\\a\\Euphonic\\Euphonic\\tests_and_analysis\\test\\data\\phonopy_files\\NaCl_cli_test\\force_constants.hdf5']
def run_dispersion_and_test_result(self, dispersion_args):
euphonic.cli.dispersion.main(dispersion_args)
line_data = get_plot_line_data()
# Only use first axis xy_data to save space
# and avoid regenerating data after refactoring
line_data['xy_data'] = line_data['xy_data'][0]
with open(disp_output_file, 'r') as f:
expected_line_data = json.load(f)[args_to_key(dispersion_args)]
# Increase tolerance if asr present - can give slightly
# different results with different libs
if any(['--asr' in arg for arg in dispersion_args]):
atol = 5e-6
else:
atol = sys.float_info.epsilon
for key, expected_val in expected_line_data.items():
if key == 'xy_data':
# numpy can only auto convert 2D lists - xy_data has
# dimensions (n_lines, 2, n_points) so check in a loop
for idx, line in enumerate(expected_val):
> npt.assert_allclose(
line, line_data[key][idx],
atol=atol)
E AssertionError:
E Not equal to tolerance rtol=1e-07, atol=2.22045e-16
E
E Mismatched elements: 56 / 116 (48.3%)
E Max absolute difference among violations: 35506.24449909
E Max relative difference among violations: 1.00004762
E ACTUAL: array([[ 0. , 0.018158, 0.036315, 0.054473, 0.072631, 0.090789,
E 0.108946, 0.127104, 0.145262, 0.163419, 0.181577, 0.199735,
E 0.217893, 0.23605 , 0.254208, 0.272366, 0.290523, 0.308681,...
E DESIRED: array([[ 0.000000e+00, 1.815771e-02, 3.631543e-02, 5.447314e-02,
E 7.263085e-02, 9.078856e-02, 1.089463e-01, 1.271040e-01,
E 1.452617e-01, 1.634194e-01, 1.815771e-01, 1.997348e-01,...
tests_and_analysis\test\script_tests\test_dispersion.py:94: AssertionError