We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 293a9e0 commit 667eba3Copy full SHA for 667eba3
1 file changed
Orange/widgets/visualize/utils/heatmap.py
@@ -113,7 +113,16 @@ def apply(self, data) -> np.ndarray:
113
low, high = self.span
114
low, high = self.adjust_levels(low, high)
115
mask = np.isnan(data)
116
- normalized = (data - low) / (high - low)
+ normalized = data - low
117
+ finfo = np.finfo(normalized.dtype)
118
+ if high - low <= 1 / finfo.max:
119
+ n_fact = finfo.max
120
+ else:
121
+ n_fact = 1. / (high - low)
122
+ # over/underflow to inf are expected and cliped with the rest in the
123
+ # next step
124
+ with np.errstate(over="ignore", under="ignore"):
125
+ normalized *= n_fact
126
normalized = np.clip(normalized, 0, 1, out=normalized)
127
table = np.empty_like(normalized, dtype=np.uint8)
128
ncolors = len(self.colortable)
0 commit comments