object#
Functions related to creating and manipulating ptychographic object arrays.
Ptychographic objects are stored as a single complex array which represent the complex refractive indices in the field of view.
- class tike.ptycho.object.ObjectOptions[source]#
Bases:
object
Manage data and setting related to object correction.
- __init__(convergence_tolerance=0, positivity_constraint=0, smoothness_constraint=0, use_adaptive_moment=False, vdecay=0.999, mdecay=0.9, clip_magnitude=False)#
- Parameters
convergence_tolerance (float) –
positivity_constraint (float) –
smoothness_constraint (float) –
use_adaptive_moment (bool) –
vdecay (float) –
mdecay (float) –
clip_magnitude (bool) –
- Return type
None
- clip_magnitude: bool = False#
Whether to force the object magnitude to remain <= 1.
- combined_update: Optional[numpy.typing.NDArray]#
Used for compact batch updates.
- convergence_tolerance: float = 0#
Terminate reconstruction early when the mnorm of the object update is less than this value.
- m: Optional[numpy.typing.NDArray]#
The first moment for adaptive moment.
- mdecay: float = 0.9#
The proportion of the first moment that is previous first moments.
- positivity_constraint: float = 0#
This value is passed to the tike.ptycho.object.positivity_constraint function.
- preconditioner: Optional[numpy.typing.NDArray]#
The magnitude of the illumination used for conditioning the object updates.
- resample(factor, interp)[source]#
Return a new ObjectOptions with the parameters rescaled.
- Parameters
factor (float) –
- Return type
- smoothness_constraint: float = 0#
This value is passed to the tike.ptycho.object.smoothness_constraint function.
- update_mnorm: List[float]#
A record of the previous mnorms of the object update.
- use_adaptive_moment: bool = False#
Whether or not to use adaptive moment.
- v: Optional[numpy.typing.NDArray]#
The second moment for adaptive moment.
- vdecay: float = 0.999#
The proportion of the second moment that is previous second moments.
- tike.ptycho.object.get_absorbtion_image(data, scan, *, rescale=1.0, method='cubic')[source]#
Approximate a scanning transmission image from diffraction patterns.
Interpolates the diffraction patterns to a grid with spacing of one unit.
Uses scipy.interpolate.griddata(), see docs for that function for more details about interpolation method.
- Parameters
data ((FRAME, WIDE, HIGH)) – The intensity (square of the absolute value) of the propagated wavefront i.e. what the detector records. FFT-shifted so the diffraction peak is at the corners.
scan ((POSI, 2) float32) – Coordinates of the minimum corner of the probe grid for each measurement in the coordinate system of psi.
rescale (float (0, 1.0]) – Rescale the scanning positions by this value before interpolating.
method (str) – The interpolation method: linear, nearest, or cubic
fill_value (float) – Value used to fill in for requested points outside of the convex hull of the input points. If not provided, then the default is nan. This option has no effect for the ‘nearest’ method.
- tike.ptycho.object.get_padded_object(scan, probe, extra=0)[source]#
Return a ones-initialized object and shifted scan positions.
An complex object array is initialized with shape such that the area covered by the probe is padded on each edge by a half probe width. The scan positions are shifted to be centered in this newly initialized object array.
- Parameters
extra (int) –
- tike.ptycho.object.positivity_constraint(x, r)[source]#
Constrains the amplitude of x to be positive with sum of abs(x) and x.
- Parameters
r (float [0, 1]) – The proportion of abs(x) in the weighted sum of abs(x) and x.
- tike.ptycho.object.remove_object_ambiguity(psi, probe, preconditioner)[source]#
Remove normalization ambiguity between probe and psi
- Parameters
psi (numpy.typing.NDArray.cupy.complex64) –
probe (numpy.typing.NDArray.cupy.complex64) –
preconditioner (numpy.typing.NDArray.cupy.complex64) –
- Return type
Tuple[numpy.typing.NDArray.cupy.complex64, numpy.typing.NDArray.cupy.complex64]