Skip to content

Commit

Permalink
middle focus for multislice
Browse files Browse the repository at this point in the history
  • Loading branch information
smribet committed Oct 26, 2023
1 parent c41c386 commit 20bc041
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions py4DSTEM/process/phase/iterative_multislice_ptychography.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,11 @@ class MultislicePtychographicReconstruction(PtychographicReconstruction):
Probe positions in Å for each diffraction intensity
If None, initialized to a grid scan
theta_x: float
x tilt of propagator (in angles)
x tilt of propagator (in angles)
theta_y: float
y tilt of propagator (in angles)
y tilt of propagator (in angles)
middle_focus: bool
if True, adds half the sample thickness to the defocus
object_type: str, optional
The object can be reconstructed as a real potential ('potential') or a complex
object ('complex')
Expand Down Expand Up @@ -117,6 +119,7 @@ def __init__(
initial_scan_positions: np.ndarray = None,
theta_x: float = 0,
theta_y: float = 0,
middle_focus: bool = False,
object_type: str = "complex",
verbose: bool = True,
device: str = "cpu",
Expand Down Expand Up @@ -150,6 +153,25 @@ def __init__(
if (key not in polar_symbols) and (key not in polar_aliases.keys()):
raise ValueError("{} not a recognized parameter".format(key))

if np.isscalar(slice_thicknesses):
mean_slice_thickness = slice_thicknesses
else:
mean_slice_thickness = np.mean(slice_thicknesses)

if middle_focus:
if "defocus" in kwargs:
kwargs["defocus"] += mean_slice_thickness * num_slices / 2
elif "C10" in kwargs:
kwargs["C10"] -= mean_slice_thickness * num_slices / 2
elif polar_parameters is not None and "defocus" in polar_parameters:
polar_parameters["defocus"] = (
polar_parameters["defocus"] + mean_slice_thickness * num_slices / 2
)
elif polar_parameters is not None and "C10" in polar_parameters:
polar_parameters["C10"] = (
polar_parameters["C10"] - mean_slice_thickness * num_slices / 2
)

self._polar_parameters = dict(zip(polar_symbols, [0.0] * len(polar_symbols)))

if polar_parameters is None:
Expand Down

0 comments on commit 20bc041

Please sign in to comment.