Skip to content

Commit

Permalink
Not ignoring division by zero until Orange allows numpy>2.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
borondics committed Nov 15, 2024
1 parent 2b5fc7b commit bc46ac2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions orangecontrib/spectroscopy/widgets/owcos.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ def calc_cos(table1, table2):

# Hilbert-Noda transformation matrix
i, j = np.ogrid[:len(series1), :len(series1)]
with np.errstate(divide='ignore'):
hn = np.where(i != j, 1 / (np.pi * (j - i)), 0)

# TODO - We could use the code below after allowing numpy>2.0
# with np.errstate(divide='ignore'):
hn = np.where(i != j, 1 / (np.pi * (j - i)), 0)

# asynchronous correlation
asyn = series1.T @ hn @ series2 / (len(series1) - 1)
Expand Down

0 comments on commit bc46ac2

Please sign in to comment.