Skip to content

Instrumental resolution broadening #739

Instrumental resolution broadening

Instrumental resolution broadening #739

GitHub Actions / Test Results failed Jul 21, 2023 in 0s

11 fail, 6 skipped, 1 017 pass in 38m 44s

     19 files  ±0       19 suites  ±0   38m 44s ⏱️ + 2m 45s
1 034 tests ±0  1 017 ✔️  - 11    6 💤 ±0  11 +11 
7 196 runs  ±0  7 074 ✔️  - 77  45 💤 ±0  77 +77 

Results for commit afafe9d. ± Comparison against earlier commit 368b2c9.

Annotations

Check warning on line 0 in script_tests.test_dos.TestRegression

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 7 runs failed: test_dos_plot_data[dos_args15] (script_tests.test_dos.TestRegression)

artifacts/Unit test results macos-latest/junit_report_1689933198.xml [took 0s]
artifacts/Unit test results macos-latest/junit_report_1689933828.xml [took 0s]
artifacts/Unit test results ubuntu-latest/junit_report_1689933074.xml [took 0s]
artifacts/Unit test results ubuntu-latest/junit_report_1689933436.xml [took 0s]
artifacts/Unit test results ubuntu-latest/junit_report_1689933740.xml [took 0s]
artifacts/Unit test results windows-latest/junit_report_1689933265.xml [took 0s]
artifacts/Unit test results windows-latest/junit_report_1689933882.xml [took 0s]
Raw output
AssertionError: 
Not equal to tolerance rtol=1e-07, atol=1.11022e-15

