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

Progress bar fails with ZeroDivisionError using a small number of observations #35

Closed
vc1492a opened this issue Apr 15, 2020 · 2 comments
Labels
bug Something isn't working high priority This issue is a high priority relative to other open issues

Comments

@vc1492a
Copy link
Owner

vc1492a commented Apr 15, 2020

The below line contained within PyNomaly/loop.py fails with a ZeroDivisionError when the total number of observations is less than the terminal or cell width where the code was executed.

if index % block_size == 0:

The cause is a block_size of 0, which is not allowable with the current implementation.

This can be resolved by changing the code to the following:

    if total < w:
        block_size = int(w / total)
    else:
        block_size = int(total / w)

if index % block_size == 0:

Which will ensure the block_size remains greater than 0 even when the number of observations is less than the width of the terminal / cell window.

@vc1492a vc1492a added the bug Something isn't working label Apr 15, 2020
@vc1492a
Copy link
Owner Author

vc1492a commented Apr 16, 2020

A unit test has been written in a separate library to ensure that the progress bar is exhibiting the proper behavior when utilized, and can be included as part of the patch for this issue.

@vc1492a vc1492a added high priority This issue is a high priority relative to other open issues in progress This issue is being actively worked on labels May 29, 2020
@vc1492a
Copy link
Owner Author

vc1492a commented May 30, 2020

Added as part of version 0.3.3.

@vc1492a vc1492a closed this as completed May 30, 2020
@vc1492a vc1492a removed the in progress This issue is being actively worked on label Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working high priority This issue is a high priority relative to other open issues
Projects
None yet
Development

No branches or pull requests

1 participant