Bsoft 2.1.4
Bernard's software package
CTFparam Class Reference

#include <ctf.h>

Public Member Functions

 CTFparam ()
 
 CTFparam (string s)
 
 CTFparam (double v, double sa, double ac)
 
int update (CTFparam *ctf)
 
int update (CTFparam &ctf)
 Updates a CTF structure from another. More...
 
void identifier (string s)
 
string & identifier ()
 
long select ()
 
void select (long i)
 
double volt ()
 
void volt (double v)
 
double focal_length ()
 
void focal_length (double v)
 
double Cc ()
 
void Cc (double v)
 
double alpha ()
 
void alpha (double v)
 
double dE ()
 
void dE (double v)
 
double aberration_weight (long n, long m)
 
void aberration_weight (long n, long m, double v)
 
void add_aberration_weight (long n, long m, double v)
 
map< pair< long, long >, double > & aberration_weights ()
 
void aberration_weights (map< pair< long, long >, double > &wa)
 
void update_aberration_weights (map< pair< long, long >, double > &wa)
 
double objective_aperture ()
 
void objective_aperture (double v)
 
double slit_width ()
 
void slit_width (double v)
 
double amp_shift ()
 
void amp_shift (double v)
 
double beam_tiltX ()
 
double beam_tiltY ()
 
void beam_tiltX (double v)
 
void beam_tiltY (double v)
 
void beam_tilt (double x, double y)
 
double defocus_average ()
 
void defocus_average (double v)
 
double defocus_deviation ()
 
double astigmatism_angle ()
 
void astigmatism (double dev, double ang)
 
double Cs ()
 
void Cs (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)
 
void baseline (long t, 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)
 
void envelope (long t, vector< double > &v)
 
double fom ()
 
void fom (double v)
 
double aberration_coefficient (long n, long m)
 
double aberration_coefficient (pair< long, long > a)
 
string aberration_weight_string ()
 
vector< double > aberration_even ()
 
vector< double > aberration_even_difference ()
 
void aberration_even (vector< double > &v)
 
void aberration_even_update (vector< double > &v)
 
vector< double > aberration_odd ()
 
void aberration_odd (vector< double > &v)
 
void aberration_odd_update (vector< double > &v)
 
void convert_zernike ()
 
void add_zernike_even (vector< double > &v)
 
void add_zernike_odd (vector< double > &v)
 
vector< double > zernike_even ()
 
vector< double > zernike_odd ()
 
void delete_aberration (int which=3)
 
bool check_defocus ()
 
double lambda ()
 
double frequency_cutoff ()
 
long double calculate_aberration_even (double s2, double angle)
 
long double calculate_aberration_odd (double s2, double angle)
 
Complex< double > aberration_odd_complex (double s2, double angle)
 
long double delta_phi (double s2, double angle)
 
long 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...
 
vector< double > maxima (double max_s)
 Calculates the maxima 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...
 
double partial_coherence (double s)
 Calculates the envelope curve based on partial coherence. More...
 
vector< double > envelope_partial_coherence (long n, double freq_step)
 Calculates the envelope curve based on partial coherence. More...
 
double energy_spread (double s2)
 Calculates the envelope curve based on energy spread. More...
 
vector< double > envelope_energy_spread (long n, double freq_step)
 Calculates the envelope curve based on energy spread. More...
 
double partial_coherence_and_energy_spread (double s2)
 Calculates the envelope curve based on partial coherence and energy spread. More...
 
double zero (int i)
 
double defocus_for_first_zero (double s)
 
void show ()
 
void show_aberration ()
 
void show_baseline ()
 
void show_envelope ()
 

Constructor & Destructor Documentation

◆ CTFparam() [1/3]

CTFparam::CTFparam ( )
inline

◆ CTFparam() [2/3]

CTFparam::CTFparam ( string  s)
inline

◆ CTFparam() [3/3]

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

Member Function Documentation

◆ aberration_coefficient() [1/2]

double CTFparam::aberration_coefficient ( long  n,
long  m 
)
inline

◆ aberration_coefficient() [2/2]

double CTFparam::aberration_coefficient ( pair< long, long >  a)
inline

◆ aberration_even() [1/2]

vector< double > CTFparam::aberration_even ( )
inline

◆ aberration_even() [2/2]

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

◆ aberration_even_difference()

vector< double > CTFparam::aberration_even_difference ( )
inline

◆ aberration_even_update()

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

◆ aberration_odd() [1/2]

vector< double > CTFparam::aberration_odd ( )
inline

