AxFoundation/strax

Bug observed in a corner case of `conditional_entropy`

Opened this issue · 0 comments

Describe the bug
Originally from https://github.com/AxFoundation/strax/actions/runs/8616664551/job/23614765492?pr=816.

Because that log of GitHub action will not be kept forever, I copy-paste the information here:

=========================== short test summary info ============================
FAILED tests/test_hitlet.py::test_conditional_entropy - AssertionError: Hitlet entropy is -279097920.0, but expected np.nan
assert False
 +  where False = <ufunc 'isnan'>(-279097920.0)
 +    where <ufunc 'isnan'> = np.isnan
Falsifying example: test_conditional_entropy(
    data=array([-1.0000001,  0.       , -1.       ,  1.0000001,  1.       ,
            0.       ,  0.       ,  0.       ], dtype=float32),
    size_template_and_ind_max_template=[0, 1],  # or any other generated value
)

You can reproduce this example by temporarily adding @reproduce_failure('6.98.15', b'AXicY2dkYGBgbAASDA5ABhMQM0AAIyMzkITLsDDAASMDMmAEAEo/AZo=') as a decorator on your test case
=========== 1 failed, 188 passed, 114 warnings in 558.93s (0:09:18) ============

Though the bug is observed in a PR, the error can be reproduced in master branch with commit hash: a1e921f.

To Reproduce
Decorate test_conditional_entropy by:

@reproduce_failure('6.98.15', b'AXicY2dkYGBgbAASDA5ABhMQM0AAIyMzkITLsDDAASMDMmAEAEo/AZo=')

then run pytest -xv ./tests/ -k test_conditional_entropy at the top level of strax repo.

Error:

============================================== short test summary info ==============================================
FAILED tests/test_hitlet.py::test_conditional_entropy - AssertionError: Hitlet entropy is -279097920.0, but expected np.nan
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
========================================= 1 failed, 188 deselected in 2.18s =========================================

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Versions
a1e921f