BasePotential#

class abtem.potentials.iam.BasePotential[source]#

Bases: BaseField

Base class of all potentials. Documented in the subclasses.

__init__()#

Methods

__init__()

build([first_slice, last_slice, chunks, lazy])

copy()

Make a copy.

depth_profile([projection_axis, depth])

Create a depth profile by projecting the potential along a spatial axis.

ensemble_blocks([chunks])

Split the ensemble into an array of smaller ensembles.

generate_blocks([chunks])

Generate chunks of the ensemble.

generate_slices([first_slice, last_slice])

match_grid(other[, check_match])

Match the grid to another object with a Grid.

project()

Sum of the potential slices as an image.

show([project])

Show the potential projection.

show_depth_profile([projection_axis, depth, ...])

Show a depth cross-section of the potential.

to_images()

Converts the potential to an ensemble of images.

Attributes

axes_metadata

List of AxisMetadata.

base_axes_metadata

List of AxisMetadata for the base axes.

base_shape

Shape of the base axes of the potential.

ensemble_axes_metadata

List of AxisMetadata of the ensemble axes.

ensemble_shape

Shape of the ensemble axes.

exit_planes

The "exit planes" of the potential.

exit_thicknesses

The "exit thicknesses" of the potential.

extent

Extent of grid for each dimension in Ångstrom.

gpts

Number of grid points for each dimension.

grid

Simulation grid.

num_configurations

Number of frozen phonons in the ensemble of potentials.

num_exit_planes

Number of exit planes.

num_slices

Number of projected potential slices.

reciprocal_space_sampling

Reciprocal-space sampling in reciprocal Ångstrom.

sampling

Grid sampling for each dimension in Ångstrom per grid point.

shape

Shape of the ensemble.

slice_limits

The entrance and exit thicknesses of each slice [Å].

slice_thickness

Slice thicknesses for each slice.

thickness

Thickness of the potential [Å].

property axes_metadata: AxesMetadataList#

List of AxisMetadata.

property base_axes_metadata#

List of AxisMetadata for the base axes.

property base_shape#

Shape of the base axes of the potential.

copy()#

Make a copy.

Return type:

Self

depth_profile(projection_axis='y', depth=None)#

Create a depth profile by projecting the potential along a spatial axis.

Parameters:
  • projection_axis (str) – Spatial axis to project (sum) along. "y" (default) produces an x–z cross-section; "x" produces a y–z cross-section.

  • depth (float, optional) – If given, project only over a finite slab of this thickness [Å], centered on the midpoint of the projected axis. The number of grid points is rounded to the nearest integer. If None, the full extent is projected.

Returns:

depth_profile – 2D image(s) with the remaining spatial axis horizontal and depth (z) vertical. Any ensemble axes (e.g. frozen phonons) are preserved.

Return type:

Images

property ensemble_axes_metadata: list[AxisMetadata]#

List of AxisMetadata of the ensemble axes.

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: tuple[int, ...]#

Shape of the ensemble axes.

abstract property exit_planes: tuple[int, ...]#

The “exit planes” of the potential. The indices of slices where a measurement is returned.

property exit_thicknesses: tuple[float, ...]#

The “exit thicknesses” of the potential. The thicknesses in the potential where a measurement is returned.

property extent: tuple[float, float] | None#

Extent of grid for each dimension in Ångstrom.

generate_blocks(chunks=1)#

Generate chunks of the ensemble.

Parameters:

chunks (iterable of tuples) – Block sizes along each dimension.

Return type:

Generator[tuple[tuple[int, ...], tuple[slice, ...], ndarray], None, None]

property gpts: tuple[int, int] | None#

Number of grid points for each dimension.

property grid: Grid#

Simulation grid.

match_grid(other, check_match=False)#

Match the grid to another object with a Grid.

abstract property num_configurations#

Number of frozen phonons in the ensemble of potentials.

property num_exit_planes: int#

Number of exit planes.

property num_slices: int#

Number of projected potential slices.

project()#

Sum of the potential slices as an image.

Returns:

projected – The projected potential.

Return type:

Images

property reciprocal_space_sampling: tuple[float, float]#

Reciprocal-space sampling in reciprocal Ångstrom.

property sampling: tuple[float, float] | None#

Grid sampling for each dimension in Ångstrom per grid point.

property shape: tuple[int, ...]#

Shape of the ensemble.

show(project=True, **kwargs)#

Show the potential projection. This requires building all potential slices.

Parameters:
  • project (bool, optional) – Show the projected potential (True, default) or show all potential slices. It is recommended to index a subset of the potential slices when this keyword set to False.

  • kwargs – Additional keyword arguments for the show method of Images.

show_depth_profile(projection_axis='y', depth=None, z_scale=1.0, slice_lines=True, ax=None, cbar=False, cmap=None, vmin=None, vmax=None, power=1.0, common_color_scale=False, explode=(), figsize=None, title=True, **kwargs)#

Show a depth cross-section of the potential.

Parameters:
  • projection_axis (str) – Spatial axis to project (sum) along. "y" (default) produces an x–z cross-section; "x" produces a y–z cross-section.

  • depth (float, optional) – If given, project only over a finite slab of this thickness [Å], centered on the midpoint of the projected axis. The number of grid points is rounded to the nearest integer. If None, the full extent is projected.

  • z_scale (float) – Scaling factor for the z-axis relative to the spatial axis. Values less than 1 compress the z-axis, making panels of thick specimens more compact. Default is 1.0 (equal scaling).

  • slice_lines (bool) – If True (default), draw horizontal lines at slice boundaries.

  • ax (matplotlib.axes.Axes, optional) – If given the plot is added to the axis.

  • cbar (bool, optional) – Add a colorbar to the plot. Default is False.

  • cmap (str, optional) – Matplotlib colormap name.

  • vmin (float, optional) – Minimum of the color scale.

  • vmax (float, optional) – Maximum of the color scale.

  • power (float) – Show image on a power scale.

  • common_color_scale (bool, optional) – If True, all images in a grid share the same color scale.

  • explode (bool or sequence of int, optional) – If True, create a grid of images for ensemble items.

  • figsize (two int, optional) – Figure size as (width, height) in inches.

  • title (bool or str, optional) – Column title for the images.

  • **kwargs – Additional keyword arguments passed to the show method.

Returns:

visualization

Return type:

Visualization

property slice_limits: list[tuple[float, float]]#

The entrance and exit thicknesses of each slice [Å].

abstract property slice_thickness: tuple[float, ...]#

Slice thicknesses for each slice.

property thickness: float#

Thickness of the potential [Å].

to_images()#

Converts the potential to an ensemble of images.

Returns:

image_ensemble – The potential slices as images.

Return type:

Images