Method

We use the constrained nonlinear multi-variable optimization function fmincon in Matlab as the core technique. The Contrast Transfer Function (CTF) of electron microscope is modeled as in the EMAN software.

Software dependency

Software
Version
Comments
Cost
Matlab
any
Version 6.5 and 7.0 are tested. Other versions might also work
Commercial
Matlab Optimization Toolbox
any
To provide fmincon function
Python
2.3 and above
must have optparse module
Free Open Source
pymat
CVS version. v1.1.90 does not work (at least not on Mandrake 9.0)
Here is the one I am using: pymat-python2.3-matlab6.5-linux.tar.gz, pymat-python2.3-matlab7-linux32.so, pymat-python2.3-matlab6.5-win32.pyd, pymat-python2.3-matlab7-win32.pyd
provides Python module to control Matlab engine

to install the one I provide: untar the file pymat-python2.3.tar.gz, mv the new directory pymat to a directory in the $PYTHONPATH
 values, or create the PYTHONPATH variable to contain the pymat directory

make sure to include the following files from your Matlab installation into your run time library search path (i.e. LD_LIBRARY_PATH).  $MATLAB refers to the root directory of your Matlab installation.
$MATLAB/extern/lib/glnx86/libeng.so
$MATLAB/extern/lib/glnx86/libmat.so
$MATLAB/extern/lib/glnx86/libmx.so
$MATLAB/extern/lib/glnx86/libut.so
$MATLAB/sys/os/glnx86/libstdc++-libc6.1-2.so.3
Numeric Python
any
required by pymat.  most linux distributions have it but might not install it by default
EMAN
>2004-4-4 release
must have Python wrapping built

Usage

Just type fitctf.py and it will display the usage documentation as the following:

usage: fitctf.py <*.img>|<*.hdf>|<*.tnf> [options]

options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  --sf=<structural factor file>
                        the structural factor curve file. use constant
                        structural factors if this file is not given
  --fitsf=<structural factor file>
                        fit the structural factor curve from the images and
                        save to the file
  --apix=<Angstrom/pixel>
                        [Required] the sampling of the image, in unit of
                        Angstrom/pixel
  --cs=<Cs>             [Required] the microscope's spherical abberation, in
                        unit of mm
  --voltage=<voltage>   [Required] the microscope's accelerating voltage, in
                        unit of kV
  --min_s=<minimal spatial freq>
                        the minimal spatial frequency to include in fitting, in
                        unit of 1/Angstrom. default to 0.01
  --max_s=<maximal spatial freq>
                        the maximal spatial frequency to include in fitting, in
                        unit of 1/Angstrom. default to 1.0
  --min_defocus=<minimal defocus>
                        the closest focus to consider, in unit of micrometer
                        and positive for underdefocus. default to 0
  --max_defocus=<maximal defocus>
                        the largest focus to consider, in unit of micrometer
                        and positive for underdefocus. default to 4
  --max_bfactor=<maximal B-factor>
                        the largest B-factor to consider, in unit of
                        Angstrom^2. default to 1000
  --min_ac=<minimal amplitude contrast>
                        the smallest amplitude contrast to consider, in range
                        [0-1]. default to 0
  --max_ac=<maximal amplitude contrast>
                        the largest amplitude contrast to consider, in range
                        [0-1]. default to 0.2
  --oversample=<n>      oversample <n> times the power spectrum so there is
                        enough sampling points to fit for small particles. only
                        used when inputs are individual particle images.
                        default to 1 to disable
  --gridbox=<box size>  if perform grid boxing first for a large micrograph/ccd
                        image. default to 0 to disable
  --anisotropy_bins=<number of angular bins>
                        the number of angular bins (>8) to fit astigmatism and
                        drift. default to 0 to disable astigmatism/drift
                        fitting
  --ctfparm=<output parameter file>
                        the output filename for the fitting results to save.
                        default to ctfparm.txt
  --astigmatism         to fit astigmatism. must also set anisotropy_bins>=8 to
                        activate. disabled by default
  --drift               to fit drift. must also set anisotropy_bins>=8 to
                        activate. disabled by default
  --pause=<seconds>     to pause the fitting for the specified number of
                        seconds after each micrograph, -1 will stop and wait
                        for keyboard return to continue. default to 0 to
                        disable pausing
  --show_fit            to show the fitting plot during the fitting process.
                        disabled by default
  --keep_pwr            to keep the power spectrum files (*.pwr). disabled by
                        default
  --useoldmfile         won't write new Matlab .m scripts and use exisiting
                        scripts. disabled by default to output new scripts