@@ -390,26 +390,27 @@ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0,
390
390
# float64's ability to represent changes. Applying
391
391
# a norm first would be good, but ruins the interpolation
392
392
# of over numbers.
393
- if self .norm .vmin is not None and self .norm .vmax is not None :
394
- dv = (np .float64 (self .norm .vmax ) -
395
- np .float64 (self .norm .vmin ))
396
- vmid = self .norm .vmin + dv / 2
397
- newmin = vmid - dv * 1.e7
398
- if newmin < a_min :
399
- newmin = None
400
- else :
401
- a_min = np .float64 (newmin )
402
- newmax = vmid + dv * 1.e7
403
- if newmax > a_max :
404
- newmax = None
405
- else :
406
- a_max = np .float64 (newmax )
407
- if newmax is not None or newmin is not None :
408
- A_scaled = np .clip (A_scaled , newmin , newmax )
393
+ self .norm .autoscale_None (A )
394
+ dv = (np .float64 (self .norm .vmax ) -
395
+ np .float64 (self .norm .vmin ))
396
+ vmid = self .norm .vmin + dv / 2
397
+ fact = 1e7 if scaled_dtype == np .float64 else 1e4
398
+ newmin = vmid - dv * fact
399
+ if newmin < a_min :
400
+ newmin = None
401
+ else :
402
+ a_min = np .float64 (newmin )
403
+ newmax = vmid + dv * fact
404
+ if newmax > a_max :
405
+ newmax = None
406
+ else :
407
+ a_max = np .float64 (newmax )
408
+ if newmax is not None or newmin is not None :
409
+ A_scaled = np .clip (A_scaled , newmin , newmax )
409
410
410
411
A_scaled -= a_min
411
412
# a_min and a_max might be ndarray subclasses so use
412
- # asscalar to ensure they are scalars to avoid errors
413
+ # asscalar to avoid errors
413
414
a_min = np .asscalar (a_min .astype (scaled_dtype ))
414
415
a_max = np .asscalar (a_max .astype (scaled_dtype ))
415
416
0 commit comments