abtem.scan#
Module for describing different types of scans.
Module Contents#
Classes#
Abstract class to describe scans. |
|
Custom scan based on explicit 2D probe positions. |
|
A scan over a regular grid for calculating scanning transmission electron microscopy. |
|
A scan along a straight line. |
Functions#
Validate that the input is a valid scan or a sequence of valid scan positions. |
Data#
API#
- class abtem.scan.BaseScan(...)[source]#
Bases:
abtem.transform.ReciprocalSpaceMultiplicationAbstract class to describe scans.
Initialization
- abstract property limits#
Lower left and upper right corner of the bounding box containing all positions in the scan.
- class abtem.scan.CustomScan(...)[source]#
Bases:
abtem.scan.BaseScanCustom scan based on explicit 2D probe positions.
- Parameters:
positions (ndarray, optional) – Scan positions [Å]. Anything that can be converted to a ndarray of shape (n, 2) is accepted. Default is (0., 0.).
Initialization
- add_to_plot(...)[source]#
Add a visualization of the scan positions to a matplotlib plot.
- Parameters:
ax (matplotlib Axes or Visualization) – The axes of the matplotlib plot the visualization should be added to.
kwargs – Additional options for matplotlib.pyplot.scatter as keyword arguments.
- property ensemble_axes_metadata#
- property limits#
- match_probe(...)[source]#
Sets the positions to a single position in the center of the probe extent.
- Parameters:
probe (Probe or BaseSMatrix) – The matched probe or s-matrix.
- property positions#
Scan positions [Å].
- property shape#
- class abtem.scan.GridScan(...)[source]#
Bases:
abtem.core.grid.HasGrid2DMixin,abtem.scan.BaseScanA 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.
Initialization
- add_to_plot(...)[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.
- classmethod commensurate(...) GridScan[source]#
Create a grid scan whose step is a whole number of pixels of the grid the given scattering matrix is reduced on.
Scattering-matrix reductions with
upsample=Trueare much faster for such scans, since every probe position falls on the pixel grid of the reduced wave functions. The requested number of positions or sampling is snapped to the nearest whole-pixel step; when the scanned span is itself a whole number of pixels, the step is snapped to a divisor of the span so the scan tiles it exactly, otherwise the end point is moved to the nearest lattice point.- Parameters:
matrix (BaseSMatrix or BasePotential or Atoms) – The scattering matrix (built or not) whose reduction grid the scan steps along. Given a potential, the grid of a scattering matrix with default downsampling is assumed.
gpts (one or two int, optional) – Requested number of scan positions in the x- and y-direction. Provide either gpts or sampling.
sampling (one or two float, optional) – Requested sampling rate of the scan positions [Å]. Provide either gpts or sampling.
start (one or two float or Atom, optional) – Start corner of the scan [Å]. Default is (0., 0.).
end (one or two float or Atom, optional) – End corner of the scan [Å] (not included, as for
endpoint=False). Default is the scanned extent.
- property endpoint: tuple[bool, bool]#
True if the scan endpoint is the last position. Otherwise, the endpoint is not included.
- property ensemble_axes_metadata#
- property ensemble_shape#
- property limits#
- match_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.
- class abtem.scan.LineScan(...)[source]#
Bases:
abtem.scan.BaseScanA 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.
Initialization
- add_margin(...)[source]#
Extend the line scan by adding a margin to the start and end of the line scan.
- add_to_axes(...)[source]#
Deprecated: use
add_to_plot()instead.
- add_to_plot(...)[source]#
Add a visualization of a scan line to a matplotlib plot.
- Parameters:
ax (matplotlib Axes or Visualization) – 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.].
- classmethod at_position(...)[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:
- property direction#
Normal vector pointing from start to end.
- property endpoint: bool#
True if the scan endpoint is the last position. Otherwise, the endpoint is not included.
- property ensemble_axes_metadata: list[AxisMetadata]#
- property ensemble_shape#
- match_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#
- abtem.scan.ScanWithSampling#
None