CTF#

class abtem.transfer.CTF(semiangle_cutoff=inf, soft=True, focal_spread=0.0, angular_spread=0.0, aberration_coefficients=None, energy=None, extent=None, gpts=None, sampling=None, flip_phase=False, wiener_snr=0.0, **kwargs)[source]#

Bases: _HasAberrations, BaseAperture

The contrast transfer function (CTF) describes the aberrations of the objective lens in HRTEM and specifies how the condenser system shapes the probe in STEM.

abTEM implements phase aberrations up to 5th order using polar coefficients. See Eq. 2.22 in the reference [1].

Cartesian coefficients can be converted to polar using the utility function abtem.transfer.cartesian2polar.

Partial coherence is included as envelopes in the quasi-coherent approximation. See Chapter 3.2 in reference [1].

Parameters:
  • semiangle_cutoff (float, optional) – The semiangle cutoff describes the sharp reciprocal-space cutoff due to the objective aperture [mrad] (default is no cutoff).

  • soft (bool, optional) – If True, the edge of the aperture is softened (default is True).

  • focal_spread (float, optional) – The standard deviation of the focal spread due to chromatic aberration and lens current instability [Å] (default is 0).

  • angular_spread (float, optional) – The standard deviation of the angular deviations due to source size [Å] (default is 0).

  • aberration_coefficients (dict, optional) – Mapping from aberration symbols to their corresponding values. All aberration magnitudes should be given in [Å] and angles should be given in [radian].

  • energy (float, optional) – Electron energy [eV]. If not provided, inferred from the wave functions.

  • extent (float or two float, optional) – Lateral extent of wave functions [Å] in x and y directions. If a single float is given, both are set equal.

  • gpts (two ints, optional) – Number of grid points describing the wave functions.

  • sampling (two float, optional) – Lateral sampling of wave functions [1 / Å]. If ‘gpts’ is also given, will be ignored.

  • flip_phase (bool, optional) – Changes the sign of all negative parts of the CTF to positive (following doi:10.1016/j.ultramic.2008.03.004) (default is False).

  • wiener_snr (float, optional) – Applies a Wiener filter to the CTF(following doi:10.1016/j.ultramic.2008.03.004) with a given SNR value. If no value is given, the default value of 0.0 means that no filter is applied.

  • kwargs (dict, optional) – Optionally provide the aberration coefficients as keyword arguments.

References

__init__(semiangle_cutoff=inf, soft=True, focal_spread=0.0, angular_spread=0.0, aberration_coefficients=None, energy=None, extent=None, gpts=None, sampling=None, flip_phase=False, wiener_snr=0.0, **kwargs)[source]#

Methods

__init__([semiangle_cutoff, soft, ...])

apply(waves[, max_batch])

copy()

Make a copy.

ensemble_blocks([chunks])

Split the ensemble into an array of smaller ensembles.

generate_blocks([chunks])

Generate chunks of the ensemble.

match_grid(other[, check_match])

Match the grid to another object with a Grid.

profiles([gpts, max_angle, phi])

Calculate radial line profiles for each included component (phase aberrations, aperture, temporal and spatial envelopes) of the contrast transfer function.

set_aberrations(aberration_coefficients)

Set the phase of the phase aberration.

show([max_angle])

to_diffraction_patterns([max_angle, gpts])

Converts the transfer function instance to DiffractionPatterns.

to_point_spread_functions(gpts, extent)

Attributes

aberration_coefficients

The aberration coefficients as a dictionary.

accelerator

Accelerator object describing the acceleration energy.

angular_sampling

The sampling in scattering angles of the transfer function [mrad].

angular_spread

The standard deviation of the angular deviations due to source size [mrad].

axes_metadata

List of AxisMetadata.

base_axes_metadata

List of AxisMetadata of the base axes.

base_shape

Shape of the base axes.

crossover_angle

The first zero-crossing of the phase at Scherzer defocus [mrad].

defocus

Defocus equivalent to negative C10.

distributions

energy

Electron acceleration energy in electron volts.

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

Extent of grid for each dimension in Ångstrom.

flip_phase

If true the signs of all negative parts of the CTF are changed to positive.

focal_spread

The standard deviation of the focal spread [Å].

gpts

Number of grid points for each dimension.

grid

Simulation grid.

in_place

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

metadata

Metadata added to the waves when applying the transform.

nyquist_sampling

Nyquist sampling corresponding to the semiangle cutoff of the aperture [Å].

point_resolution

The Scherzer point resolution [Å].

