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

Bug occuring with way values are being fixed in enable code #3

Open
armenbod opened this issue Mar 13, 2024 · 1 comment
Open

Bug occuring with way values are being fixed in enable code #3

armenbod opened this issue Mar 13, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@armenbod
Copy link

When getting combined quality score there is this snippet:

# Try to ensure numerical errors do not affect the result
vals[vals == np.inf] = 0
vals[vals == -np.inf] = 0

However vals is a list, not a numpy array, so the behaviour of this code is not right. A toy example would be:

vals = [2, 3, np.inf]
vals[vals == np.inf] = 0
vals[vals == -np.inf] = 0

print(vals)

>>> [0, 3, inf]

Can be fixed either by converting to numpy array or changing to list comprehension:

vals = np.array([2, 3, np.inf])
vals[vals == np.inf] = 0
vals[vals == -np.inf] = 0

print(vals)

>>> [2, 3, 0]

or

vals = [2, 3, np.inf]

vals = [0 if x == np.inf else x for x in vals]
vals = [0 if x == -np.inf else x for x in vals]

print(vals)

>>> [2, 3, 0]
@mcraig-ibme mcraig-ibme self-assigned this May 10, 2024
@mcraig-ibme mcraig-ibme added the bug Something isn't working label May 10, 2024
@mcraig-ibme
Copy link
Contributor

Agreed, will fix in bitbucket and here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants