SegmentedDetector#

class abtem.detectors.SegmentedDetector(nbins_radial, nbins_azimuthal, inner, outer, rotation=0.0, offset=(0.0, 0.0), to_cpu=False, url=None)[source]#

Bases: _AbstractRadialDetector

The segmented detector covers an annular angular range, and is partitioned into several integration regions divided to radial and angular segments. This can be used for simulating differential phase contrast (DPC) imaging.

Parameters:
  • nbins_radial (int) – Number of radial bins.

  • nbins_azimuthal (int) – Number of angular bins.

  • inner (float) – Inner integration limit of the bins [mrad].

  • outer (float) – Outer integration limit of the bins [mrad].

  • rotation (float) – Rotation of the bins around the origin [mrad].

  • offset (two float) – Offset of the bins from the origin in x and y [mrad].

  • 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__(nbins_radial, nbins_azimuthal, inner, outer, rotation=0.0, offset=(0.0, 0.0), to_cpu=False, url=None)[source]#

Methods

__init__(nbins_radial, nbins_azimuthal, ...)

angular_limits(waves)

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

apply(array_object)

Apply the transform to the given waves.

copy()

Make a copy.

detect(waves)

Detect the given waves producing polar measurements.

ensemble_blocks([chunks])

Split the ensemble into an array of smaller ensembles.

generate_blocks([chunks])

Generate chunks of the ensemble.

get_detector_regions([waves])

Get the polar detector regions as a polar measurement.

select_block(index, chunks)

Select a block from the ensemble.

show([waves, gpts, sampling, energy])

Show the segmented detector regions as a polar plot.

Attributes

axes_metadata

List of AxisMetadata.

azimuthal_sampling

Spacing between the azimuthal detector bins [mrad].

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.

inner

Inner integration limit [mrad].

metadata

Metadata added to the waves when applying the transform.

nbins_azimuthal

Number of angular bins.

nbins_radial

Number of radial bins.

outer

Outer integration limit [mrad].

radial_sampling

Spacing between the radial detector bins [mrad].

rotation

Rotation of the bins around the origin [rad].

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

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

apply(array_object)#

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

Spacing between the azimuthal detector bins [mrad].

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.

detect(waves)#

Detect the given waves producing polar measurements.

Parameters:

waves (Waves) – The waves to detect.

Returns:

measurement

Return type:

PolarMeasurements

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.

get_detector_regions(waves=None)#

Get the polar detector regions as a polar measurement.

Parameters:

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

Returns:

detector_region

Return type:

PolarMeasurements

property inner: float#

Inner integration limit [mrad].

property metadata: dict#

Metadata added to the waves when applying the transform.

property nbins_azimuthal: int#

Number of angular bins.

property nbins_radial: int#

Number of radial bins.

property outer: float#

Outer integration limit [mrad].

property radial_sampling#

Spacing between the radial detector bins [mrad].

property rotation#

Rotation of the bins around the origin [rad].

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#

Shape of the ensemble.

show(waves=None, gpts=None, sampling=None, energy=None, **kwargs)#

Show the segmented detector regions as a polar plot.

Parameters:
  • waves (BaseWaves) – The waves to derive the segmented detector regions from.

  • gpts (two int, optional) – Number of grid points describing the wave functions to be detected.

  • sampling (two float, optional) – Lateral sampling of the wave functions to be detected [1 / Å].

  • energy (float, optional) – Electron energy of the wave functions to be detected [eV].

  • kwargs – Optional keyword arguments for DiffractionPatterns.show.

Returns:

visualization

Return type:

Visualization

property to_cpu#

The measurements are copied to host memory.

property url#

The storage location of the measurement data.