LineScan#

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

Bases: BaseScan

A scan along a straight line.

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

  • end (two float or Atom, optional) – End point 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 (int, optional) – Number of scan positions. Default is None. Provide one of gpts or sampling.

  • sampling (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 True.

  • 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=True, fractional=False, potential=None)[source]#

Methods

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

add_margin(margin)

Extend the line scan by adding a margin to the start and end of the line scan.

add_to_axes(ax[, width])

Add a visualization of a scan line to a matplotlib plot.

apply(waves)

Apply the transform to the given waves.

at_position(center[, extent, angle, gpts, ...])

Make a line scan centered at a given position.

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([chunks, lazy])

Get the scan positions as numpy array.

match_probe(probe)

Sets sampling to the Nyquist frequency.

select_block(index, chunks)

Select a block from the ensemble.

Attributes

angle

Angle of the line from start to end and the x-axis [deg.].

axes_metadata

List of AxisMetadata.

base_axes_metadata

List of AxisMetadata of the base axes.

base_shape

Shape of the base axes.

direction

Normal vector pointing from start to end.

distributions

end

End point 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

Grid extent [Å].

gpts

Number of grid points.

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.

sampling

Grid sampling [Å].

shape

The shape the scan.

start

Start point of the scan [Å].

add_margin(margin)[source]#

Extend the line scan by adding a margin to the start and end of the line scan.

Parameters:

margin (float or tuple of float) – The margin added to the start and end of the linescan [Å]. If float the same margin is added.

add_to_axes(ax, width=0.0, **kwargs)[source]#

Add a visualization of a scan line to a matplotlib plot.

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

  • width (float, optional) – Width of line [Å].

  • kwargs – Additional options for matplotlib.pyplot.plot as keyword arguments.

property angle#

Angle of the line from start to end and the x-axis [deg.].

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

classmethod at_position(center, extent=1.0, angle=0.0, gpts=None, sampling=None, endpoint=True)[source]#

Make a line scan centered at a given position.

Parameters:
  • center (two float) – Center position of the line [Å]. May be given as an Atom.

  • angle (float) – Angle of the line [deg.].

  • extent (float) – Extent of the line [Å].

  • gpts (int) – Number of grid points along the line.

  • sampling (float) – Sampling of grid points along the line [Å].

  • endpoint (bool) – Sets whether the ending position is included or not.

Returns:

line_scan

Return type:

LineScan

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 direction#

Normal vector pointing from start to end.

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

End point of the scan [Å].

property endpoint: bool#

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

property ensemble_axes_metadata: list[AxisMetadata]#

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: float | None#

Grid extent [Å].

generate_blocks(chunks=1)#

Generate chunks of the ensemble.

Parameters:

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

get_positions(chunks=None, lazy=False)[source]#

Get the scan positions as numpy array.

Return type:

ndarray

property gpts: int#

Number of grid points.

property in_place: bool#

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

property limits: tuple[tuple[float, float], tuple[float, float]]#

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

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 and upper left corners of the probe extent.

Parameters:

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

property metadata#

Metadata added to the waves when applying the transform.

property num_positions: int#

Number of probe positions in the scan.

property sampling: float#

Grid sampling [Å].

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]#

The shape the scan.

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

Start point of the scan [Å].