Fix slice figures with many zeros
the bug was triggered when many pixels are zero valued: taking log of 0 in quantize()
This commit is contained in:
parent
eccbd68f03
commit
b7a97bbcdc
@ -62,12 +62,12 @@ def plt_slices(*fields, size=64, title=None, cmap=None, norm=None, **kwargs):
|
|||||||
w1, w2 = (h1 - l1) / 2, (h2 - l2) / 2
|
w1, w2 = (h1 - l1) / 2, (h2 - l2) / 2
|
||||||
|
|
||||||
if all_non_neg:
|
if all_non_neg:
|
||||||
if h1 > 0.1 * h2:
|
if h1 > 0.1 * h2 or l2 == 0:
|
||||||
norm_col = Normalize(vmin=0, vmax=quantize(h2))
|
norm_col = Normalize(vmin=0, vmax=quantize(h2))
|
||||||
else:
|
else:
|
||||||
norm_col = LogNorm(vmin=quantize(l2), vmax=quantize(h2))
|
norm_col = LogNorm(vmin=quantize(l2), vmax=quantize(h2))
|
||||||
elif all_non_pos:
|
elif all_non_pos:
|
||||||
if l1 < 0.1 * l2:
|
if l1 < 0.1 * l2 or h2 == 0:
|
||||||
norm_col = Normalize(vmin=-quantize(-l2), vmax=0)
|
norm_col = Normalize(vmin=-quantize(-l2), vmax=0)
|
||||||
else:
|
else:
|
||||||
norm_col = SymLogNorm(linthresh=quantize(-h2),
|
norm_col = SymLogNorm(linthresh=quantize(-h2),
|
||||||
|
Loading…
Reference in New Issue
Block a user