Operators¶
PtyLab.Operators
¶
Operators
¶
propagate_fraunhofer(fields, params, reconstruction, z=None)
¶
Propagate using the fraunhofer approximation.
Parameters¶
fields: np.ndarray Electric field to propagate params: Params Parameter object. The parameter params.fftshiftSwitch is inspected for the fourier transform reconstruction: Reconstruction Reconstruction object. z: float propagation distance. Is ignored in this function.
Returns¶
A tuple of (reconstruction.esw, Propagated field)
Source code in PtyLab/Operators/Operators.py
propagate_fraunhofer_inv(fields, params, reconstruction, z=None)
¶
Inverse transform. See propagate_frauhofer for the arguments.
Parameters¶
fields: np.ndarray Electric field to propagate params: Params Parameter object. The parameter params.fftshiftSwitch is inspected for the fourier transform reconstruction: Reconstruction Reconstruction object. z: float propagation distance. Is ignored in this function.
Returns¶
A tuple of (reconstruction.esw, inverse transformed field)
Source code in PtyLab/Operators/Operators.py
propagate_fresnel(fields, params, reconstruction, z=None)
¶
Propagate using the fresnel approximation.
Parameters¶
fields: np.ndarray Electric field to propagate params: Params Parameter object. The parameter params.fftshiftSwitch is inspected for the fourier transform reconstruction: Reconstruction Reconstruction object. z: float propagation distance in meter
Returns¶
A tuple of (reconstruction.esw, Propagated field)
Source code in PtyLab/Operators/Operators.py
propagate_fresnel_inv(fields, params, reconstruction, z=None)
¶
Propagate using the inverse fresnel approximation.
Parameters¶
fields: np.ndarray Electric field to propagate params: Params Parameter object. The parameter params.fftshiftSwitch is inspected for the fourier transform reconstruction: Reconstruction Reconstruction object. z: float propagation distance in meter
Returns¶
A tuple of (reconstruction.esw, Propagated field)
Source code in PtyLab/Operators/Operators.py
propagate_ASP(fields, params, reconstruction, inverse=False, z=None, fftflag=True)
¶
Propagate using the angular spectrum method
Parameters¶
fields: np.ndarray Electric field to propagate params: Params Parameter object. The parameter params.fftshiftSwitch is inspected for the fourier transform reconstruction: Reconstruction Reconstruction object. z: float propagation distance in meter fftflag: bool Specified wether or not to use a centered fft internally. Set to false for debugging but should generally be turned on.
Returns¶
reconstruction.esw: np.ndarray exit surface wave result: np.ndarray propagated field
Source code in PtyLab/Operators/Operators.py
propagate_twoStepPolychrome(fields, params, reconstruction, inverse=False, z=None)
¶
Two-step polychrome propagation.
Parameters¶
fields: np.ndarray Field to propagate params: Params Parameters reconstruction: Reconstruction inverse: bool Reverse propagation z: float Propagation distance
Returns¶
reconstruction.esw, propagated field: Exit surface wave and the propagated field
Source code in PtyLab/Operators/Operators.py
propagate_twoStepPolychrome_inv(fields, params, reconstruction, z=None)
¶
See propagate_twoStepPolychrome.
Parameters¶
fields params reconstruction z
Returns¶
Source code in PtyLab/Operators/Operators.py
propagate_scaledASP(fields, params, reconstruction, inverse=False, z=None)
¶
Propagate using the scaled angular spectrum method.
Parameters¶
fields params reconstruction inverse z
Returns¶
Source code in PtyLab/Operators/Operators.py
propagate_scaledASP_inv(fields, params, reconstruction, z=None)
¶
Reverse scaled angular spectrum propagation. See scaledASP for details.
Parameters¶
fields: np.ndarray Field to propagate params: Params Parameters reconstruction: Reconstruction z: float Propagation distance
Returns¶
reconstruction.esw, propagated field: Exit surface wave and the propagated field
Source code in PtyLab/Operators/Operators.py
propagate_scaledPolychromeASP(fields, params, reconstruction, inverse=False, z=None)
¶
Scaled angular spectrum for multiple wavelengths.
Parameters¶
fields: np.ndarray Field to propagate params: Params Parameters reconstruction: Reconstruction inverse: bool Reverse propagation z: float Propagation distance
Returns¶
reconstruction.esw, propagated field: Exit surface wave and the propagated field
Returns¶
Source code in PtyLab/Operators/Operators.py
propagate_scaledPolychromeASP_inv(fields, params, reconstruction, z=None)
¶
Reverse Scaled angular spectrum for multiple wavelengths.
Parameters¶
fields: np.ndarray Field to propagate params: Params Parameters reconstruction: Reconstruction inverse: bool Reverse propagation z: float Propagation distance
Returns¶
reconstruction.esw, propagated field: Exit surface wave and the propagated field
Returns¶
Source code in PtyLab/Operators/Operators.py
propagate_polychromeASP(fields, params, reconstruction, inverse=False, z=None)
¶
ASP propagation for multiple wavelengths.
Parameters¶
fields: np.ndarray Field to propagate params: Params Parameters reconstruction: Reconstruction inverse: bool Reverse propagation z: float Propagation distance
Returns¶
reconstruction.esw, propagated field: Exit surface wave and the propagated field
Returns¶
Source code in PtyLab/Operators/Operators.py
propagate_identity(fields, params, reconstruction, inverse=False, z=None)
¶
Identity propagator (aka does nothing).
Can probably be used to figure out orientation or to perform some kind of stitching.
Parameters¶
fields params reconstruction inverse z
Returns¶
Source code in PtyLab/Operators/Operators.py
propagate_polychromeASP_inv(fields, params, reconstruction, z=None)
¶
inverse scaled angular spectrum for multiple wavelengths.
Parameters¶
fields: np.ndarray Field to propagate params: Params Parameters reconstruction: Reconstruction inverse: bool Reverse propagation z: float Propagation distance
Returns¶
reconstruction.esw, propagated field: Exit surface wave and the propagated field
Source code in PtyLab/Operators/Operators.py
detector2object(fields, params, reconstruction)
¶
Implements detector2object.m. Returns a propagated version of the field.
If field is not given, reconstruction.esw is taken :return: esw, updated esw
Source code in PtyLab/Operators/Operators.py
object2detector(fields, params, reconstruction)
¶
Propagate a field from the object to the detector. Return the new object, do not update in-place.
Source code in PtyLab/Operators/Operators.py
aspw(u, z, wavelength, L, bandlimit=True, is_FT=True)
¶
Angular spectrum plane wave propagation function. following: Matsushima et al., "Band-Limited Angular Spectrum Method for Numerical Simulation of Free-Space Propagation in Far and Near Fields", Optics Express, 2009
Parameters¶
u: np.ndarray a 2D field distribution at z = 0 (u is assumed to be square, i.e. N x N) z: float propagation distance in meter wavelength: float Wavelength in meter L: float total size of the field in meter bandlimit: bool Wether or not to band limit the sample is_FT: bool If the field has already been fourier transformed.
Returns¶
U_prop, Q (field distribution after propagation and the bandlimited transfer function)
Source code in PtyLab/Operators/Operators.py
__aspw_transfer_function(z, wavelength, N, L, on_gpu=False, bandlimit=True)
cached
¶
Angular spectrum optical transfer function. You likely don't need to use this directly.
The result of this call is cached so it can be reused and called as often as you need without having to worry about recalculating everything all the time.
Parameters¶
z: float distance wavelength: float wavelength in meter N: int Number of pixels per side L: int Physical size on_gpu: bool If true, a cupy array is returned bandlimit: bool If the transfer function should be band-limited.
Returns¶
Source code in PtyLab/Operators/Operators.py
complexexp(angle)
¶
scaledASP(u, z, wavelength, dx, dq, bandlimit=True, exactSolution=False)
¶
Angular spectrum propagation with customized grid spacing dq (within Fresnel(or paraxial) approximation) :param u: a 2D square input field :param z: propagation distance :param wavelength: propagation wavelength :param dx: grid spacing in original plane (u) :param dq: grid spacing in destination plane (Uout) :return: propagated field and two quadratic phases
note: to be analytically correct, add Q3 (see below) if only intensities matter, leave it out
Source code in PtyLab/Operators/Operators.py
scaledASPinv(u, z, wavelength, dx, dq)
¶
:param u: a 2D square input field :param z: propagation distance :param wavelength: wavelength :param dx: grid spacing in original plane (u) :param dq: grid spacing in destination plane (Uout) :return: propagated field
note: to be analytically correct, add Q3 (see below) if only intensities matter, leave it out
Source code in PtyLab/Operators/Operators.py
fresnelPropagator(u, z, wavelength, L)
¶
One-step Fresnel propagation, performing Fresnel-Kirchhoff integral. :param u: field distribution at z = 0(u is assumed to be square, i.e.N x N) :param z: propagation distance :param wavelength: wavelength :param L: total size[m] of the source plane :return: propagated field
Source code in PtyLab/Operators/Operators.py
clear_cache(logger=None)
¶
Clear the cache of all cached functions in this module. Use if GPU memory is not available.
IF logger is available, print some information about the methods being cleared.
Returns nothing
Source code in PtyLab/Operators/Operators.py
aspw_cached(u, z, wavelength, L)
¶
Cached version of aspw.