| Bsoft 2.0.5 Bernard's software package

Public Member Functions | List of all members
CTFparam Class Reference

`#include <ctf.h>`

## Public Member Functions
| CTFparam ()
| CTFparam (double v, double sa, double ac)
int | update (CTFparam *ctf)
int | update (CTFparam &ctf)
| Updates a CTF structure from another. More...
double | volt ()
void | volt (double v)
double | focal_length ()
void | focal_length (double v)
double | Cs ()
void | Cs (double v)
double | Cc ()
void | Cc (double v)
double | alpha ()
void | alpha (double v)
double | dE ()
void | dE (double v)
double | amp_shift ()
void | amp_shift (double v)
double | objective_aperture ()
void | objective_aperture (double v)
double | defocus_average ()
void | defocus_average (double v)
double | defocus_deviation ()
void | defocus_deviation (double v)
double | astigmatism_angle ()
void | astigmatism_angle (double v)
long | baseline_type ()
void | baseline_type (long t)
vector< double > & | baseline ()
double | baseline (int i)
void | baseline (int i, double d)
void | baseline (double *b)
void | baseline (vector< double > &b)
long | envelope_type ()
void | envelope_type (long t)
vector< double > & | envelope ()
double | envelope (int i)
void | envelope (int i, double d)
void | envelope (double *v)
void | envelope (vector< double > &v)
double | fom ()
void | fom (double v)
bool | check_defocus ()
bool | check_Cs ()
double | lambda ()
double | term1 ()
double | term2 ()
double | delta_phi (double s2, double angle)
double | calculate (double s2, double angle)
vector< double > | calculate (int nrad, int npsi, double step_size)
| Calculates a CTF curve. More...
Complex< double > | calculate_complex (double s2, double angle)
double | calc_baseline (double s)
double | calc_envelope (double s)
vector< double > | zeroes (double max_s)
| Calculates the zeroes of a CTF curve on the spatial frequency scale. More...
Bstring | baseline_equation ()
| Generates a baseline equation string from 4 to 10 coefficients. More...
Bstring | envelope_equation ()
| Generates an envelope equation string from 4 coefficients. More...
int | parse_baseline_equation (Bstring base_eq)
| Extracts the coefficients from the baseline string. More...
int | parse_envelope_equation (Bstring env_eq)
| Extracts the coefficients from the envelope string. More...
vector< double > | envelope_partial_coherence (long n, double freq_step)
| Calculates the envelope curve based on partial coherence. More...
vector< double > | envelope_energy_spread (long n, double freq_step)
| Calculates the envelope curve based on energy spread. More...
double | zero (int i)
double | defocus_for_first_zero (double s)
void | show ()
void | show_baseline ()
void | show_envelope ()

## Detailed Description

Definition at line 26 of file ctf.h.

## Constructor & Destructor Documentation

## ◆ CTFparam() [1/2]

CTFparam::CTFparam | ( |  | ) |
| inline

Definition at line 72 of file ctf.h.

## ◆ CTFparam() [2/2]

CTFparam::CTFparam | ( | double | v,
|  | double | sa,
|  | double | ac
| ) |  |
| inline

Definition at line 73 of file ctf.h.

## Member Function Documentation

## ◆ alpha() [1/2]

double CTFparam::alpha | ( |  | ) |
| inline

Definition at line 91 of file ctf.h.

## ◆ alpha() [2/2]

void CTFparam::alpha | ( | double | v | ) |
| inline

Definition at line 92 of file ctf.h.

## ◆ amp_shift() [1/2]

double CTFparam::amp_shift | ( |  | ) |
| inline

Definition at line 95 of file ctf.h.

## ◆ amp_shift() [2/2]

void CTFparam::amp_shift | ( | double | v | ) |
| inline

Definition at line 96 of file ctf.h.

## ◆ astigmatism_angle() [1/2]

double CTFparam::astigmatism_angle | ( |  | ) |
| inline

Definition at line 104 of file ctf.h.

## ◆ astigmatism_angle() [2/2]

void CTFparam::astigmatism_angle | ( | double | v | ) |
| inline

Definition at line 105 of file ctf.h.

