GridScan#

class abtem.scan.GridScan(start=(0.0, 0.0), end=None, gpts=None, sampling=None, endpoint=False, fractional=False, potential=None)[source]#

Bases: HasGridMixin, BaseScan

A scan over a regular grid for calculating scanning transmission electron microscopy.

Parameters:
  • start (two float or Atom, optional) – Start corner of the scan [Å]. May be given as fractional coordinate if fractional=True. Default is (0., 0.).

  • end (two float or Atom, optional) – End corner of the scan [Å]. May be given as fractional coordinate if fractional=True. Default is None, the scan end point will match the extent of the potential.

  • gpts (two int, optional) – Number of scan positions in the x- and y-direction of the scan. Provide one of gpts or sampling.

  • sampling (two float, optional) – Sampling rate of scan positions [1 / Å]. Provide one of gpts or sampling. If not provided the sampling will match the Nyquist sampling of the Probe in a multislice simulation.

  • endpoint (bool, optional) – If True, end is the last position. Otherwise, it is not included. Default is False.

  • fractional (bool, optional) – If True, use fractional coordinates with respect to the given potential for start and end.

  • potential (BasePotential or Atoms, optional) – Potential defining the grid with respect to which the fractional coordinates should be given.

__init__(start=(0.0, 0.0), end=None, gpts=None, sampling=None, endpoint=False, fractional=False, potential=None)[source]#

Methods

__init__([start, end, gpts, sampling, ...])

add_to_plot(ax[, alpha, facecolor, edgecolor])

Add a visualization of the scan area to a matplotlib plot.

apply(waves)

Apply the transform to the given waves.

copy()

Make a copy.

ensemble_blocks([chunks])

Split the ensemble into an array of smaller ensembles.

generate_blocks([chunks])

Generate chunks of the ensemble.

get_positions()

Get the scan positions as numpy array.

match_grid(other[, check_match])

Match the grid to another object with a Grid.

match_probe(probe)

Sets sampling to the Nyquist frequency.

select_block(index, chunks)

Select a block from the ensemble.

Attributes

axes_metadata

List of AxisMetadata.

base_axes_metadata

List of AxisMetadata of the base axes.

base_shape

Shape of the base axes.

distributions

end

End corner of the scan [Å].

endpoint

True if the scan endpoint is the last position.

ensemble_axes_metadata

Axes metadata describing the ensemble axes added to the waves when applying the transform.

ensemble_shape

The shape of the ensemble axes added to the waves when applying the transform.

extent

Extent of grid for each dimension in Ångstrom.

gpts

Number of grid points for each dimension.

grid

Simulation grid.

in_place

The array representing the waves may be modified in-place.

limits

Lower left and upper right corner of the bounding box containing all positions in the scan.

metadata

Metadata added to the waves when applying the transform.

num_positions

Number of probe positions in the scan.

reciprocal_space_sampling

Reciprocal-space sampling in reciprocal Ångstrom.

sampling

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

shape

The shape the scan.

start

Start corner of the scan [Å].

add_to_plot(ax, alpha=0.33, facecolor='r', edgecolor='r', **kwargs)[source]#

Add a visualization of the scan area to a matplotlib plot.

Parameters:
  • ax (matplotlib Axes) – The axes of the matplotlib plot the visualization should be added to.

  • alpha (float, optional) – Transparency of the scan area visualization. Default is 0.33.

  • facecolor (str, optional) – Color of the scan area visualization.

  • edgecolor (str, optional) – Color of the edge of the scan area visualization.

  • kwargs – Additional options for matplotlib.patches.Rectangle used for scan area visualization as keyword arguments.

apply(waves)#

Apply the transform to the given waves.

Parameters:

array_object (ArrayObject) – The array object to transform.

Returns:

transformed_array_object

Return type:

ArrayObject

property axes_metadata: AxesMetadataList#

List of AxisMetadata.

property base_axes_metadata: list[AxisMetadata]#

List of AxisMetadata of the base axes.

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

Shape of the base axes.

copy()#

Make a copy.

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

End corner of the scan [Å].

property endpoint: tuple[bool, bool]#

True if the scan endpoint is the last position. Otherwise, the endpoint is not included.

property ensemble_axes_metadata#

Axes metadata describing the ensemble axes added to the waves when applying the transform.

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#

The shape of the ensemble axes added to the waves when applying the transform.

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

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.

get_positions()[source]#

Get the scan positions as numpy array.

Return type:

ndarray

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

Number of grid points for each dimension.

property grid: Grid#

Simulation grid.

property in_place: bool#

The array representing the waves may be modified in-place.

property limits#

Lower left and upper right corner of the bounding box containing all positions in the scan.

match_grid(other, check_match=False)#

Match the grid to another object with a Grid.

match_probe(probe)[source]#

Sets sampling to the Nyquist frequency. If the start and end point of the scan is not given, set them to the lower left and upper right corners of the probe extent.

Parameters:

probe (Probe or BaseSMatrix) – The matched probe or s-matrix.

property metadata: dict#

Metadata added to the waves when applying the transform.

property num_positions: int#

Number of probe positions in the scan.

property reciprocal_space_sampling: tuple[float] | tuple[float, float] | tuple[float, ...]#

Reciprocal-space sampling in reciprocal Ångstrom.

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

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

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

The shape the scan.

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

Start corner of the scan [Å].