Mismatched elements: 200 / 400 (50%)
Max absolute difference: 5.05301987e-05
Max relative difference: 2.58619641
 x: array([[[4.036794e-01, 1.211038e+00, 2.018397e+00, 2.825756e+00,
         3.633115e+00, 4.440474e+00, 5.247833e+00, 6.055191e+00,
         6.862550e+00, 7.669909e+00, 8.477268e+00, 9.284627e+00,...
 y: array([[[4.036794e-01, 1.211038e+00, 2.018397e+00, 2.825756e+00,
         3.633115e+00, 4.440474e+00, 5.247833e+00, 6.055191e+00,
         6.862550e+00, 7.669909e+00, 8.477268e+00, 9.284627e+00,...
self = <tests_and_analysis.test.script_tests.test_dos.TestRegression object at 0x7fb7f2865650>
inject_mocks = None
dos_args = ['/Users/runner/work/Euphonic/Euphonic/tests_and_analysis/test/data/castep_files/quartz/quartz.castep_bin', '--grid', '5', '5', '4', '--adaptive', ...]

    @pytest.mark.parametrize('dos_args', dos_params)
    def test_dos_plot_data(self, inject_mocks, dos_args):
>       self.run_dos_and_test_result(dos_args)

script_tests/test_dos.py:91: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests_and_analysis.test.script_tests.test_dos.TestRegression object at 0x7fb7f2865650>
dos_args = ['/Users/runner/work/Euphonic/Euphonic/tests_and_analysis/test/data/castep_files/quartz/quartz.castep_bin', '--grid', '5', '5', '4', '--adaptive', ...]

    def run_dos_and_test_result(self, dos_args):
        euphonic.cli.dos.main(dos_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(dos_output_file, 'r') as f:
            expected_line_data = json.load(f)[args_to_key(dos_args)]
        for key, expected_val in expected_line_data.items():
            # We don't care about the details of tick labels for DOS
            if key == 'x_ticklabels':
                pass
            elif key == 'xy_data':
                npt.assert_allclose(
                    expected_val, line_data[key],
>                   atol=5*sys.float_info.epsilon)
E               AssertionError: 
E               Not equal to tolerance rtol=1e-07, atol=1.11022e-15
E               
E               Mismatched elements: 200 / 400 (50%)
E               Max absolute difference: 5.05301987e-05
E               Max relative difference: 2.58619641
E                x: array([[[4.036794e-01, 1.211038e+00, 2.018397e+00, 2.825756e+00,
E                        3.633115e+00, 4.440474e+00, 5.247833e+00, 6.055191e+00,
E                        6.862550e+00, 7.669909e+00, 8.477268e+00, 9.284627e+00,...
E                y: array([[[4.036794e-01, 1.211038e+00, 2.018397e+00, 2.825756e+00,
E                        3.633115e+00, 4.440474e+00, 5.247833e+00, 6.055191e+00,
E                        6.862550e+00, 7.669909e+00, 8.477268e+00, 9.284627e+00,...

script_tests/test_dos.py:85: AssertionError

Check warning on line 0 in script_tests.test_dos.TestRegression

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 7 runs failed: test_dos_plot_data[dos_args16] (script_tests.test_dos.TestRegression)

artifacts/Unit test results macos-latest/junit_report_1689933198.xml [took 0s]
artifacts/Unit test results macos-latest/junit_report_1689933828.xml [took 0s]
artifacts/Unit test results ubuntu-latest/junit_report_1689933074.xml [took 0s]
artifacts/Unit test results ubuntu-latest/junit_report_1689933436.xml [took 0s]
artifacts/Unit test results ubuntu-latest/junit_report_1689933740.xml [took 0s]
artifacts/Unit test results windows-latest/junit_report_1689933265.xml [took 0s]
artifacts/Unit test results windows-latest/junit_report_1689933882.xml [took 0s]
Raw output
AssertionError: 
Not equal to tolerance rtol=1e-07, atol=1.11022e-15

Mismatched elements: 200 / 400 (50%)
Max absolute difference: 4.44743081e-06
Max relative difference: 0.02799749
 x: array([[[4.036794e-01, 1.211038e+00, 2.018397e+00, 2.825756e+00,
         3.633115e+00, 4.440474e+00, 5.247833e+00, 6.055191e+00,
         6.862550e+00, 7.669909e+00, 8.477268e+00, 9.284627e+00,...
 y: array([[[4.036794e-01, 1.211038e+00, 2.018397e+00, 2.825756e+00,
         3.633115e+00, 4.440474e+00, 5.247833e+00, 6.055191e+00,
         6.862550e+00, 7.669909e+00, 8.477268e+00, 9.284627e+00,...
self = <tests_and_analysis.test.script_tests.test_dos.TestRegression object at 0x7fb7f2865710>
inject_mocks = None
dos_args = ['/Users/runner/work/Euphonic/Euphonic/tests_and_analysis/test/data/castep_files/quartz/quartz.castep_bin', '--grid', '5', '5', '4', '--adaptive', ...]

    @pytest.mark.parametrize('dos_args', dos_params)
    def test_dos_plot_data(self, inject_mocks, dos_args):
>       self.run_dos_and_test_result(dos_args)

script_tests/test_dos.py:91: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests_and_analysis.test.script_tests.test_dos.TestRegression object at 0x7fb7f2865710>
dos_args = ['/Users/runner/work/Euphonic/Euphonic/tests_and_analysis/test/data/castep_files/quartz/quartz.castep_bin', '--grid', '5', '5', '4', '--adaptive', ...]

    def run_dos_and_test_result(self, dos_args):
        euphonic.cli.dos.main(dos_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(dos_output_file, 'r') as f:
            expected_line_data = json.load(f)[args_to_key(dos_args)]
        for key, expected_val in expected_line_data.items():
            # We don't care about the details of tick labels for DOS
            if key == 'x_ticklabels':
                pass
            elif key == 'xy_data':
                npt.assert_allclose(
                    expected_val, line_data[key],
>                   atol=5*sys.float_info.epsilon)
E               AssertionError: 
E               Not equal to tolerance rtol=1e-07, atol=1.11022e-15
E               
E               Mismatched elements: 200 / 400 (50%)
E               Max absolute difference: 4.44743081e-06
E               Max relative difference: 0.02799749
E                x: array([[[4.036794e-01, 1.211038e+00, 2.018397e+00, 2.825756e+00,
E                        3.633115e+00, 4.440474e+00, 5.247833e+00, 6.055191e+00,
E                        6.862550e+00, 7.669909e+00, 8.477268e+00, 9.284627e+00,...
E                y: array([[[4.036794e-01, 1.211038e+00, 2.018397e+00, 2.825756e+00,
E                        3.633115e+00, 4.440474e+00, 5.247833e+00, 6.055191e+00,
E                        6.862550e+00, 7.669909e+00, 8.477268e+00, 9.284627e+00,...

script_tests/test_dos.py:85: AssertionError

Check warning on line 0 in euphonic_test.test_broadening

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 7 runs failed: test_variable_close_to_exact (euphonic_test.test_broadening)

artifacts/Unit test results macos-latest/junit_report_1689933198.xml [took 0s]
artifacts/Unit test results macos-latest/junit_report_1689933662.xml [took 0s]
artifacts/Unit test results ubuntu-latest/junit_report_1689933074.xml [took 0s]
artifacts/Unit test results ubuntu-latest/junit_report_1689933341.xml [took 0s]
artifacts/Unit test results ubuntu-latest/junit_report_1689933740.xml [took 0s]
artifacts/Unit test results windows-latest/junit_report_1689933265.xml [took 0s]
artifacts/Unit test results windows-latest/junit_report_1689933706.xml [took 0s]
Raw output
ValueError: Target error is out of fit range; value must lie in range [2.28139129e-05 9.99310660e-02].
def test_variable_close_to_exact():
        """Check variable-width broadening agrees with exact for trivial case"""
        rng = RandomState(123)
    
        bins = np.linspace(0, 100, 200)
        bin_width = bins[1] - bins[0]
        x = (bins[1:] + bins[:-1]) / 2
        y = np.zeros_like(x)
        y[rng.randint(0, len(x), 20)] = rng.rand(20)
    
        sigma = 2.
        exact = gaussian_filter(y, (sigma / bin_width), mode='constant')
    
        def width_function(x):
            poly = Polynomial([sigma, 0., 0.])
            return poly(x.to('meV').magnitude) * ureg('meV')
    
>       poly_broadened = variable_width_broadening(
            bins=(bins * ureg('meV')),
            x=(x * ureg('meV')),
            width_function=width_function,
            width_convention='STD',
            weights=(y * bin_width),  # Convert from spectrum heights to counts
            adaptive_error=1e-5)

euphonic_test/test_broadening.py:39: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../.tox/py311/lib/python3.11/site-packages/euphonic/broadening.py:95: in variable_width_broadening
    return width_interpolated_broadening(bins, x, widths,
../../.tox/py311/lib/python3.11/site-packages/euphonic/broadening.py:149: in width_interpolated_broadening
    return _width_interpolated_broadening(bins.to('hartree').magnitude,
../../.tox/py311/lib/python3.11/site-packages/euphonic/broadening.py:214: in _width_interpolated_broadening
    spacing = _get_spacing(adaptive_error, shape=shape, fit=fit)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

error = 1e-05, shape = 'gauss', fit = 'cheby-log'

    def _get_spacing(error, shape='gauss', fit='cheby-log'):
        """
        Determine suitable spacing value for mode_width given accepted error level
    
        Coefficients have been fitted to plots of error vs spacing value
        """
    
        if fit == 'cubic' and shape == 'gauss':
            return np.polyval([612.7, -122.7, 15.40, 1.0831], error)
    
        elif fit == 'cheby-log':
            if shape == 'lorentz':
                cheby = Chebyshev(
                    [1.31311372, 0.41624683, 0.17961194, 0.06253194,
                     0.0195309, 0.00555107, 0.00225896],
                    window=[-1.,  1.],
                    domain=[-4.04691274, -1.34655197])
                # Updated params from paper:
                # [1.26039672 0.39900457 0.20392176 0.08602507
                #  0.03337662 0.00878684 0.00619626]
                # window: [-1.  1.]  domain: [-4.99146317 -1.34655197]
    
            elif shape == 'gauss':
                cheby = Chebyshev(
                    [1.25885858, 0.39803148, 0.20311735,
                     0.08654827, 0.03447873, 0.00894006],
                    window=[-1., 1.],
                    domain=[-4.64180022, -1.00029948])
    
            log_error = np.log10(error)
            if log_error < cheby.domain[0] or log_error > cheby.domain[1]:
>               raise ValueError("Target error is out of fit range; value must lie"
                                 f" in range {np.power(10, cheby.domain)}.")
E               ValueError: Target error is out of fit range; value must lie in range [2.28139129e-05 9.99310660e-02].

../../.tox/py311/lib/python3.11/site-packages/euphonic/broadening.py:193: ValueError

Check warning on line 0 in euphonic_test.test_broadening

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 7 runs failed: test_lower_bound_widths_broadened[quartz-toy_quartz_qpoint_frequencies.json-toy_quartz_mode_widths.json-toy_quartz_adaptive_dos.json-ebins0] (euphonic_test.test_broadening)

artifacts/Unit test results macos-latest/junit_report_1689933198.xml [took 0s]
artifacts/Unit test results macos-latest/junit_report_1689933662.xml [took 0s]
artifacts/Unit test results ubuntu-latest/junit_report_1689933074.xml [took 0s]
artifacts/Unit test results ubuntu-latest/junit_report_1689933341.xml [took 0s]
artifacts/Unit test results ubuntu-latest/junit_report_1689933740.xml [took 0s]
artifacts/Unit test results windows-latest/junit_report_1689933265.xml [took 0s]
artifacts/Unit test results windows-latest/junit_report_1689933706.xml [took 0s]
Raw output
AssertionError: 
Not equal to tolerance rtol=1e-07, atol=0

Mismatched elements: 329 / 399 (82.5%)
Max absolute difference: 2.69105285e-05
Max relative difference: 0.00066671
 x: array([0.250001, 0.270826, 0.291424, 0.311575, 0.331075, 0.349738,
       0.367407, 0.383952, 0.399276, 0.413316, 0.426039, 0.437445,
       0.447559, 0.456431, 0.464129, 0.470737, 0.476349, 0.481064,...
 y: array([0.250001, 0.270826, 0.291424, 0.311575, 0.331075, 0.349738,
       0.367407, 0.383952, 0.399276, 0.413316, 0.42604 , 0.437446,
       0.44756 , 0.456431, 0.46413 , 0.470738, 0.47635 , 0.481066,...
material = 'quartz', qpt_freqs_json = 'toy_quartz_qpoint_frequencies.json'
mode_widths_json = 'toy_quartz_mode_widths.json'
expected_dos_json = 'toy_quartz_adaptive_dos.json'
ebins = <Quantity([ 0.   0.1  0.2  0.3  0.4  0.5  0.6  0.7  0.8  0.9  1.   1.1  1.2  1.3
  1.4  1.5  1.6  1.7  1.8  1.9  2.   ...8.1 38.2 38.3 38.4 38.5 38.6 38.7 38.8 38.9 39.  39.1
 39.2 39.3 39.4 39.5 39.6 39.7 39.8 39.9], 'millielectron_volt')>

    @pytest.mark.parametrize(
            ('material, qpt_freqs_json, mode_widths_json,'
             'expected_dos_json, ebins'), [
                ('quartz', 'toy_quartz_qpoint_frequencies.json',
                 'toy_quartz_mode_widths.json',
                 'toy_quartz_adaptive_dos.json',
                 np.arange(0, 40, 0.1)*ureg('meV'))])
    def test_lower_bound_widths_broadened(material, qpt_freqs_json,
                                          mode_widths_json,
                                          expected_dos_json, ebins):
        """
        Test to ensure that points with mode width equal to
        min(width_samples) are broadened
        """
        qpt_freqs = get_qpt_freqs(material, qpt_freqs_json)
        mode_widths = get_mode_widths(get_fc_path(mode_widths_json))
        weights = np.ones(qpt_freqs.frequencies.shape) * \
            np.full(qpt_freqs.n_qpts, 1/qpt_freqs.n_qpts)[:, np.newaxis]
        dos = width_interpolated_broadening(ebins, qpt_freqs.frequencies,
                                            mode_widths, weights, 0.01)
        expected_dos = get_expected_spectrum1d(expected_dos_json)
>       npt.assert_allclose(expected_dos.y_data.magnitude, dos.magnitude)

euphonic_test/test_broadening.py:103: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (<function assert_allclose.<locals>.compare at 0x12ca022a0>, array([0.25000085, 0.27082584, 0.29142383, 0.3115752 , 0....   0.07856112, 0.07272895, 0.06720425, 0.06198366, 0.05706248,
       0.05243477, 0.0480935 , 0.04403064, 0.04023732]))
kwds = {'equal_nan': True, 'err_msg': '', 'header': 'Not equal to tolerance rtol=1e-07, atol=0', 'verbose': True}

    @wraps(func)
    def inner(*args, **kwds):
        with self._recreate_cm():
>           return func(*args, **kwds)
E           AssertionError: 
E           Not equal to tolerance rtol=1e-07, atol=0
E           
E           Mismatched elements: 329 / 399 (82.5%)
E           Max absolute difference: 2.69105285e-05
E           Max relative difference: 0.00066671
E            x: array([0.250001, 0.270826, 0.291424, 0.311575, 0.331075, 0.349738,
E                  0.367407, 0.383952, 0.399276, 0.413316, 0.426039, 0.437445,
E                  0.447559, 0.456431, 0.464129, 0.470737, 0.476349, 0.481064,...
E            y: array([0.250001, 0.270826, 0.291424, 0.311575, 0.331075, 0.349738,
E                  0.367407, 0.383952, 0.399276, 0.413316, 0.42604 , 0.437446,
E                  0.44756 , 0.456431, 0.46413 , 0.470738, 0.47635 , 0.481066,...

../../.tox/py311/lib/python3.11/contextlib.py:81: AssertionError

Check warning on line 0 in euphonic_test.test_qpoint_frequencies.TestQpointFrequenciesCalculateDos

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 7 runs failed: test_calculate_dos_with_mode_widths[quartz-quartz_554_full_qpoint_frequencies.json-quartz_554_full_mode_widt…uartz_554_full_adaptive_dos_fast.json-ebins1-kwargs1] (euphonic_test.test_qpoint_frequencies.TestQpointFrequenciesCalculateDos)

artifacts/Unit test results macos-latest/junit_report_1689933198.xml [took 0s]
artifacts/Unit test results macos-latest/junit_report_1689933662.xml [took 0s]
artifacts/Unit test results ubuntu-latest/junit_report_1689933074.xml [took 0s]
artifacts/Unit test results ubuntu-latest/junit_report_1689933341.xml [took 0s]
artifacts/Unit test results ubuntu-latest/junit_report_1689933740.xml [took 0s]
artifacts/Unit test results windows-latest/junit_report_1689933265.xml [took 0s]
artifacts/Unit test results windows-latest/junit_report_1689933706.xml [took 0s]
Raw output
AssertionError: 
Not equal to tolerance rtol=1e-07, atol=1e-13

Mismatched elements: 1548 / 1549 (99.9%)
Max absolute difference: 6.61078122e-05
Max relative difference: 0.75039491
 x: array([0.001907, 0.00195 , 0.001995, ..., 0.001682, 0.001444, 0.001241])
 y: array([0.001911, 0.001954, 0.001999, ..., 0.001689, 0.00145 , 0.001247])
self = <tests_and_analysis.test.euphonic_test.test_qpoint_frequencies.TestQpointFrequenciesCalculateDos object at 0x1261f2b90>
material = 'quartz', qpt_freqs_json = 'quartz_554_full_qpoint_frequencies.json'
mode_widths_json = 'quartz_554_full_mode_widths.json'
expected_dos_json = 'quartz_554_full_adaptive_dos_fast.json'
ebins = <Quantity([0.000e+00 1.000e-01 2.000e-01 ... 1.547e+02 1.548e+02 1.549e+02], 'millielectron_volt')>
kwargs = {'adaptive_method': 'fast'}

    @pytest.mark.parametrize(
        ('material, qpt_freqs_json, mode_widths_json, '
         'expected_dos_json, ebins, kwargs'), [
            ('quartz', 'quartz_554_full_qpoint_frequencies.json',
             'quartz_554_full_mode_widths.json',
             'quartz_554_full_adaptive_dos.json',
             np.arange(0, 155, 0.1)*ureg('meV'),
             {'adaptive_method': 'reference'}),
            ('quartz', 'quartz_554_full_qpoint_frequencies.json',
             'quartz_554_full_mode_widths.json',
             'quartz_554_full_adaptive_dos_fast.json',
             np.arange(0, 155, 0.1)*ureg('meV'),
             {'adaptive_method': 'fast'}),
            ('LZO', 'lzo_222_full_qpoint_frequencies.json',
             'lzo_222_full_mode_widths.json',
             'lzo_222_full_adaptive_dos.json',
             np.arange(0, 100, 0.1)*ureg('meV'),
             {'adaptive_method': 'reference'}),
            ('LZO', 'lzo_222_full_qpoint_frequencies.json',
             'lzo_222_full_mode_widths.json',
             'lzo_222_full_adaptive_dos_fast.json',
             np.arange(0, 100, 0.1)*ureg('meV'),
             {'adaptive_method': 'fast'}),
            ('quartz', 'toy_quartz_qpoint_frequencies.json',
             'toy_quartz_mode_widths.json',
             'toy_quartz_uneven_adaptive_dos.json',
             np.concatenate((np.arange(0, 15, 0.1),
                             np.arange(15, 40, 0.2)))*ureg('meV'),
             {'adaptive_method': 'reference'})])
    def test_calculate_dos_with_mode_widths(
            self, material, qpt_freqs_json, mode_widths_json,
            expected_dos_json, ebins, kwargs):
        qpt_freqs = get_qpt_freqs(material, qpt_freqs_json)
        mode_widths = get_mode_widths(get_fc_path(mode_widths_json))
        dos = qpt_freqs.calculate_dos(
            ebins, mode_widths=mode_widths, **kwargs)
        expected_dos = get_expected_spectrum1d(expected_dos_json)
>       check_spectrum1d(dos, expected_dos, y_atol=1e-13)

euphonic_test/test_qpoint_frequencies.py:486: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
euphonic_test/test_spectrum1d.py:105: in check_spectrum1d
    npt.assert_allclose(actual_spectrum1d.y_data.magnitude,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (<function assert_allclose.<locals>.compare at 0x1304494e0>, array([0.00190657, 0.00195013, 0.00199492, ..., 0.0016818...436 ,
       0.00124149]), array([0.00191088, 0.00195449, 0.00199931, ..., 0.00168901, 0.00145018,
       0.00124737]))
kwds = {'equal_nan': True, 'err_msg': '', 'header': 'Not equal to tolerance rtol=1e-07, atol=1e-13', 'verbose': True}

    @wraps(func)
    def inner(*args, **kwds):
        with self._recreate_cm():
>           return func(*args, **kwds)
E           AssertionError: 
E           Not equal to tolerance rtol=1e-07, atol=1e-13
E           
E           Mismatched elements: 1548 / 1549 (99.9%)
E           Max absolute difference: 6.61078122e-05
E           Max relative difference: 0.75039491
E            x: array([0.001907, 0.00195 , 0.001995, ..., 0.001682, 0.001444, 0.001241])
E            y: array([0.001911, 0.001954, 0.001999, ..., 0.001689, 0.00145 , 0.001247])

../../.tox/py311/lib/python3.11/contextlib.py:81: AssertionError

Check warning on line 0 in euphonic_test.test_qpoint_frequencies.TestQpointFrequenciesCalculateDos

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 7 runs failed: test_calculate_dos_with_mode_widths[LZO-lzo_222_full_qpoint_frequencies.json-lzo_222_full_mode_widths.json-lzo_222_full_adaptive_dos_fast.json-ebins3-kwargs3] (euphonic_test.test_qpoint_frequencies.TestQpointFrequenciesCalculateDos)

artifacts/Unit test results macos-latest/junit_report_1689933198.xml [took 0s]
artifacts/Unit test results macos-latest/junit_report_1689933662.xml [took 0s]
artifacts/Unit test results ubuntu-latest/junit_report_1689933074.xml [took 0s]
artifacts/Unit test results ubuntu-latest/junit_report_1689933341.xml [took 0s]
artifacts/Unit test results ubuntu-latest/junit_report_1689933740.xml [took 0s]
artifacts/Unit test results windows-latest/junit_report_1689933265.xml [took 0s]
artifacts/Unit test results windows-latest/junit_report_1689933706.xml [took 0s]
Raw output
AssertionError: 
Not equal to tolerance rtol=1e-07, atol=1e-13

Mismatched elements: 999 / 999 (100%)
Max absolute difference: 0.000234
Max relative difference: 0.03055874
 x: array([3.811803e-04, 4.014472e-04, 4.226166e-04, 4.447179e-04,
       4.677817e-04, 4.918402e-04, 5.169278e-04, 5.430821e-04,
       5.703441e-04, 5.987602e-04, 6.283829e-04, 6.592730e-04,...
 y: array([3.792794e-04, 3.997120e-04, 4.210545e-04, 4.433345e-04,
       4.665803e-04, 4.908210e-04, 5.160877e-04, 5.424131e-04,
       5.698334e-04, 5.983883e-04, 6.281231e-04, 6.590902e-04,...
self = <tests_and_analysis.test.euphonic_test.test_qpoint_frequencies.TestQpointFrequenciesCalculateDos object at 0x1261f0410>
material = 'LZO', qpt_freqs_json = 'lzo_222_full_qpoint_frequencies.json'
mode_widths_json = 'lzo_222_full_mode_widths.json'
expected_dos_json = 'lzo_222_full_adaptive_dos_fast.json'
ebins = <Quantity([ 0.   0.1  0.2  0.3  0.4  0.5  0.6  0.7  0.8  0.9  1.   1.1  1.2  1.3
  1.4  1.5  1.6  1.7  1.8  1.9  2.   ...8.1 98.2 98.3 98.4 98.5 98.6 98.7 98.8 98.9 99.  99.1 99.2 99.3
 99.4 99.5 99.6 99.7 99.8 99.9], 'millielectron_volt')>
kwargs = {'adaptive_method': 'fast'}

    @pytest.mark.parametrize(
        ('material, qpt_freqs_json, mode_widths_json, '
         'expected_dos_json, ebins, kwargs'), [
            ('quartz', 'quartz_554_full_qpoint_frequencies.json',
             'quartz_554_full_mode_widths.json',
             'quartz_554_full_adaptive_dos.json',
             np.arange(0, 155, 0.1)*ureg('meV'),
             {'adaptive_method': 'reference'}),
            ('quartz', 'quartz_554_full_qpoint_frequencies.json',
             'quartz_554_full_mode_widths.json',
             'quartz_554_full_adaptive_dos_fast.json',
             np.arange(0, 155, 0.1)*ureg('meV'),
             {'adaptive_method': 'fast'}),
            ('LZO', 'lzo_222_full_qpoint_frequencies.json',
             'lzo_222_full_mode_widths.json',
             'lzo_222_full_adaptive_dos.json',
             np.arange(0, 100, 0.1)*ureg('meV'),
             {'adaptive_method': 'reference'}),
            ('LZO', 'lzo_222_full_qpoint_frequencies.json',
             'lzo_222_full_mode_widths.json',
             'lzo_222_full_adaptive_dos_fast.json',
             np.arange(0, 100, 0.1)*ureg('meV'),
             {'adaptive_method': 'fast'}),
            ('quartz', 'toy_quartz_qpoint_frequencies.json',
             'toy_quartz_mode_widths.json',
             'toy_quartz_uneven_adaptive_dos.json',
             np.concatenate((np.arange(0, 15, 0.1),
                             np.arange(15, 40, 0.2)))*ureg('meV'),
             {'adaptive_method': 'reference'})])
    def test_calculate_dos_with_mode_widths(
            self, material, qpt_freqs_json, mode_widths_json,
            expected_dos_json, ebins, kwargs):
        qpt_freqs = get_qpt_freqs(material, qpt_freqs_json)
        mode_widths = get_mode_widths(get_fc_path(mode_widths_json))
        dos = qpt_freqs.calculate_dos(
            ebins, mode_widths=mode_widths, **kwargs)
        expected_dos = get_expected_spectrum1d(expected_dos_json)
>       check_spectrum1d(dos, expected_dos, y_atol=1e-13)

euphonic_test/test_qpoint_frequencies.py:486: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
euphonic_test/test_spectrum1d.py:105: in check_spectrum1d
    npt.assert_allclose(actual_spectrum1d.y_data.magnitude,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (<function assert_allclose.<locals>.compare at 0x13044bce0>, array([3.81180289e-04, 4.01447210e-04, 4.22616640e-04, 4.....89088878e-05, 1.81211761e-05, 1.73650424e-05, 1.66391582e-05,
       1.59422735e-05, 1.52732081e-05, 1.46308455e-05]))
kwds = {'equal_nan': True, 'err_msg': '', 'header': 'Not equal to tolerance rtol=1e-07, atol=1e-13', 'verbose': True}

    @wraps(func)
    def inner(*args, **kwds):
        with self._recreate_cm():
>           return func(*args, **kwds)
E           AssertionError: 
E           Not equal to tolerance rtol=1e-07, atol=1e-13
E           
E           Mismatched elements: 999 / 999 (100%)
E           Max absolute difference: 0.000234
E           Max relative difference: 0.03055874
E            x: array([3.811803e-04, 4.014472e-04, 4.226166e-04, 4.447179e-04,
E                  4.677817e-04, 4.918402e-04, 5.169278e-04, 5.430821e-04,
E                  5.703441e-04, 5.987602e-04, 6.283829e-04, 6.592730e-04,...
E            y: array([3.792794e-04, 3.997120e-04, 4.210545e-04, 4.433345e-04,
E                  4.665803e-04, 4.908210e-04, 5.160877e-04, 5.424131e-04,
E                  5.698334e-04, 5.983883e-04, 6.281231e-04, 6.590902e-04,...

../../.tox/py311/lib/python3.11/contextlib.py:81: AssertionError

Check warning on line 0 in euphonic_test.test_qpoint_phonon_modes.TestQpointPhononModesCalculateDos

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 7 runs failed: test_calculate_dos_with_mode_widths[quartz-quartz_554_full_qpoint_phonon_modes.json-quartz_554_full_mode_wid…artz_554_full_adaptive_dos_fast.json-ebins1-kwargs1] (euphonic_test.test_qpoint_phonon_modes.TestQpointPhononModesCalculateDos)

artifacts/Unit test results macos-latest/junit_report_1689933198.xml [took 0s]
artifacts/Unit test results macos-latest/junit_report_1689933662.xml [took 0s]
artifacts/Unit test results ubuntu-latest/junit_report_1689933074.xml [took 0s]
artifacts/Unit test results ubuntu-latest/junit_report_1689933341.xml [took 0s]
artifacts/Unit test results ubuntu-latest/junit_report_1689933740.xml [took 0s]
artifacts/Unit test results windows-latest/junit_report_1689933265.xml [took 0s]
artifacts/Unit test results windows-latest/junit_report_1689933706.xml [took 0s]
Raw output
AssertionError: 
Not equal to tolerance rtol=1e-07, atol=1e-13

Mismatched elements: 1548 / 1549 (99.9%)
Max absolute difference: 6.61078122e-05
Max relative difference: 0.75039491
 x: array([0.001907, 0.00195 , 0.001995, ..., 0.001682, 0.001444, 0.001241])
 y: array([0.001911, 0.001954, 0.001999, ..., 0.001689, 0.00145 , 0.001247])
self = <tests_and_analysis.test.euphonic_test.test_qpoint_phonon_modes.TestQpointPhononModesCalculateDos object at 0x1261ba8d0>
material = 'quartz'
qpt_ph_modes_json = 'quartz_554_full_qpoint_phonon_modes.json'
mode_widths_json = 'quartz_554_full_mode_widths.json'
expected_dos_json = 'quartz_554_full_adaptive_dos_fast.json'
ebins = <Quantity([0.000e+00 1.000e-01 2.000e-01 ... 1.547e+02 1.548e+02 1.549e+02], 'millielectron_volt')>
kwargs = {'adaptive_method': 'fast'}

    @pytest.mark.parametrize(
        ('material, qpt_ph_modes_json, mode_widths_json, '
         'expected_dos_json, ebins, kwargs'),
        [('quartz', 'quartz_554_full_qpoint_phonon_modes.json',
          'quartz_554_full_mode_widths.json',
          'quartz_554_full_adaptive_dos.json',
          np.arange(0, 155, 0.1)*ureg('meV'),
          {'adaptive_method': 'reference'}),
         ('quartz', 'quartz_554_full_qpoint_phonon_modes.json',
          'quartz_554_full_mode_widths.json',
          'quartz_554_full_adaptive_dos_fast.json',
          np.arange(0, 155, 0.1)*ureg('meV'),
          {'adaptive_method': 'fast'})])
    def test_calculate_dos_with_mode_widths(
            self, material, qpt_ph_modes_json, mode_widths_json,
            expected_dos_json, ebins, kwargs):
        qpt_ph_modes = get_qpt_ph_modes_from_json(material, qpt_ph_modes_json)
        mode_widths = get_mode_widths(get_fc_path(mode_widths_json))
        dos = qpt_ph_modes.calculate_dos(
            ebins, mode_widths=mode_widths, **kwargs)
        expected_dos = get_expected_spectrum1d(expected_dos_json)
>       check_spectrum1d(dos, expected_dos, y_atol=1e-13)

euphonic_test/test_qpoint_phonon_modes.py:581: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
euphonic_test/test_spectrum1d.py:105: in check_spectrum1d
    npt.assert_allclose(actual_spectrum1d.y_data.magnitude,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (<function assert_allclose.<locals>.compare at 0x12dd92840>, array([0.00190657, 0.00195013, 0.00199492, ..., 0.0016818...436 ,
       0.00124149]), array([0.00191088, 0.00195449, 0.00199931, ..., 0.00168901, 0.00145018,
       0.00124737]))
kwds = {'equal_nan': True, 'err_msg': '', 'header': 'Not equal to tolerance rtol=1e-07, atol=1e-13', 'verbose': True}

    @wraps(func)
    def inner(*args, **kwds):
        with self._recreate_cm():
>           return func(*args, **kwds)
E           AssertionError: 
E           Not equal to tolerance rtol=1e-07, atol=1e-13
E           
E           Mismatched elements: 1548 / 1549 (99.9%)
E           Max absolute difference: 6.61078122e-05
E           Max relative difference: 0.75039491
E            x: array([0.001907, 0.00195 , 0.001995, ..., 0.001682, 0.001444, 0.001241])
E            y: array([0.001911, 0.001954, 0.001999, ..., 0.001689, 0.00145 , 0.001247])

../../.tox/py311/lib/python3.11/contextlib.py:81: AssertionError

Check warning on line 0 in euphonic_test.test_qpoint_phonon_modes.TestQpointPhononModesCalculatePdos

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 7 runs failed: test_calculate_pdos_with_mode_widths[LZO-lzo_222_full_qpoint_phonon_modes.json-lzo_222_full_mode_widths.json…22_full_adaptive_fast_coh_pdos.json-ebins1-kwargs1] (euphonic_test.test_qpoint_phonon_modes.TestQpointPhononModesCalculatePdos)

artifacts/Unit test results macos-latest/junit_report_1689933198.xml [took 0s]
artifacts/Unit test results macos-latest/junit_report_1689933662.xml [took 0s]
artifacts/Unit test results ubuntu-latest/junit_report_1689933074.xml [took 0s]
artifacts/Unit test results ubuntu-latest/junit_report_1689933341.xml [took 0s]
artifacts/Unit test results ubuntu-latest/junit_report_1689933740.xml [took 0s]
artifacts/Unit test results windows-latest/junit_report_1689933265.xml [took 0s]
artifacts/Unit test results windows-latest/junit_report_1689933706.xml [took 0s]
Raw output
AssertionError: 
Not equal to tolerance rtol=1e-07, atol=1e-12

Mismatched elements: 4378 / 4378 (100%)
Max absolute difference: 0.42866704
Max relative difference: 0.10074059
 x: array([[6.858140e-02, 8.842460e-02, 1.126282e-01, ..., 2.449155e-03,
        1.989878e-03, 1.610036e-03],
       [6.857255e-02, 8.841328e-02, 1.126139e-01, ..., 2.449133e-03,...
 y: array([[6.825902e-02, 8.828774e-02, 1.127134e-01, ..., 2.381986e-03,
        1.936421e-03, 1.570540e-03],
       [6.825020e-02, 8.827643e-02, 1.126990e-01, ..., 2.381965e-03,...
self = <tests_and_analysis.test.euphonic_test.test_qpoint_phonon_modes.TestQpointPhononModesCalculatePdos object at 0x126195150>
material = 'LZO', qpt_ph_modes_json = 'lzo_222_full_qpoint_phonon_modes.json'
mode_widths_json = 'lzo_222_full_mode_widths.json'
expected_pdos_json = 'lzo_222_full_adaptive_fast_coh_pdos.json'
ebins = <Quantity([ 0.   0.5  1.   1.5  2.   2.5  3.   3.5  4.   4.5  5.   5.5  6.   6.5
  7.   7.5  8.   8.5  9.   9.5 10.  1....5
 91.  91.5 92.  92.5 93.  93.5 94.  94.5 95.  95.5 96.  96.5 97.  97.5
 98.  98.5 99.  99.5], 'millielectron_volt')>
kwargs = {'adaptive_method': 'fast'}

    @pytest.mark.parametrize(
        ('material, qpt_ph_modes_json, mode_widths_json, '
         'expected_pdos_json, ebins, kwargs'), [
            ('LZO', 'lzo_222_full_qpoint_phonon_modes.json',
             'lzo_222_full_mode_widths.json',
             'lzo_222_full_adaptive_coh_pdos.json',
             np.arange(0, 100, 0.5)*ureg('meV'),
             {'adaptive_method': 'reference'}),
            ('LZO', 'lzo_222_full_qpoint_phonon_modes.json',
             'lzo_222_full_mode_widths.json',
             'lzo_222_full_adaptive_fast_coh_pdos.json',
             np.arange(0, 100, 0.5)*ureg('meV'),
             {'adaptive_method': 'fast'})])
    def test_calculate_pdos_with_mode_widths(
            self, material, qpt_ph_modes_json, mode_widths_json,
            expected_pdos_json, ebins, kwargs):
        qpt_ph_modes = get_qpt_ph_modes_from_json(material, qpt_ph_modes_json)
        mode_widths = get_mode_widths(get_fc_path(mode_widths_json))
        pdos = qpt_ph_modes.calculate_pdos(
            ebins, mode_widths=mode_widths,
            weighting='coherent', **kwargs)
        expected_pdos = get_expected_spectrum1dcollection(expected_pdos_json)
>       check_spectrum1dcollection(pdos, expected_pdos, y_atol=1e-12)

euphonic_test/test_qpoint_phonon_modes.py:683: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
euphonic_test/test_spectrum1dcollection.py:106: in check_spectrum1dcollection
    assert_allclose(actual_spectrum.y_data.magnitude,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (<function assert_allclose.<locals>.compare at 0x12dda8680>, array([[6.85814019e-02, 8.84246010e-02, 1.12628215e-01, ....       [1.97883543e-01, 2.54606083e-01, 3.24283980e-01, ...,
        2.16154413e-04, 1.75421828e-04, 1.42149108e-04]]))
kwds = {'equal_nan': True, 'err_msg': '', 'header': 'Not equal to tolerance rtol=1e-07, atol=1e-12', 'verbose': True}

    @wraps(func)
    def inner(*args, **kwds):
        with self._recreate_cm():
>           return func(*args, **kwds)
E           AssertionError: 
E           Not equal to tolerance rtol=1e-07, atol=1e-12
E           
E           Mismatched elements: 4378 / 4378 (100%)
E           Max absolute difference: 0.42866704
E           Max relative difference: 0.10074059
E            x: array([[6.858140e-02, 8.842460e-02, 1.126282e-01, ..., 2.449155e-03,
E                   1.989878e-03, 1.610036e-03],
E                  [6.857255e-02, 8.841328e-02, 1.126139e-01, ..., 2.449133e-03,...
E            y: array([[6.825902e-02, 8.828774e-02, 1.127134e-01, ..., 2.381986e-03,
E                   1.936421e-03, 1.570540e-03],
E                  [6.825020e-02, 8.827643e-02, 1.126990e-01, ..., 2.381965e-03,...

../../.tox/py311/lib/python3.11/contextlib.py:81: AssertionError

Check warning on line 0 in euphonic_test.test_qpoint_phonon_modes.TestQpointPhononModesCalculatePdos

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 7 runs failed: test_total_dos_from_pdos_same_as_calculate_dos_with_mode_widths[quartz-quartz_554_full_qpoint_phonon_modes.j…rtz_554_full_adaptive_dos_fast.json-ebins1-kwargs1] (euphonic_test.test_qpoint_phonon_modes.TestQpointPhononModesCalculatePdos)

artifacts/Unit test results macos-latest/junit_report_1689933198.xml [took 0s]
artifacts/Unit test results macos-latest/junit_report_1689933662.xml [took 0s]
artifacts/Unit test results ubuntu-latest/junit_report_1689933074.xml [took 0s]
artifacts/Unit test results ubuntu-latest/junit_report_1689933341.xml [took 0s]
artifacts/Unit test results ubuntu-latest/junit_report_1689933740.xml [took 0s]
artifacts/Unit test results windows-latest/junit_report_1689933265.xml [took 0s]
artifacts/Unit test results windows-latest/junit_report_1689933706.xml [took 0s]
Raw output
AssertionError: 
Not equal to tolerance rtol=1e-07, atol=1e-13

Mismatched elements: 1548 / 1549 (99.9%)
Max absolute difference: 6.61078122e-05
Max relative difference: 0.7503949
 x: array([0.001907, 0.00195 , 0.001995, ..., 0.001682, 0.001444, 0.001241])
 y: array([0.001911, 0.001954, 0.001999, ..., 0.001689, 0.00145 , 0.001247])
self = <tests_and_analysis.test.euphonic_test.test_qpoint_phonon_modes.TestQpointPhononModesCalculatePdos object at 0x126195d90>
material = 'quartz'
qpt_ph_modes_json = 'quartz_554_full_qpoint_phonon_modes.json'
mode_widths_json = 'quartz_554_full_mode_widths.json'
expected_dos_json = 'quartz_554_full_adaptive_dos_fast.json'
ebins = <Quantity([0.000e+00 1.000e-01 2.000e-01 ... 1.547e+02 1.548e+02 1.549e+02], 'millielectron_volt')>
kwargs = {'adaptive_method': 'fast'}

    @pytest.mark.parametrize(
        ('material, qpt_ph_modes_json, mode_widths_json, expected_dos_json, '
         'ebins, kwargs'), [
            ('quartz', 'quartz_554_full_qpoint_phonon_modes.json',
             'quartz_554_full_mode_widths.json',
             'quartz_554_full_adaptive_dos.json',
             np.arange(0, 155, 0.1)*ureg('meV'),
             {'adaptive_method': 'reference'}),
            ('quartz', 'quartz_554_full_qpoint_phonon_modes.json',
             'quartz_554_full_mode_widths.json',
             'quartz_554_full_adaptive_dos_fast.json',
             np.arange(0, 155, 0.1)*ureg('meV'),
             {'adaptive_method': 'fast'})
        ])
    def test_total_dos_from_pdos_same_as_calculate_dos_with_mode_widths(
            self, material, qpt_ph_modes_json, mode_widths_json,
            expected_dos_json, ebins, kwargs):
        qpt_ph_modes = get_qpt_ph_modes_from_json(material, qpt_ph_modes_json)
        mode_widths = get_mode_widths(get_fc_path(mode_widths_json))
        summed_pdos = qpt_ph_modes.calculate_pdos(
            ebins, mode_widths=mode_widths, **kwargs).sum()
        expected_total_dos = get_expected_spectrum1d(expected_dos_json)
>       check_spectrum1d(summed_pdos, expected_total_dos, y_atol=1e-13)

euphonic_test/test_qpoint_phonon_modes.py:720: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
euphonic_test/test_spectrum1d.py:105: in check_spectrum1d
    npt.assert_allclose(actual_spectrum1d.y_data.magnitude,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (<function assert_allclose.<locals>.compare at 0x12dda9b20>, array([0.00190657, 0.00195013, 0.00199492, ..., 0.0016818...436 ,
       0.00124149]), array([0.00191088, 0.00195449, 0.00199931, ..., 0.00168901, 0.00145018,
       0.00124737]))
kwds = {'equal_nan': True, 'err_msg': '', 'header': 'Not equal to tolerance rtol=1e-07, atol=1e-13', 'verbose': True}

    @wraps(func)
    def inner(*args, **kwds):
        with self._recreate_cm():
>           return func(*args, **kwds)
E           AssertionError: 
E           Not equal to tolerance rtol=1e-07, atol=1e-13
E           
E           Mismatched elements: 1548 / 1549 (99.9%)
E           Max absolute difference: 6.61078122e-05
E           Max relative difference: 0.7503949
E            x: array([0.001907, 0.00195 , 0.001995, ..., 0.001682, 0.001444, 0.001241])
E            y: array([0.001911, 0.001954, 0.001999, ..., 0.001689, 0.00145 , 0.001247])

../../.tox/py311/lib/python3.11/contextlib.py:81: AssertionError

Check warning on line 0 in euphonic_test.test_spectrum1d.TestSpectrum1DMethods

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 7 runs failed: test_variable_broadening_consistent (euphonic_test.test_spectrum1d.TestSpectrum1DMethods)

artifacts/Unit test results macos-latest/junit_report_1689933198.xml [took 0s]
artifacts/Unit test results macos-latest/junit_report_1689933662.xml [took 0s]
artifacts/Unit test results ubuntu-latest/junit_report_1689933074.xml [took 0s]
artifacts/Unit test results ubuntu-latest/junit_report_1689933341.xml [took 0s]
artifacts/Unit test results ubuntu-latest/junit_report_1689933740.xml [took 0s]
artifacts/Unit test results windows-latest/junit_report_1689933265.xml [took 0s]
artifacts/Unit test results windows-latest/junit_report_1689933706.xml [took 0s]
Raw output
ValueError: Target error is out of fit range; value must lie in range [2.28139129e-05 9.99310660e-02].
self = <tests_and_analysis.test.euphonic_test.test_spectrum1d.TestSpectrum1DMethods object at 0x125f164d0>

    def test_variable_broadening_consistent(self):
        """Check variable broadening is consistent with fixed-width method"""
        spec1d = get_spectrum1d('quartz_666_dos.json')
    
        sigma = 2 * ureg('meV')
        fwhm = 2.3548200450309493 * sigma
    
        def sigma_function(x):
            poly = Polynomial([sigma.magnitude, 0., 0.])
            return poly(x.to(sigma.units).magnitude) * sigma.units
    
        def fwhm_function(x):
            poly = Polynomial([fwhm.magnitude, 0., 0.])
            return poly(x.to(fwhm.units).magnitude) * fwhm.units
    
        fixed_broad = spec1d.broaden(fwhm)
>       variable_broad_sigma = spec1d.broaden(
            sigma_function, width_convention='std',
            width_interpolation_error=1e-5)

euphonic_test/test_spectrum1d.py:428: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../.tox/py311/lib/python3.11/site-packages/euphonic/spectra.py:625: in broaden
    y_broadened = variable_width_broadening(
../../.tox/py311/lib/python3.11/site-packages/euphonic/broadening.py:95: in variable_width_broadening
    return width_interpolated_broadening(bins, x, widths,
../../.tox/py311/lib/python3.11/site-packages/euphonic/broadening.py:149: in width_interpolated_broadening
    return _width_interpolated_broadening(bins.to('hartree').magnitude,
../../.tox/py311/lib/python3.11/site-packages/euphonic/broadening.py:214: in _width_interpolated_broadening
    spacing = _get_spacing(adaptive_error, shape=shape, fit=fit)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

error = 1e-05, shape = 'gauss', fit = 'cheby-log'

    def _get_spacing(error, shape='gauss', fit='cheby-log'):
        """
        Determine suitable spacing value for mode_width given accepted error level
    
        Coefficients have been fitted to plots of error vs spacing value
        """
    
        if fit == 'cubic' and shape == 'gauss':
            return np.polyval([612.7, -122.7, 15.40, 1.0831], error)
    
        elif fit == 'cheby-log':
            if shape == 'lorentz':
                cheby = Chebyshev(
                    [1.31311372, 0.41624683, 0.17961194, 0.06253194,
                     0.0195309, 0.00555107, 0.00225896],
                    window=[-1.,  1.],
                    domain=[-4.04691274, -1.34655197])
                # Updated params from paper:
                # [1.26039672 0.39900457 0.20392176 0.08602507
                #  0.03337662 0.00878684 0.00619626]
                # window: [-1.  1.]  domain: [-4.99146317 -1.34655197]
    
            elif shape == 'gauss':
                cheby = Chebyshev(
                    [1.25885858, 0.39803148, 0.20311735,
                     0.08654827, 0.03447873, 0.00894006],
                    window=[-1., 1.],
                    domain=[-4.64180022, -1.00029948])
    
            log_error = np.log10(error)
            if log_error < cheby.domain[0] or log_error > cheby.domain[1]:
>               raise ValueError("Target error is out of fit range; value must lie"
                                 f" in range {np.power(10, cheby.domain)}.")
E               ValueError: Target error is out of fit range; value must lie in range [2.28139129e-05 9.99310660e-02].

../../.tox/py311/lib/python3.11/site-packages/euphonic/broadening.py:193: ValueError

Check warning on line 0 in euphonic_test.test_spectrum2d.TestSpectrum2DMethods

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 7 runs failed: test_broaden[args6-synthetic_x.json-synthetic_x_poly_broadened.json] (euphonic_test.test_spectrum2d.TestSpectrum2DMethods)

artifacts/Unit test results macos-latest/junit_report_1689933198.xml [took 2s]
artifacts/Unit test results macos-latest/junit_report_1689933662.xml [took 3s]
artifacts/Unit test results ubuntu-latest/junit_report_1689933074.xml [took 1s]
artifacts/Unit test results ubuntu-latest/junit_report_1689933341.xml [took 1s]
artifacts/Unit test results ubuntu-latest/junit_report_1689933740.xml [took 1s]
artifacts/Unit test results windows-latest/junit_report_1689933265.xml [took 2s]
artifacts/Unit test results windows-latest/junit_report_1689933706.xml [took 3s]
Raw output
AssertionError: 
Not equal to tolerance rtol=1e-07, atol=2.22045e-16

Mismatched elements: 8894 / 9801 (90.7%)
Max absolute difference: 4.40425389e-05
Max relative difference: 562.9499794
 x: array([[1.271113e-02, 1.266972e-02, 1.254630e-02, ..., 2.153915e-02,
        9.653266e-02, 1.591558e-01],
       [7.709676e-03, 7.684556e-03, 7.609698e-03, ..., 1.306413e-02,...
 y: array([[1.271012e-02, 1.266845e-02, 1.254429e-02, ..., 2.153916e-02,
        9.653264e-02, 1.591557e-01],
       [7.709062e-03, 7.683788e-03, 7.608480e-03, ..., 1.306413e-02,...
self = <tests_and_analysis.test.euphonic_test.test_spectrum2d.TestSpectrum2DMethods object at 0x125f8d710>
args = {'x_width': <function TestSpectrum2DMethods.<lambda> at 0x1233f3600>, 'y_width': <function TestSpectrum2DMethods.<lambda> at 0x1233f36a0>}
spectrum2d_file = 'synthetic_x.json'
broadened_spectrum2d_file = 'synthetic_x_poly_broadened.json'

    @pytest.mark.parametrize(
        'args, spectrum2d_file, broadened_spectrum2d_file', [
            (({'x_width': 0.1*ureg('1/angstrom'), 'method': 'convolve'}),
             'quartz_bandstructure_sqw.json',
             'quartz_bandstructure_0.1ang_xbroaden_sqw.json'),
            (({'y_width': 2*ureg('meV')}),
             'quartz_bandstructure_sqw.json',
             'quartz_bandstructure_2meV_ybroaden_sqw.json'),
            (({'x_width': 0.1*ureg('1/angstrom'), 'y_width': 2*ureg('meV'),
               'method': 'convolve'}),
             'quartz_bandstructure_sqw.json',
             'quartz_bandstructure_2meV_0.1ang_xybroaden_sqw.json'),
            (({'x_width': 0.1*ureg('1/angstrom'), 'y_width': 2*ureg('meV'),
                'shape': 'lorentz', 'method': 'convolve'}),
             'quartz_bandstructure_sqw.json',
             'quartz_bandstructure_xybroaden_lorentz_sqw.json'),
            (({'x_width': 0.2*ureg('1/angstrom'), 'y_width': 1.5*ureg('meV'),
               'shape': 'gauss'}),
             'lzo_57L_bragg_sqw.json',
             'lzo_57L_1.5meV_0.1ang_gauss_sqw.json'),
            (({'x_width': 0.2*ureg('1/angstrom'), 'y_width': 1.5*ureg('meV'),
               'shape': 'lorentz'}),
             'lzo_57L_bragg_sqw.json',
             'lzo_57L_1.5meV_0.1ang_lorentz_sqw.json'),
            (({'x_width': (lambda x: np.polyval([0.2, -0.5],
                                                x.to('1/nm').magnitude
                                                ) * ureg('1/nm')),
               'y_width': (lambda y: np.polyval([0., -0.4, 3.],
                                                y.to('J').magnitude
                                                ) * ureg('J')),
               },
              'synthetic_x.json', 'synthetic_x_poly_broadened.json'))])
    def test_broaden(self, args, spectrum2d_file, broadened_spectrum2d_file):
        spec2d = get_spectrum2d(spectrum2d_file)
        expected_broadened_spec2d = get_spectrum2d(broadened_spectrum2d_file)
        broadened_spec2d = spec2d.broaden(**args)
>       check_spectrum2d(broadened_spec2d, expected_broadened_spec2d)

euphonic_test/test_spectrum2d.py:349: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
euphonic_test/test_spectrum2d.py:113: in check_spectrum2d
    npt.assert_allclose(actual_spectrum2d.z_data.magnitude,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (<function assert_allclose.<locals>.compare at 0x12c8b2ac0>, array([[1.27111333e-02, 1.26697174e-02, 1.25462981e-02, ....       [6.98630429e-04, 7.42474958e-04, 7.82780554e-04, ...,
        1.53231690e-10, 2.22181324e-13, 6.66220897e-17]]))
kwds = {'equal_nan': False, 'err_msg': '', 'header': 'Not equal to tolerance rtol=1e-07, atol=2.22045e-16', 'verbose': True}

    @wraps(func)
    def inner(*args, **kwds):
        with self._recreate_cm():
>           return func(*args, **kwds)
E           AssertionError: 
E           Not equal to tolerance rtol=1e-07, atol=2.22045e-16
E           
E           Mismatched elements: 8894 / 9801 (90.7%)
E           Max absolute difference: 4.40425389e-05
E           Max relative difference: 562.9499794
E            x: array([[1.271113e-02, 1.266972e-02, 1.254630e-02, ..., 2.153915e-02,
E                   9.653266e-02, 1.591558e-01],
E                  [7.709676e-03, 7.684556e-03, 7.609698e-03, ..., 1.306413e-02,...
E            y: array([[1.271012e-02, 1.266845e-02, 1.254429e-02, ..., 2.153916e-02,
E                   9.653264e-02, 1.591557e-01],
E                  [7.709062e-03, 7.683788e-03, 7.608480e-03, ..., 1.306413e-02,...

../../.tox/py311/lib/python3.11/contextlib.py:81: AssertionError