File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Orange/widgets/visualize/utils Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -113,7 +113,16 @@ def apply(self, data) -> np.ndarray:
113113 low , high = self .span
114114 low , high = self .adjust_levels (low , high )
115115 mask = np .isnan (data )
116- normalized = (data - low ) / (high - low )
116+ 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
117126 normalized = np .clip (normalized , 0 , 1 , out = normalized )
118127 table = np .empty_like (normalized , dtype = np .uint8 )
119128 ncolors = len (self .colortable )
You can’t perform that action at this time.
0 commit comments