From e58b6e722767017edd1c6a8a5e11fdec485b77d5 Mon Sep 17 00:00:00 2001 From: smribet Date: Sun, 29 Sep 2024 15:12:47 -0700 Subject: [PATCH] scaled values --- py4DSTEM/tomography/tomography.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/py4DSTEM/tomography/tomography.py b/py4DSTEM/tomography/tomography.py index f1ab75d85..c643ee365 100644 --- a/py4DSTEM/tomography/tomography.py +++ b/py4DSTEM/tomography/tomography.py @@ -13,6 +13,7 @@ from py4DSTEM.process.diffraction import Crystal from py4DSTEM.process.phase.utils import copy_to_device from py4DSTEM.utils import fourier_resample +from py4DSTEM.visualize import return_scaled_histogram_ordering from scipy.ndimage import rotate, zoom from scipy.spatial.transform import Rotation as R @@ -306,7 +307,7 @@ def reconstruct( zero_edges: bool If True, zero edges along y and z baseline_thresh: float - If not None, data is cropped below threshold. Value is fraction of max. + If not None, data is cropped below threshold. Value is percentile of object. """ device = self._device @@ -1511,7 +1512,7 @@ def _constraints(self, zero_edges: bool, baseline_thresh: float): zero_edges: bool If True, zero edges along y and z baseline_thresh: float - If not None, data is cropped below threshold. Value is fraction of max. + If not None, data is cropped below threshold. Value is percentile of object. """ if zero_edges: xp = self._xp_storage @@ -1528,9 +1529,9 @@ def _constraints(self, zero_edges: bool, baseline_thresh: float): self._object[:, ind_zero] = 0 if baseline_thresh is not None: - baseline_thresh *= self._object.max() + _, vmin, _ = return_scaled_histogram_ordering(self._object, vmin = baseline_thresh) xp = self._xp_storage - self._object = xp.clip(self._object - baseline_thresh, 0, np.inf) + self._object = xp.clip(self._object - vmin, 0, np.inf) def set_storage(self, storage): """