Skip to content

Commit

Permalink
scaled values
Browse files Browse the repository at this point in the history
  • Loading branch information
smribet committed Sep 29, 2024
1 parent ff0c72c commit e58b6e7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions py4DSTEM/tomography/tomography.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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):
"""
Expand Down

0 comments on commit e58b6e7

Please sign in to comment.