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

Clean Figure: Handle case if all data is nan #570

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

LeanderK
Copy link

@LeanderK LeanderK commented Feb 10, 2023

I noticed a bug in _remove_NaNs.

the faulty code:

    id_nan = np.any(np.isnan(data), axis=1)
    (....)

    id_first = np.argwhere(np.logical_not(id_nan))[0]

I have a plot where data is array([[nan, nan]], dtype=float32), which results in np.argwhere(np.logical_not(id_nan)) returning array([], shape=(0, 1), dtype=int64). Therefore taking np.argwhere(np.logical_not(id_nan))[0] results in an index out of bounds exception (there is no first index).

This fixes the problem.

@st--
Copy link

st-- commented May 6, 2023

@LeanderK would be great if you could add a test case for the bug (i.e., set up a minimal example with nan data, which would fail with the released code but works with this patch applied).

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

Successfully merging this pull request may close these issues.

2 participants