## ◆ baseline() [1/5]

vector<double>& CTFparam::baseline | ( |  | ) |
| inline

Definition at line 108 of file ctf.h.

## ◆ baseline() [2/5]

double CTFparam::baseline | ( | int | i | ) |
| inline

Definition at line 109 of file ctf.h.

## ◆ baseline() [3/5]

void CTFparam::baseline | ( | int | i,
|  | double | d
| ) |  |
| inline

Definition at line 110 of file ctf.h.

## ◆ baseline() [4/5]

void CTFparam::baseline | ( | double * | b | ) |
| inline

Definition at line 111 of file ctf.h.

## ◆ baseline() [5/5]

void CTFparam::baseline | ( | vector< double > & | b | ) |
| inline

Definition at line 112 of file ctf.h.

## ◆ baseline_equation()

Bstring CTFparam::baseline_equation | ( |  | ) |

Generates a baseline equation string from 4 to 10 coefficients.

Returns
  Bstring baseline equation.

      The baseline string is constructed from the 4 to 10 coefficients
      according to the specified type.

Definition at line 165 of file ctf.cpp.

## ◆ baseline_type() [1/2]

long CTFparam::baseline_type | ( |  | ) |
| inline

Definition at line 106 of file ctf.h.

## ◆ baseline_type() [2/2]

void CTFparam::baseline_type | ( | long | t | ) |
| inline

Definition at line 107 of file ctf.h.

## ◆ calc_baseline()

double CTFparam::calc_baseline | ( | double | s | ) |
| inline

Definition at line 161 of file ctf.h.

## ◆ calc_envelope()

double CTFparam::calc_envelope | ( | double | s | ) |
| inline

Definition at line 189 of file ctf.h.

## ◆ calculate() [1/2]

double CTFparam::calculate | ( | double | s2,
|  | double | angle
| ) |  |
| inline

Definition at line 149 of file ctf.h.

## ◆ calculate() [2/2]

vector< double > CTFparam::calculate | ( | int | nrad,
|  | int | npsi,
|  | double | step_size
| ) |  |

Calculates a CTF curve.

Parameters

  nrad | number of radii.
  npsi | number of angular segments.
  step_size | reciprocal space step size (1/angstrom).

Returns
  vector<double> new CTF array.

      Defocus values are positive for underfocus.
      Functions:
          angle = atan(y/x)
          s2 = reciprocal space distance squared
          defocus_average = (defocus_max + defocus_min)/2
          defocus_deviation = (defocus_max - defocus_min)/2
          defocus = defocus_average + defocus_deviation*cos(2*(angle - astigmatism_angle))
          phase = 0.5*PI*lambda*lambda*lambda*Cs*s2*s2 - PI*lambda*defocus*s2 - amp_shift;
          CTF = sin(phase)
      The new CTF curve is returned.

Definition at line 67 of file ctf.cpp.

## ◆ calculate_complex()

Complex<double> CTFparam::calculate_complex | ( | double | s2,
|  | double | angle
| ) |  |
| inline

Definition at line 156 of file ctf.h.

## ◆ Cc() [1/2]

double CTFparam::Cc | ( |  | ) |
| inline

Definition at line 89 of file ctf.h.

## ◆ Cc() [2/2]

void CTFparam::Cc | ( | double | v | ) |
| inline

Definition at line 90 of file ctf.h.

## ◆ check_Cs()

bool CTFparam::check_Cs | ( |  | ) |
| inline

Definition at line 131 of file ctf.h.

## ◆ check_defocus()

bool CTFparam::check_defocus | ( |  | ) |
| inline

Definition at line 123 of file ctf.h.

## ◆ Cs() [1/2]

double CTFparam::Cs | ( |  | ) |
| inline

Definition at line 87 of file ctf.h.

## ◆ Cs() [2/2]

void CTFparam::Cs | ( | double | v | ) |
| inline

Definition at line 88 of file ctf.h.

## ◆ dE() [1/2]

double CTFparam::dE | ( |  | ) |
| inline

Definition at line 93 of file ctf.h.

## ◆ dE() [2/2]

void CTFparam::dE | ( | double | v | ) |
| inline

