PixelatedDetector#

class abtem.detectors.PixelatedDetector(max_angle='valid', resample=False, reciprocal_space=True, to_cpu=True, url=None)[source]#

Bases: BaseDetector

The pixelated detector records the intensity of the Fourier-transformed exit wave function, i.e. the diffraction patterns. This may be used for example for simulating 4D-STEM.

Parameters:
  • max_angle (float or {'cutoff', 'valid', 'full'}) –

    The diffraction patterns will be detected up to this angle [mrad]. If str, it must be one of:

    cutoff

    The maximum scattering angle will be the cutoff of the antialiasing aperture.

    valid

    The maximum scattering angle will be the largest rectangle that fits inside the circular antialiasing aperture (default).

    full

    Diffraction patterns will not be cropped and will include angles outside the antialiasing aperture.

  • resample (str or False) – If ‘uniform’, the diffraction patterns from rectangular cells will be downsampled to a uniform angular sampling.

  • reciprocal_space (bool, optional) – If True (default), the diffraction pattern intensities are detected, otherwise the probe intensities are detected as images.

  • to_cpu (bool, optional) – If True, copy the measurement data from the calculation device to CPU memory after applying the detector, otherwise the data stays on the respective devices. Default is True.

  • url (str, optional) – If this parameter is set the measurement data is saved at the specified location, typically a path to a local file. A URL can also include a protocol specifier like s3:// for remote data. If not set (default) the data stays in memory.

__init__(max_angle='valid', resample=False, reciprocal_space=True, to_cpu=True, url=None)[source]#

Methods

__init__([max_angle, resample, ...])

angular_limits(waves)

The outer limits of the detected scattering angles in x and y [mrad] for the given waves.

apply(waves[, max_batch])

copy()

Make a copy.

detect(waves)

Detect the given waves producing diffraction patterns.

ensemble_blocks([chunks])

Split the ensemble into an array of smaller ensembles.

generate_blocks([chunks])

Generate chunks of 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.

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.

max_angle

Maximum detected scattering angle.

metadata

Metadata added to the waves when applying the transform.

reciprocal_space

Detect the exit wave functions in real or reciprocal space.

resample

How to resample the detected diffraction patterns.

shape

Shape of the ensemble.

to_cpu

The measurements are copied to host memory.

url

The storage location of the measurement data.

angular_limits(waves)[source]#

The outer limits of the detected scattering angles in x and y [mrad] for the given waves.

Parameters:

waves (BaseWaves) – The waves to derive the detector limits from.

Returns:

limits

Return type:

tuple of float

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.

Return type:

Self

detect(waves)[source]#

Detect the given waves producing diffraction patterns.

Parameters:

waves (Waves) – The waves to detect.

Returns:

measurement

Return type:

DiffractionPatterns

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

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

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 max_angle: str | float#

Maximum detected scattering angle.

property metadata: dict#

Metadata added to the waves when applying the transform.

property reciprocal_space: bool#

Detect the exit wave functions in real or reciprocal space.

property resample: str | bool | tuple[float, float]#

How to resample the detected diffraction patterns.

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

Shape of the ensemble.

property to_cpu: bool#

The measurements are copied to host memory.

property url: str | None#

The storage location of the measurement data.