PlaneWave
PlaneWave#
- class abtem.waves.PlaneWave(extent=None, gpts=None, sampling=None, energy=None, normalize=False, tilt=(0.0, 0.0), device=None)[source]#
Bases:
abtem.waves._WavesBuilderRepresents electron probe wave functions for simulating experiments with a plane-wave probe, such as HRTEM and SAED.
- Parameters
extent (two float, optional) – Lateral extent of the wave function [Å].
gpts (two int, optional) – Number of grid points describing the wave function.
sampling (two float, optional) – Lateral sampling of the wave functions [1 / Å]. If ‘gpts’ is also given, will be ignored.
energy (float, optional) – Electron energy [eV]. If not provided, inferred from the wave functions.
normalize (bool, optional) – If true, normalizes the wave function such that its reciprocal space intensity sums to one. If false, the wave function takes a value of one everywhere.
tilt (two float, optional) – Small-angle beam tilt [mrad] (default is (0., 0.)). Implemented by shifting the wave functions at every slice.
device (str, optional) – The wave functions are stored on this device (‘cpu’ or ‘gpu’). The default is determined by the user configuration.
- __init__(extent=None, gpts=None, sampling=None, energy=None, normalize=False, tilt=(0.0, 0.0), device=None)[source]#
Methods
__init__([extent, gpts, sampling, energy, ...])build([lazy, max_batch])Build plane-wave wave functions.
check_can_build([potential])Check whether the wave functions can be built.
copy()Make a copy.
ensemble_blocks([chunks])Split the ensemble into an array of smaller ensembles.
generate_blocks([chunks])Generate chunks of the ensemble.
match_grid(other[, check_match])Match the grid to another object with a Grid.
multislice(potential[, detectors, ...])Run the multislice algorithm, after building the plane-wave wave function as needed.
select_block(index, chunks)Select a block from the ensemble.
Attributes
Accelerator object describing the acceleration energy.
Reciprocal-space sampling in units of scattering angles [mrad].
The number of grid points along the x and y direction in the simulation grid at the antialiasing cutoff scattering angle.
The number of grid points along the x and y direction in the simulation grid for the largest rectangle that fits within antialiasing cutoff scattering angle.
List of AxisMetadata.
List of AxisMetadata for the base axes in real space.
Shape of the base axes of the waves.
Scattering angles at the antialias cutoff [mrad].
The device where the waves are created.
The datatype of waves.
Electron acceleration energy in electron volts.
List of AxisMetadata of the ensemble axes.
Shape of the ensemble axes of the waves.
Extent of grid for each dimension in Ångstrom.
Scattering angles corresponding to the full wave function size [mrad].
Number of grid points for each dimension.
Simulation grid.
Metadata stored as a dictionary.
True if the created waves are normalized in reciprocal space.
List of AxisMetadata for base axes in reciprocal space.
Reciprocal-space sampling in reciprocal Ångstrom.
Scattering angles corresponding to the sides of the largest rectangle within the antialias cutoff [mrad].
Grid sampling for each dimension in Ångstrom per grid point.
Shape of the waves.
The small-angle tilt of applied to the Fresnel propagator [mrad].
Relativistic wavelength in Ångstrom.
- property accelerator: abtem.core.energy.Accelerator#
Accelerator object describing the acceleration energy.
- Return type
Accelerator
- property angular_sampling: tuple[float, float]#
Reciprocal-space sampling in units of scattering angles [mrad].
- Return type
tuple[float,float]
- property antialias_cutoff_gpts: tuple[int, int]#
The number of grid points along the x and y direction in the simulation grid at the antialiasing cutoff scattering angle.
- Return type
tuple[int,int]
- property antialias_valid_gpts: tuple[int, int]#
The number of grid points along the x and y direction in the simulation grid for the largest rectangle that fits within antialiasing cutoff scattering angle.
- Return type
tuple[int,int]
- property axes_metadata: abtem.core.axes.AxesMetadataList#
List of AxisMetadata.
- Return type
AxesMetadataList
- property base_axes_metadata: list[abtem.core.axes.AxisMetadata]#
List of AxisMetadata for the base axes in real space.
- Return type
list[AxisMetadata]
- property base_shape: tuple[int, int]#
Shape of the base axes of the waves.
- Return type
tuple[int,int]
- build(lazy=None, max_batch='auto')[source]#
Build plane-wave wave functions.
- Parameters
lazy (bool, optional) – If True, create the wave functions lazily, otherwise, calculate instantly. If not given, defaults to the setting in the user configuration file.
max_batch (int or str, optional) – The number of wave functions in each chunk of the Dask array. If ‘auto’ (default), the batch size is automatically chosen based on the abtem user configuration settings “dask.chunk-size” and “dask.chunk-size-gpu”.
- Returns
plane_waves – The wave functions.
- Return type
- check_can_build(potential=None)#
Check whether the wave functions can be built.
- copy()#
Make a copy.
- property cutoff_angles: tuple[float, float]#
Scattering angles at the antialias cutoff [mrad].
- Return type
tuple[float,float]
- property device#
The device where the waves are created.
- property dtype#
The datatype of waves.
- property energy#
Electron acceleration energy in electron volts.
- property ensemble_axes_metadata: list[abtem.core.axes.AxisMetadata]#
List of AxisMetadata of the ensemble axes.
- Return type
list[AxisMetadata]
- ensemble_blocks(chunks=None)#
Split the ensemble into an array of smaller ensembles.
- Parameters
chunks (iterable of tuples) – Block sizes along each dimension.
- Return type
Array
- property ensemble_shape#
Shape of the ensemble axes of the waves.
- property extent: tuple[float] | tuple[float, float] | tuple[float, ...]#
Extent of grid for each dimension in Ångstrom.
- Return type
tuple[float] | tuple[float, float] | tuple[float, …]
- property full_cutoff_angles: tuple[float, float]#
Scattering angles corresponding to the full wave function size [mrad].
- Return type
tuple[float,float]
- generate_blocks(chunks=1)#
Generate chunks of the ensemble.
- Parameters
chunks (iterable of tuples) – Block sizes along each dimension.
- property gpts: tuple[int] | tuple[int, int] | tuple[int, ...]#
Number of grid points for each dimension.
- Return type
tuple[int] | tuple[int, int] | tuple[int, …]
- property grid: abtem.core.grid.Grid#
Simulation grid.
- Return type
Grid
- match_grid(other, check_match=False)#
Match the grid to another object with a Grid.
- property metadata#
Metadata stored as a dictionary.
- multislice(potential, detectors=None, max_batch='auto', lazy=None)[source]#
Run the multislice algorithm, after building the plane-wave wave function as needed. The grid of the wave functions will be set to the grid of the potential.
- Parameters
potential (BasePotential, Atoms) – The potential through which to propagate the wave function. Optionally atoms can be directly given.
detectors (Detector, list of detectors, optional) – A detector or a list of detectors defining how the wave functions should be converted to measurements after running the multislice algorithm.
max_batch (int, optional) – The number of wave functions in each chunk of the Dask array. If ‘auto’ (default), the batch size is automatically chosen based on the abtem user configuration settings “dask.chunk-size” and “dask.chunk-size-gpu”.
lazy (bool, optional) – If True, create the wave functions lazily, otherwise, calculate instantly. If None, this defaults to the setting in the user configuration file.
- Return type
- Returns
detected_waves (BaseMeasurements or list of BaseMeasurement) – The detected measurement (if detector(s) given).
exit_waves (Waves) – Wave functions at the exit plane(s) of the potential (if no detector(s) given).
- property normalize#
True if the created waves are normalized in reciprocal space.
- property reciprocal_space_axes_metadata: list[abtem.core.axes.AxisMetadata]#
List of AxisMetadata for base axes in reciprocal space.
- Return type
list[AxisMetadata]
- property reciprocal_space_sampling: tuple[float] | tuple[float, float] | tuple[float, ...]#
Reciprocal-space sampling in reciprocal Ångstrom.
- Return type
tuple[float] | tuple[float, float] | tuple[float, …]
- property rectangle_cutoff_angles: tuple[float, float]#
Scattering angles corresponding to the sides of the largest rectangle within the antialias cutoff [mrad].
- Return type
tuple[float,float]
- property sampling: tuple[float] | tuple[float, float] | tuple[float, ...]#
Grid sampling for each dimension in Ångstrom per grid point.
- Return type
tuple[float] | tuple[float, float] | tuple[float, …]
- select_block(index, chunks)#
Select a block from the ensemble.
- Parameters
index (tuple of ints) – Index of selected block.
chunks (iterable of tuples) – Block sizes along each dimension.
- property shape#
Shape of the waves.
- property tilt#
The small-angle tilt of applied to the Fresnel propagator [mrad].
- property wavelength#
Relativistic wavelength in Ångstrom.