Definition at line 94 of file ctf.h.

## ◆ defocus_average() [1/2]

double CTFparam::defocus_average | ( |  | ) |
| inline

Definition at line 100 of file ctf.h.

## ◆ defocus_average() [2/2]

void CTFparam::defocus_average | ( | double | v | ) |
| inline

Definition at line 101 of file ctf.h.

## ◆ defocus_deviation() [1/2]

double CTFparam::defocus_deviation | ( |  | ) |
| inline

Definition at line 102 of file ctf.h.

## ◆ defocus_deviation() [2/2]

void CTFparam::defocus_deviation | ( | double | v | ) |
| inline

Definition at line 103 of file ctf.h.

## ◆ defocus_for_first_zero()

double CTFparam::defocus_for_first_zero | ( | double | s | ) |
| inline

Definition at line 227 of file ctf.h.

## ◆ delta_phi()

double CTFparam::delta_phi | ( | double | s2,
|  | double | angle
| ) |  |
| inline

Definition at line 145 of file ctf.h.

## ◆ envelope() [1/5]

vector<double>& CTFparam::envelope | ( |  | ) |
| inline

Definition at line 115 of file ctf.h.

## ◆ envelope() [2/5]

double CTFparam::envelope | ( | int | i | ) |
| inline

Definition at line 116 of file ctf.h.

## ◆ envelope() [3/5]

void CTFparam::envelope | ( | int | i,
|  | double | d
| ) |  |
| inline

Definition at line 117 of file ctf.h.

## ◆ envelope() [4/5]

void CTFparam::envelope | ( | double * | v | ) |
| inline

Definition at line 118 of file ctf.h.

## ◆ envelope() [5/5]

void CTFparam::envelope | ( | vector< double > & | v | ) |
| inline

Definition at line 119 of file ctf.h.

## ◆ envelope_energy_spread()

vector< double > CTFparam::envelope_energy_spread | ( | long | n,
|  | double | freq_step
| ) |  |

Calculates the envelope curve based on energy spread.

Parameters

  n | number of spatial frequency steps.
  freq_step | size of spatial frequency step.

Returns
  vector<double> curve.

The curve is calculated at frequency s as: Ees(s) = exp(-0.5*(pi*lambda*Cc*(dE/V)*s^2)^2) where Cc: Chromatic aberation (~2e7 A) dE: Energy spread (~1 eV) V: Acceleration voltage (~1e5 V) lamda: electron wavelength (~0.03 A)

References: Freitag et al. (2005) Ultramicroscopy 102, 209-14. Zhu et al. (1997) JSB 118, 197-219.

Definition at line 372 of file ctf.cpp.

## ◆ envelope_equation()

Bstring CTFparam::envelope_equation | ( |  | ) |

Generates an envelope equation string from 4 coefficients.

Returns
  Bstring envelope equation.

      The envelope string is constructed from the 4 double gaussian parameters.

Definition at line 209 of file ctf.cpp.

## ◆ envelope_partial_coherence()

vector< double > CTFparam::envelope_partial_coherence | ( | long | n,
|  | double | freq_step
| ) |  |

Calculates the envelope curve based on partial coherence.

Parameters

  n | number of spatial frequency steps.
  freq_step | size of spatial frequency step.

Returns
  vector<double> curve.

The curve is calculated at frequency s as: Epc(s) = exp(-(pi*alpha*(Cs*lamda^2*s^2 - def)*s)^2) where Cs: Spherical aberation (~2e7 A) alpha: Beam spread/source size (~0.1 mrad) def: Defocus (~1e4 A) lamda: electron wavelength (~0.03 A)

References: Zhu et al. (1997) JSB 118, 197-219.

Definition at line 338 of file ctf.cpp.

## ◆ envelope_type() [1/2]

long CTFparam::envelope_type | ( |  | ) |
| inline

Definition at line 113 of file ctf.h.

## ◆ envelope_type() [2/2]

void CTFparam::envelope_type | ( | long | t | ) |
| inline

Definition at line 114 of file ctf.h.

## ◆ focal_length() [1/2]

double CTFparam::focal_length | ( |  | ) |
| inline