◆ aberration_odd() [2/2]

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

◆ aberration_odd_complex()

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

◆ aberration_odd_update()

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

◆ aberration_weight() [1/2]

double CTFparam::aberration_weight ( long  n,
long  m 
)
inline

◆ aberration_weight() [2/2]

void CTFparam::aberration_weight ( long  n,
long  m,
double  v 
)
inline

◆ aberration_weight_string()

string CTFparam::aberration_weight_string ( )
inline

◆ aberration_weights() [1/2]

map< pair< long, long >, double > & CTFparam::aberration_weights ( )
inline

◆ aberration_weights() [2/2]

void CTFparam::aberration_weights ( map< pair< long, long >, double > &  wa)
inline

◆ add_aberration_weight()

void CTFparam::add_aberration_weight ( long  n,
long  m,
double  v 
)
inline

◆ add_zernike_even()

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

◆ add_zernike_odd()

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

◆ alpha() [1/2]

double CTFparam::alpha ( )
inline

◆ alpha() [2/2]

void CTFparam::alpha ( double  v)
inline

◆ amp_shift() [1/2]

double CTFparam::amp_shift ( )
inline

◆ amp_shift() [2/2]

void CTFparam::amp_shift ( double  v)
inline

◆ astigmatism()

void CTFparam::astigmatism ( double  dev,
double  ang 
)
inline

◆ astigmatism_angle()

double CTFparam::astigmatism_angle ( )
inline

◆ baseline() [1/6]

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

◆ baseline() [2/6]

void CTFparam::baseline ( double *  b)
inline

◆ baseline() [3/6]

double CTFparam::baseline ( int  i)
inline

◆ baseline() [4/6]

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

◆ baseline() [5/6]

void CTFparam::baseline ( long  t,
vector< double > &  b 
)
inline

◆ baseline() [6/6]

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

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

◆ baseline_type() [1/2]

long CTFparam::baseline_type ( )
inline

◆ baseline_type() [2/2]

void CTFparam::baseline_type ( long  t)
inline

◆ beam_tilt()

void CTFparam::beam_tilt ( double  x,
double  y 
)
inline

◆ beam_tiltX() [1/2]

double CTFparam::beam_tiltX ( )
inline

◆ beam_tiltX() [2/2]

void CTFparam::beam_tiltX ( double  v)
inline

◆ beam_tiltY() [1/2]

double CTFparam::beam_tiltY ( )
inline

◆ beam_tiltY() [2/2]

void CTFparam::beam_tiltY ( double  v)
inline

◆ calc_baseline()

double CTFparam::calc_baseline ( double  s)
inline

◆ calc_envelope()

double CTFparam::calc_envelope ( double  s)
inline

◆ calculate() [1/2]

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

◆ calculate() [2/2]

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

Calculates a CTF curve.

Parameters
nradnumber of radii.
npsinumber of angular segments.
step_sizereciprocal 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.

◆ calculate_aberration_even()

long double CTFparam::calculate_aberration_even ( double  s2,
double  angle 
)
inline

◆ calculate_aberration_odd()

long double CTFparam::calculate_aberration_odd ( double  s2,
double  angle 
)
inline

◆ calculate_complex()

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

◆ Cc() [1/2]

double CTFparam::Cc ( )
inline

◆ Cc() [2/2]

void CTFparam::Cc ( double  v)
inline

◆ check_defocus()

bool CTFparam::check_defocus ( )
inline

◆ convert_zernike()

void CTFparam::convert_zernike ( )
inline

◆ Cs() [1/2]

double CTFparam::Cs ( )
inline

◆ Cs() [2/2]

void CTFparam::Cs ( double  v)
inline

◆ dE() [1/2]

double CTFparam::dE ( )
inline

◆ dE() [2/2]

void CTFparam::dE ( double  v)
inline

◆ defocus_average() [1/2]

double CTFparam::defocus_average ( )
inline

◆ defocus_average() [2/2]

void CTFparam::defocus_average ( double  v)
inline

◆ defocus_deviation()

double CTFparam::defocus_deviation ( )
inline

◆ defocus_for_first_zero()

double CTFparam::defocus_for_first_zero ( double  s)
inline

◆ delete_aberration()

void CTFparam::delete_aberration ( int  which = 3)
inline

◆ delta_phi()

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

◆ energy_spread()

double CTFparam::energy_spread ( double  s2)

Calculates the envelope curve based on energy spread.

Parameters
s2spatial frequency squared.
Returns
double amplitude.

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.

