tomodrgn.ctf.compute_ctf#

compute_ctf(lattice: Lattice, angpix: torch.Tensor, dfu: torch.Tensor, dfv: torch.Tensor, dfang: torch.Tensor, volt: torch.Tensor, cs: torch.Tensor, w: torch.Tensor, phase_shift: torch.Tensor = 0, bfactor: float = None)[source]#

Calculates the 2-D CTF given spatial frequencies per image and a batch of CTF parameters. Implementation of eq. 7 of https://www.ncbi.nlm.nih.gov/pmc/articles/PMC8412055/ with additional reference to jianglab/ctfsimulation

\[CTF = sin( -\pi * z * \lambda * |k|^2 + (π/2) * Cs * \lambda^3 * |k|^4 - ps )\]

where

\[z = 1/2 * (𝑧_1 + 𝑧_2) + 1/2 * (𝑧_1 − 𝑧_2) * cos( 2 * ( 𝛼_k − 𝛼_z ) )\]

and

\[ps = phase shift + arcsin(w)\]
Parameters:
  • lattice – Lattice object for accessing pre-calculated spatial frequency magnitude and angle from x-axis

  • angpix – pixel size in angstroms for each image, shape (nimgs, 1)

  • dfu – defocus U in angstroms for each image, shape (nimgs, 1)

  • dfv – defocus V in angstroms for each image, shape (nimgs, 1)

  • dfang – defocus angle in degrees for each image, shape (nimgs, 1)

  • volt – microscope voltage in kV for each image, shape (nimgs, 1)

  • cs – sphrerical aberration in mm for each image, shape (nimgs, 1)

  • w – amplitude contrast ratio for each image, shape (nimgs, 1)

  • phase_shift – phase shift in degrees for each image, shape (nimgs, 1)

  • bfactor – envelope function bfactor for each image, shape (nimgs, 1)

Returns:

CTF evaluated at given spatial frequencies using input parameters, shape (nimgs, kx * ky)