Scan¶
Module for describing different types of scans.
-
class
abtem.scan.
AbstractScan
[source]¶ Abstract class to describe scans.
-
abstract property
calibrations
¶ The measurement calibrations associated with the scan.
- Return type
tuple
-
abstract
insert_new_measurement
(measurement, indices, new_values)[source]¶ Insert new measurement values into a Measurement object or HDF5 file.
- Parameters
measurement (Measurement object) – The measurement to which new values are inserted.
start (int) – First index of slice.
end (int) – Last index of slice.
new_values (ndarray) – New measurement values to be inserted. Length should be (end - start).
-
abstract property
shape
¶ The shape the scan.
- Return type
tuple
-
abstract property
-
class
abtem.scan.
GridScan
(start, end, gpts=None, sampling=None, endpoint=False, batch_partition='squares', measurement_shift=None)[source]¶ Grid scan object.
Defines a scan on a regular grid.
- Parameters
start (two float) – Start corner of the scan [Å].
end (two float) – End corner of the scan [Å].
gpts (two int) – Number of scan positions in the x- and y-direction of the scan.
sampling (two float) – Sampling rate of scan positions [1 / Å].
endpoint (bool) – If True, end is the last position. Otherwise, it is not included. Default is False.
batch_partition ('squares' or 'lines') – Specify how to split the scan into batches. If ‘squares’, the scan position batches are divided into the best matching squares for the batch size. If ‘lines’, the batches are divided into lines of scan positions.
measurement_shift (two int) – The insertion indices of new measurements will be shifted by this amount in x and y. This is used for correctly inserting measurements collected from a partitioned scan.
-
add_to_mpl_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.
-
property
calibrations
¶ The measurement calibrations associated with the scan.
- Return type
tuple
-
copy
()¶ Make a copy.
-
property
end
¶ End corner of the scan [Å].
- Return type
ndarray
-
property
extent
¶ Grid extent in each dimension [Å].
-
property
gpts
¶ Number of grid points in each dimension.
-
insert_new_measurement
(measurement, indices, new_measurement)[source]¶ Insert new measurement values into a Measurement object or HDF5 file.
- Parameters
measurement (Measurement object) – The measurement to which new values are inserted.
start (int) – First index of slice.
end (int) – Last index of slice.
new_values (ndarray) – New measurement values to be inserted. Length should be (end - start).
-
partition_scan
(partitions)[source]¶ Partition the scan into smaller grid scans
- Parameters
partitions (two int) – The number of partitions to create in x and y.
- Returns
- Return type
List of GridScan objects
-
property
sampling
¶ Grid sampling in each dimension [1 / Å].
-
property
shape
¶ The shape the scan.
-
property
start
¶ Start corner of the scan [Å].
- Return type
ndarray
-
class
abtem.scan.
LineScan
(start, end=None, angle=0.0, gpts=None, sampling=None, margin=0.0, endpoint=True)[source]¶ Line scan object.
Defines a scan along a straight line.
- Parameters
start (two float) – Start point of the scan [Å].
end (two float) – End point of the scan [Å].
gpts (int) – Number of scan positions.
sampling (float) – Sampling rate of scan positions [1 / Å].
endpoint (bool) – If True, end is the last position. Otherwise, it is not included. Default is True.
-
add_to_mpl_plot
(ax, color='r', width=0.2, **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.
linestyle (str, optional) – Linestyle of scan line. Default is ‘-‘.
color (str, optional) – Color of the scan line. Default is ‘r’.
kwargs – Additional options for matplotlib.pyplot.plot as keyword arguments.
-
property
angle
¶ End point of the scan [Å].
- Return type
float
-
property
calibrations
¶ The measurement calibrations associated with the scan.
- Return type
Tuple
[Calibration
]
-
copy
()¶ Make a copy.
-
property
direction
¶ Direction of the scan line.
- Return type
Tuple
[float
,float
]
-
property
end
¶ End point of the scan [Å].
- Return type
Tuple
[float
,float
]
-
property
extent
¶ Grid extent in each dimension [Å].
-
property
gpts
¶ Number of grid points in each dimension.
-
insert_new_measurement
(measurement, indices, new_measurement_values)[source]¶ Insert new measurement values into a Measurement object or HDF5 file.
- Parameters
measurement (Measurement object) – The measurement to which new values are inserted.
start (int) – First index of slice.
end (int) – Last index of slice.
new_values (ndarray) – New measurement values to be inserted. Length should be (end - start).
-
property
sampling
¶ Grid sampling in each dimension [1 / Å].
-
property
shape
¶ The shape the scan.
- Return type
Tuple
[int
]
-
property
start
¶ Start point of the scan [Å].
- Return type
Tuple
[float
,float
]
-
class
abtem.scan.
PositionScan
(positions)[source]¶ Position scan object.
Defines a scan based on user-provided positions.
- Parameters
positions (list) – A list of xy scan positions [Å].
-
add_to_mpl_plot
(ax, marker='o', color='r', **kwargs)[source]¶ Add a visualization of the scan positions to a matplotlib plot.
- Parameters
ax (matplotlib Axes) – The axes of the matplotlib plot the visualization should be added to.
marker (str, optional) – Style of scan position markers. Default is ‘-‘.
color (str, optional) – Color of the scan position markers. Default is ‘r’.
kwargs – Additional options for matplotlib.pyplot.plot as keyword arguments.
-
property
calibrations
¶ The measurement calibrations associated with the scan.
- Return type
tuple
-
copy
()¶ Make a copy.
-
insert_new_measurement
(measurement, indices, new_measurement)[source]¶ Insert new measurement values into a Measurement object or HDF5 file.
- Parameters
measurement (Measurement object) – The measurement to which new values are inserted.
start (int) – First index of slice.
end (int) – Last index of slice.
new_values (ndarray) – New measurement values to be inserted. Length should be (end - start).
-
property
shape
¶ The shape the scan.
- Return type
tuple