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

How to handle nan values in refined multiscale entropy ? #17

Open
JulianKlug opened this issue Dec 5, 2024 · 0 comments
Open

How to handle nan values in refined multiscale entropy ? #17

JulianKlug opened this issue Dec 5, 2024 · 0 comments

Comments

@JulianKlug
Copy link

Given a sequence, how should nan values be handled for multiscale entropy?

Current behavior will raise an unhelpful error as r will be undefined: AssertionError: r: must be a positive value

This is due to the handling of nan in the used numpy functions, which will result in nan.

    if RadNew > 0:
        if RadNew == 1:
            Rnew = lambda x: np.std(x)
        elif RadNew == 2:
            Rnew = lambda x: np.var(x)
        elif RadNew == 3:
            Rnew = lambda x: np.mean(abs(x-np.mean(x)))
        elif RadNew == 4:
            Rnew = lambda x: np.median(abs(x-np.median(x)))   

as well as of the behavior of the function refined()

To solve this, what is considered best practice for the handling of nan in a signal before entropy computation?

(and maybe at the beginning of the function, nan's should be checked to have a more helpful error?)

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

No branches or pull requests

1 participant