Definition at line 85 of file ctf.h.

## ◆ focal_length() [2/2]

void CTFparam::focal_length | ( | double | v | ) |
| inline

Definition at line 86 of file ctf.h.

## ◆ fom() [1/2]

double CTFparam::fom | ( |  | ) |
| inline

Definition at line 120 of file ctf.h.

## ◆ fom() [2/2]

void CTFparam::fom | ( | double | v | ) |
| inline

Definition at line 121 of file ctf.h.

## ◆ lambda()

double CTFparam::lambda | ( |  | ) |
| inline

Definition at line 139 of file ctf.h.

## ◆ objective_aperture() [1/2]

double CTFparam::objective_aperture | ( |  | ) |
| inline

Definition at line 98 of file ctf.h.

## ◆ objective_aperture() [2/2]

void CTFparam::objective_aperture | ( | double | v | ) |
| inline

Definition at line 99 of file ctf.h.

## ◆ parse_baseline_equation()

int CTFparam::parse_baseline_equation | ( | Bstring | base_eq | ) |

Extracts the coefficients from the baseline string.

Parameters

  base_eq | baseline equation string.

Returns
  int equation type.

      The baseline string is scanned in one of the three supported formats.

Definition at line 242 of file ctf.cpp.

## ◆ parse_envelope_equation()

int CTFparam::parse_envelope_equation | ( | Bstring | env_eq | ) |

Extracts the coefficients from the envelope string.

Parameters

  env_eq | envelope equation string.

Returns
  int 0.

      The envelope string is scanned to get the 4 double gaussian parameters.

Definition at line 287 of file ctf.cpp.

## ◆ show()

void CTFparam::show | ( |  | ) |
| inline

Definition at line 232 of file ctf.h.

## ◆ show_baseline()

void CTFparam::show_baseline | ( |  | ) |
| inline

Definition at line 244 of file ctf.h.

## ◆ show_envelope()

void CTFparam::show_envelope | ( |  | ) |
| inline

Definition at line 267 of file ctf.h.

## ◆ term1()

double CTFparam::term1 | ( |  | ) |
| inline

Definition at line 143 of file ctf.h.

## ◆ term2()

double CTFparam::term2 | ( |  | ) |
| inline

Definition at line 144 of file ctf.h.

## ◆ update() [1/2]

int CTFparam::update | ( | CTFparam * | ctf | ) |
| inline

Definition at line 77 of file ctf.h.

## ◆ update() [2/2]

int CTFparam::update | ( | CTFparam & | ctf | ) |

Updates a CTF structure from another.

Parameters

  ctf | CTF structure with new information.

Returns
  int 0, <0 on error.

Definition at line 20 of file ctf.cpp.

## ◆ volt() [1/2]

double CTFparam::volt | ( |  | ) |
| inline

Definition at line 83 of file ctf.h.

## ◆ volt() [2/2]

void CTFparam::volt | ( | double | v | ) |
| inline

Definition at line 84 of file ctf.h.

## ◆ zero()

double CTFparam::zero | ( | int | i | ) |
| inline

Definition at line 218 of file ctf.h.

## ◆ zeroes()

vector< double > CTFparam::zeroes | ( | double | max_s | ) |

Calculates the zeroes of a CTF curve on the spatial frequency scale.

Parameters

  max_s | maximum spatial frequency.

Returns
  vector<double> array of spatial frequencies for zeroes, NULL on error.

      The nth zero is given by the reciprocal space distance where the
      phase shift term is equal to -n*PI:
      phase = 0.5*PI*lambda^3*Cs*s^4 - PI*lambda*defocus*s^2 = -n*PI
      ctf_fz = defocus/(Cs*lambda^2)
      zero(n) = sqrt(ctf_fz - sqrt(ctf_fz^2 - 2.0*n/(Cs*lambda^3)))
      Defocus values are positive for underfocus.
      The array returned start with the first zero at index 0.

Definition at line 115 of file ctf.cpp.

The documentation for this class was generated from the following files:

- /Users/bernard/b20/bsoft/include/ctf.h
- /Users/bernard/b20/bsoft/src/util/ctf.cpp