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

Division by zero error in indicators. #637

Open
muazhari opened this issue Aug 16, 2024 · 0 comments
Open

Division by zero error in indicators. #637

muazhari opened this issue Aug 16, 2024 · 0 comments

Comments

@muazhari
Copy link
Contributor

muazhari commented Aug 16, 2024

Reproducible:
image
image

Suggestion:

  • Try to fix it by adding an exception in
    # if both are equal then set the upper bound to none (always the 0 or lower bound will be returned then)
    xu[xl == xu] = np.nan
    # store the lower and upper bounds
    self.xl, self.xu = xl, xu
    # check out when the input values are nan
    xl_nan, xu_nan = np.isnan(xl), np.isnan(xu)
    # now create all the masks that are necessary
    self.xl_only, self.xu_only = np.logical_and(~xl_nan, xu_nan), np.logical_and(xl_nan, ~xu_nan)
    self.both_nan = np.logical_and(np.isnan(xl), np.isnan(xu))
    self.neither_nan = ~self.both_nan
  • Try to fix it using epsilon, i.e. norm[norm==0] = np.finfo(norm.dtype).eps
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