Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit test 3 fails #52

Closed
mailhexu opened this issue Jul 2, 2023 · 3 comments
Closed

Unit test 3 fails #52

mailhexu opened this issue Jul 2, 2023 · 3 comments

Comments

@mailhexu
Copy link

mailhexu commented Jul 2, 2023

I run the unit tests and it seems the test3 failed. I attach the log below.
FYI, I tested on ubuntu23.04/gfortran 12.2/ openblas 0.3.21 /AMD Ryzen 3500U.

Log:

Test project /home/hexu/projects/greenX/build
Start 1: UNITTEST_test_pade_approximant
1/3 Test #1: UNITTEST_test_pade_approximant ... Passed 0.00 sec
Start 2: test_gx_minimax_grid
2/3 Test #2: test_gx_minimax_grid ............. Passed 1.78 sec
Start 3: test_gx_tabulate_minimax
3/3 Test #3: test_gx_tabulate_minimax .........***Failed 6.40 sec
============================= test session starts ==============================
platform linux -- Python 3.11.2, pytest-7.2.1, pluggy-1.0.0+repack
rootdir: /home/hexu/projects/greenX/build
plugins: xonsh-0.13.4
collected 1 item

test_gx_tabulate_minimax.py Binary source: /home/hexu/projects/greenX/build/bin/gx_tabulate_grids.exe
FTestdir: /tmp/pytest-of-hexu/pytest-3/test_tabulate_gx_minimax_grid0

=================================== FAILURES ===================================
________________________ test_tabulate_gx_minimax_grid _________________________

fortran_binary = PosixPath('/home/hexu/projects/greenX/build/bin/gx_tabulate_grids.exe')

def test_tabulate_gx_minimax_grid(fortran_binary):

    e_trans = ETrans(0.4, 100.0)

    ref_errors_small_grid = np.array([[6,  0, 2.51200821E-04, 1.88667240E-03, 6.86380679E-03, 5.56242714E-02, 2.50000000E+02],
                                      [8,  0, 9.26518238E-04, 7.02310800E-04, 8.97132915E-04, 1.49383520E-02, 2.50000000E+02],
                                      [10, 0, 2.93904398E-02, 4.15097815E-04, 9.85375147E-04, 3.87442807E-03, 2.50000000E+02],
                                      [12, 0, 1.22980779E-03, 5.40966369E-05, 3.23113268E-05, 9.86318209E-04, 2.50000000E+02],
                                      [14, 0, 1.23655331E-03, 1.47661838E-05, 6.49328520E-06, 2.46521564E-04, 2.50000000E+02],
                                      [16, 0, 3.23839478E-03, 4.75444516E-06, 7.88188993E-07, 7.70304736E-05, 2.50000000E+02],
                                      [18, 0, 6.23300174E-03, 1.34768466E-06, 3.45186001E-07, 1.94942501E-05, 2.50000000E+02],
                                      [20, 0, 2.62469251E-03, 2.86296043E-07, 3.67016068E-08, 4.88850816E-06, 2.50000000E+02],
                                      [22, 0, 1.90928278E-02, 6.87320737E-08, 2.59110779E-07, 2.68402248E-07, 2.50000000E+02]])

    ref_errors_big_grid = np.array([[24, 0, 2.49244180E-02, 1.41793908E-08, 1.44000650E-08, 1.31534820E-07, 2.50000000E+02],
                                    [26, 0, 2.64119033E-01, 4.12358436E-09, 4.74668548E-09, 3.78405299E-08, 2.50000000E+02],
                                    [28, 0, 4.13766945E+04, 3.93976513E-09, 5.94764298E-09, 4.30436032E-08, 2.50000000E+02],
                                    [30, 0, 1.24498840E+06, 4.50563448E-09, 3.15970462E-08, 5.14232632E-08, 2.50000000E+02],
                                    [32, 0, 1.29256892E+06, 4.17286994E-09, 6.30107694E-08, 4.94132290E-08, 2.50000000E+02],
                                    [34, 0, 1.32139161E+06, 8.10191277E-09, 3.86664983E-07, 6.66088501E-08, 2.50000000E+02]])

    tabulated_errors = get_tabulated_errors(fortran_binary, e_trans)
    tabulated_errors_small_grids = tabulated_errors[0:9, :]
    tabulated_errors_large_grids = tabulated_errors[9:, :]

    # Grids for which values do not get large or very small
    assert np.allclose(tabulated_errors_small_grids[:, Column.CosFTDualityError.value],
                       ref_errors_small_grid[:, Column.CosFTDualityError.value])

    assert np.allclose(tabulated_errors_small_grids[:, Column.MaxErrCosFTTimeToFreq.value],
                       ref_errors_small_grid[:, Column.MaxErrCosFTTimeToFreq.value])

    assert np.allclose(tabulated_errors_small_grids[:, Column.MaxErrCosFTFreqToTime.value],
                       ref_errors_small_grid[:, Column.MaxErrCosFTFreqToTime.value])

    assert np.allclose(tabulated_errors_small_grids[:, Column.MaxErrSinFTimeToFreq.value],
                       ref_errors_small_grid[:, Column.MaxErrSinFTimeToFreq.value])

    # Grids for which values do get large or very small
    assert np.allclose(tabulated_errors_large_grids[:, Column.MaxErrCosFTTimeToFreq.value],
                       ref_errors_big_grid[:, Column.MaxErrCosFTTimeToFreq.value],
                       atol=1.e-7)
  assert np.allclose(tabulated_errors_large_grids[:, Column.MaxErrCosFTFreqToTime.value],
                       ref_errors_big_grid[:, Column.MaxErrCosFTFreqToTime.value],
                       atol=1.e-7)

E assert False
E + where False = <function allclose at 0x7fb559e44a40>(array([1.44000655e-08, 4.74668609e-09, 5.94594904e-09, 7.14314387e-09,\n 1.21514300e-08, 6.46172347e-08]), array([1.44000650e-08, 4.74668548e-09, 5.94764298e-09, 3.15970462e-08,\n 6.30107694e-08, 3.86664983e-07]), atol=1e-07)
E + where <function allclose at 0x7fb559e44a40> = np.allclose

/home/hexu/projects/greenX/build/test/time-frequency/test_gx_tabulate_minimax.py:116: AssertionError
=========================== short test summary info ============================
FAILED test_gx_tabulate_minimax.py::test_tabulate_gx_minimax_grid - assert False
============================== 1 failed in 4.74s ===============================

67% tests passed, 1 tests failed out of 3

Total Test time (real) = 8.19 sec

The following tests FAILED:
3 - test_gx_tabulate_minimax (Failed)

@aziziph
Copy link
Contributor

aziziph commented Jul 4, 2023

@fdelesma
Could you please take care of this?

@AlexBuccheri
Copy link
Member

AlexBuccheri commented Jul 4, 2023

This is the last element of the array, with a diff of 3.2e-7. Just increase the tolerance slightly:

  • Change atol to 5.e-7

@fdelesma
Copy link
Contributor

fdelesma commented Jul 4, 2023

Could you review the request #53 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants