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)

Apply the transform to the given waves.

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.

select_block(index, chunks)

Select a block from the ensemble.

set_aberrations(aberration_coefficients)

Set the phase of the phase aberration.

show(**kwargs)

to_diffraction_patterns([max_angle, gpts])

Converts the transfer function instance to DiffractionPatterns.

to_point_spread_functions(gpts, extent)

Attributes

C10

C12

C21

C23

C30

C32

C34

C41

C43

C45

C5

C50

C52

C54

C56

Cs

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].

astigmatism

astigmatism_angle

axes_metadata

List of AxisMetadata.

base_axes_metadata

List of AxisMetadata of the base axes.

base_shape

Shape of the base axes.

coma

coma_angle

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 [Å].

phi12

phi21

phi23

phi32

phi34

phi41

phi43

phi45

phi52

phi54

phi56

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.

property aberration_coefficients#

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].

apply(waves)#

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 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.

property crossover_angle#

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

property defocus: float | BaseDistribution#

Defocus equivalent to negative C10.

property energy#

Electron acceleration energy in electron volts.

property ensemble_axes_metadata#

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#

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

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

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.

property gpts: tuple[int] | tuple[int, int] | tuple[int, ...]#

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#

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#

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

Reciprocal-space sampling in reciprocal Ångstrom.

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

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

property scherzer_defocus#

The Scherzer defocus [Å].

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 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.

property shape#

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#

Relativistic wavelength in Ångstrom.

property wiener_snr: float#

If true a Wiener filter is applied to the CTF.