Skip to content

Commit

Permalink
Merge pull request #508 from bsavitzky/vispatch
Browse files Browse the repository at this point in the history
patches logscale vis bug
  • Loading branch information
cophus authored Aug 29, 2023
2 parents d9daf5d + c61ae87 commit 3d038c1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions py4DSTEM/visualize/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,9 @@ def show(
_ar = np.zeros_like(ar.data, dtype=float)
_ar[_mask] = np.log(ar.data[_mask])
_ar[~_mask] = np.nan
if clipvals == "absolute":
if np.all(np.isnan(_ar)):
_ar[:, :] = 0
if intensity_range == "absolute":
if vmin != None:
if vmin > 0.0:
vmin = np.log(vmin)
Expand Down Expand Up @@ -536,7 +538,9 @@ def show(
if vmax is None:
vmax = 0.98
if masked_intensity_range:
vals = np.sort(_ar[np.logical_and(~np.isnan(_ar), _ar.mask == False)])
vals = np.sort(
_ar[np.logical_and(~np.isnan(_ar), np.logical_not(_ar.mask))]
)
else:
vals = np.sort(_ar.data[~np.isnan(_ar)])
ind_vmin = np.round((vals.shape[0] - 1) * vmin).astype("int")
Expand Down

0 comments on commit 3d038c1

Please sign in to comment.