◆ envelope() [1/6]

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

◆ envelope() [2/6]

void CTFparam::envelope ( double *  v)
inline

◆ envelope() [3/6]

double CTFparam::envelope ( int  i)
inline

◆ envelope() [4/6]

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

◆ envelope() [5/6]

void CTFparam::envelope ( long  t,
vector< double > &  v 
)
inline

◆ envelope() [6/6]

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

◆ envelope_energy_spread()

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

Calculates the envelope curve based on energy spread.

Parameters
nnumber of spatial frequency steps.
freq_stepsize 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.

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

◆ envelope_partial_coherence()

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

Calculates the envelope curve based on partial coherence.

Parameters
nnumber of spatial frequency steps.
freq_stepsize 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.

◆ envelope_type() [1/2]

long CTFparam::envelope_type ( )
inline

◆ envelope_type() [2/2]

void CTFparam::envelope_type ( long  t)
inline

◆ focal_length() [1/2]

double CTFparam::focal_length ( )
inline

◆ focal_length() [2/2]

void CTFparam::focal_length ( double  v)
inline

◆ fom() [1/2]

double CTFparam::fom ( )
inline

◆ fom() [2/2]

void CTFparam::fom ( double  v)
inline

◆ frequency_cutoff()

double CTFparam::frequency_cutoff ( )
inline

◆ identifier() [1/2]

string & CTFparam::identifier ( )
inline

◆ identifier() [2/2]

void CTFparam::identifier ( string  s)
inline

◆ lambda()

double CTFparam::lambda ( )
inline

◆ maxima()

vector< double > CTFparam::maxima ( double  max_s)

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

Parameters
max_smaximum spatial frequency.
Returns
vector<double> array of spatial frequencies for maxima, NULL on error.
Thus uses the zeroes function to find the maxima.
Defocus values are positive for underfocus.
The array returned start with the first zero at index 0.

◆ objective_aperture() [1/2]

double CTFparam::objective_aperture ( )
inline

◆ objective_aperture() [2/2]

void CTFparam::objective_aperture ( double  v)
inline

◆ parse_baseline_equation()

int CTFparam::parse_baseline_equation ( Bstring  base_eq)

Extracts the coefficients from the baseline string.

Parameters
base_eqbaseline equation string.
Returns
int equation type.
The baseline string is scanned in one of the three supported formats.

◆ parse_envelope_equation()

int CTFparam::parse_envelope_equation ( Bstring  env_eq)

Extracts the coefficients from the envelope string.

Parameters
env_eqenvelope equation string.
Returns
int 0.
The envelope string is scanned to get the 4 double gaussian parameters.

◆ partial_coherence()

double CTFparam::partial_coherence ( double  s)

Calculates the envelope curve based on partial coherence.

Parameters
sspatial frequency.
Returns
double amplitude.

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.

◆ partial_coherence_and_energy_spread()

double CTFparam::partial_coherence_and_energy_spread ( double  s2)

Calculates the envelope curve based on partial coherence and energy spread.

Parameters
s2spatial frequency squared.
Returns
double amplitude.

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

◆ select() [1/2]

long CTFparam::select ( )
inline

◆ select() [2/2]

void CTFparam::select ( long  i)
inline

◆ show()

void CTFparam::show ( )
inline

◆ show_aberration()

void CTFparam::show_aberration ( )
inline

◆ show_baseline()

void CTFparam::show_baseline ( )
inline

◆ show_envelope()

void CTFparam::show_envelope ( )
inline

◆ slit_width() [1/2]

double CTFparam::slit_width ( )
inline

◆ slit_width() [2/2]

void CTFparam::slit_width ( double  v)
inline

◆ update() [1/2]

int CTFparam::update ( CTFparam ctf)

Updates a CTF structure from another.

Parameters
ctfCTF structure with new information.
Returns
int 0, <0 on error.

◆ update() [2/2]

int CTFparam::update ( CTFparam ctf)
inline

◆ update_aberration_weights()

void CTFparam::update_aberration_weights ( map< pair< long, long >, double > &  wa)
inline

◆ volt() [1/2]

double CTFparam::volt ( )
inline

◆ volt() [2/2]

void CTFparam::volt ( double  v)
inline

◆ zernike_even()

vector< double > CTFparam::zernike_even ( )
inline

◆ zernike_odd()

vector< double > CTFparam::zernike_odd ( )
inline

◆ zero()

double CTFparam::zero ( int  i)
inline

◆ zeroes()

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

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

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

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