Skip to content

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