reciprocal_space_sampling

Reciprocal-space sampling in reciprocal Ångstrom.

sampling

Grid sampling for each dimension in Ångstrom per grid point.

scherzer_defocus

The Scherzer defocus [Å].

semiangle_cutoff

The semiangle cutoff [mrad].

shape

Shape of the ensemble.

soft

True if the aperture has a soft edge.

wavelength

Relativistic wavelength in Ångstrom.

wiener_snr

If true a Wiener filter is applied to the CTF.

C10

C12

phi12

C21

phi21

C23

phi23

C30

C32

phi32

C34

phi34

C41

phi41

C43

phi43

C45

phi45

C50

C52

phi52

C54

phi54

C56

phi56

Cs

C5

astigmatism

astigmatism_angle

astigmatism3

astigmatism3_angle

astigmatism5

astigmatism5_angle

coma

coma_angle

coma4

coma4_angle

trefoil

trefoil_angle

trefoil4

trefoil4_angle

quadrafoil

quadrafoil_angle

quadrafoil5

quadrafoil5_angle

pentafoil

pentafoil_angle

hexafoil

hexafoil_angle

property aberration_coefficients: Mapping[str, float | BaseDistribution]#

The aberration coefficients as a dictionary.

property accelerator: Accelerator#

Accelerator object describing the acceleration energy.

property angular_sampling: tuple[float, float]#

The sampling in scattering angles of the transfer function [mrad].

property angular_spread: float | BaseDistribution#

The standard deviation of the angular deviations due to source size [mrad].

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

property crossover_angle: float#

The first zero-crossing of the phase at Scherzer defocus [mrad].

property defocus: float | BaseDistribution#

Defocus equivalent to negative C10.

property energy: float | None#

Electron acceleration energy in electron volts.

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.

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

Extent of grid for each dimension in Ångstrom.

property flip_phase: bool#

If true the signs of all negative parts of the CTF are changed to positive.

property focal_spread: float | BaseDistribution#

The standard deviation of the focal spread [Å].

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

Number of grid points for each dimension.

property grid: Grid#

Simulation grid.

property in_place: bool#

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

match_grid(other, check_match=False)#

Match the grid to another object with a Grid.

property metadata: dict#

Metadata added to the waves when applying the transform.

property nyquist_sampling: float#

Nyquist sampling corresponding to the semiangle cutoff of the aperture [Å].

property point_resolution: float#

The Scherzer point resolution [Å].

profiles(gpts=1000, max_angle=None, phi=0.0)[source]#

Calculate radial line profiles for each included component (phase aberrations, aperture, temporal and spatial envelopes) of the contrast transfer function.

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

  • max_angle (float) – The maximum scattering angle included in the radial line profiles [mrad]. The default is 1.5 times the semiangle cutoff or 50 mrad if no semiangle cutoff is set.

  • phi (float) – The azimuthal angle of the radial line profiles [rad]. Default is 0.

Returns:

ctf_profiles – Ensemble of reciprocal space line profiles. The first ensemble dimension represents the different

Return type:

ReciprocalSpaceLineProfiles

property reciprocal_space_sampling: tuple[float, float]#

Reciprocal-space sampling in reciprocal Ångstrom.

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

Grid sampling for each dimension in Ångstrom per grid point.

property scherzer_defocus: float#

The Scherzer defocus [Å].

property semiangle_cutoff: float | BaseDistribution#

The semiangle cutoff [mrad].

set_aberrations(aberration_coefficients)#

Set the phase of the phase aberration.

Parameters:

aberration_coefficients (dict) – Mapping from aberration symbols to their corresponding values.

Return type:

None

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

Shape of the ensemble.

property soft: float#

True if the aperture has a soft edge.

to_diffraction_patterns(max_angle=None, gpts=None)#

Converts the transfer function instance to DiffractionPatterns.

Parameters:
  • max_angle (float, optional) – The maximum diffraction angle in radians. If not provided, the maximum angle will be determined based on the self._max_semiangle_cutoff attribute of the instance. If neither max_angle nor self._max_semiangle_cutoff is available, a RuntimeError will be raised.

  • gpts (int | tuple[int, int], optional) – The number of grid points in reciprocal space for performing Fourier Transform. If not provided, a default value of 128 will be used.

Returns:

The diffraction patterns obtained from the conversion.

Return type:

abtem.measurements.DiffractionPatterns

property wavelength: float#

Relativistic wavelength in Ångstrom.

property wiener_snr: float#

If true a Wiener filter is applied to the CTF.