Guide to Ctfplotter

University of Colorado, Boulder

Ctfplotter plots noise-subtracted, rotationally averaged power spectra from tilt series data and allows one to determine the position of the first zero of the microscope CTF. The power spectra are obtained by extracting small squares of image (referred to as tiles) that overlap by 50%, taking their 2D Fourier transforms, rotationally averaging the transforms to obtain one-dimensional curves, dividing by the corresponding curves obtained from images consisting only of noise, and summing these 1D curves. Once defocus is determined from such power spectra, the phase inversions of the CTF can be corrected with the program Ctfphaseflip. Defocus can be found in angular subranges of the tilt series. The defocus values are stored in a table so that they can be visualized, deleted, or recomputed if necessary. All of the values in the table are saved to the defocus file, which is provided as input to Ctfphaseflip.

The CTF Graph

  1. The plotter shows graphs of image power as a function of spatial frequency. The X coordinate is in cycles per pixel (also referred to as reciprocal pixels). 0.5 equals the Nyquist frequency determined by the pixel size. If the pixel size is in nanometers, any frequency on the X axis can be converted to 1/nm by dividing by the pixel size.
    The Y coordinate is the logarithm of image power.
  2. The magenta curve is the logarithm of the power spectrum of the selected views after subtracting the noise floor.
    If you use a fitting method that fits just one curve, the green curve fits the magenta curve from "X1_starts" to "X2_ends", which can be set in the fitting range dialog.
    If you use a method that fits two curves, the green curve is fit to the magenta curve from "X1_starts" to "X1_ends" and the blue curve fits the magenta curve from "X2_starts" to" X2_ends", all of which can be set in the fitting range dialog.
    In either case, the curves are drawn over the whole frequency range.
  3. To zoom in an area, hold down the left mouse button down and draw a rubber band around that area.
    To go back to the previous zoom level, push the Zoom-out icon.
    Successive zooms are kept in a list, and you can go forward or backward through the zooms using either the Zoom-in and Zoom-out icons or the standard hot keys for zooming in 3dmod, "-" or "+/=".
  4. Use arrow keys to scroll vertically and horizontally. You can also use the mouse scroll wheel to scroll vertically.
  5. The text field marked with "Z" on the top line reports the frequency of the first zero, either found by fitting to the power spectra, or set by double-clicking with the left mouse button. The absolute frequency of the first zero in 1/nm is this frequency divided by the pixel size.
    The text field marked with "D" on the top line reports the found defocus in microns.
    If you double-click on the position of the second zero with the middle or right mouse button, the text field marked "D2" shows the defocus implied by that second zero position, and the text field marked "D-avg" shows the average of the defocus from the first and second zeros.
  6. Double clicking at a point in the plot with the left mouse button will set the found frequency of the first zero to the frequency at point.
    The found defocus field will change accordingly. This is useful for manually locating the first zero and finding its corresponding defocus.
    Once a first zero position is set either by fitting or manually clicking, double-clicking with the middle or right mouse button can be used to indicate the second zero position. The text fields based on the second zero will be set back to "NA" whenever a new first zero is set.

Tool Button Usage

Angles Open the tilt angle range and tile selection dialog.
Fitting Open the Fitting Ranges and Methods dialog.
zoominButton Zoom in again after zooming back out.
zoomoutButton Zoom out after zooming in.
moretileButton Adding Non-center Tiles button. If this button is enabled, the current estimation is based only on center tiles; push this button to add non-center tiles to the current estimation.
printerButton Print the plotted curves.
helpButton Bring up Qt assistant to display this page.


Fitting Ranges & Methods Dialog

This dialog allows three different kinds of fitting, which can be selected by the radio buttons at the top. After changing parameters, either press Apply or type the "Enter" key in one of the text boxes to have the fit recomputed with the current parameters.

rangeDialog

Fitting to a CTF-like curve involves finding four to seven parameters, depending on the extent of the fit and whether the option Vary exponent of CTF function is selected. Varying the exponent can allow the curve to fit better to the width of the dip around the first zero, but since it adds a parameter, it can destabilize the fitting and produce bad results in some cases. One of the parameters of the curve is the defocus. The other parameters for a basic fit are an additive factor, a scaling factor, and the decay rate for an exponential that attenuates the curve. However, when there is detectable signal between the second and third zeros and the fitting region is extended to at least halfway between those zeros, the program automatically adds two more parameters, a scaling factor and decay rate for a second exponential. The benefit of this is illustrated in one of the examples below.

The range of the curve is set from the entries X1 Starts and X2 Ends. When the program first starts, it sets these values to be about 0.05/pixel before the first zero, and close to the second zero, respectively, based on the expected defocus. If necessary, you should adjust the starting value so that it is to the right of where the fitted curve strongly deviates from the actual. If the magenta curve become noisy and falls off before a second zero, you should also reduce the ending point of the fit to exclude that region. See the example below.

The fit does rely on an initial approximate value for the defocus and may fail if the actual defocus is far from that value. It takes this value either from the expected defocus or from the current defocus estimate, depending on whether the option is selected to use the current defocus estimate in the Tilt Angle Range Dialog. If the defocus revealed by the power spectrum is far from the expected defocus, you should either change the value of the expected defocus, or select the option to use the current defocus estimate and make sure that estimate is approximately correct.

You can also fit a polynomial to the region around the first zero. The Order of polynomial spin button allows you to select an order between 2 and 6, which involves finding 3 to 7 parameters. The goal here is to get a smooth curve through the dip; the minimum of the curve is taken as the location of the first zero.

As for CTF-like fitting, the range of the curve is set from the entries X1 Starts and X2 Ends. Since you are just trying to localize the dip at the first zero, you should restrict the range as necessary to get a good fit there.

Finding the zero at the intersection of two curves involves fitting two separate curves, before and after the first zero. Each can be fit to either a straight line or a Gaussian over the selected range. The program finds the intersection of the two curves, if possible, and assigns that as the first zero.

X1 sets the fitting range for the curve before the first zero, drawn in green. Use the X1 fitting method radio button to select whether to fit to a straight line or to a Gaussian.

X2 sets the fitting range for the curve after the first zero, drawn in blue. Use the X2 fitting method radio button to fit to a straight line or to a Gaussian.

This dialog also has a control, the Baseline fitting order, to allow a polynomial to be fit to the apparent baseline of the power spectrum at frequencies past the first zero. This polynomial can then be subtracted to make the baseline be flat. This fitting is not on by default (the order is 0) because this baseline adjustment can actually degrade the quality of fits to the curve itself in cases where the baseline is already relatively flat. An order of 2 is generally sufficient but orders of 3 and 4 are possible. The order can also be adjusted with hot keys 0, 1, 2, 3, and 4.

Angle Range and Tile Selection Dialog

This dialog presents the various parameters that control how the power spectrum is computed. After changing parameters, either press Apply or type the "Enter" key in one of the text boxes to have the curve recomputed with the current parameters. The dialog also shows the table of defocus values and allows it to be manipulated. Because of the importance of this dialog, it is opened automatically when the program starts.

angleDialog

Starting tilt angle
Ending tilt angle:
The views with tilt angle greater than or equal to the starting angle but less than or equal to the ending angle will be included in the estimation. If you enter a value beyond the end of the range of angles in the tilt series, it will be adjusted to the starting or ending angle of the series.

Step angle range:
Pressing Step Up or Step Down will shift the angular range by the amount in the Step angle range by text box. This step size will be added to or subtracted from both the starting and ending tilt angles. If the shift would make one of the limiting angles go outside the bounds of the tilt series, both angles are changed by a lesser amount so as to keep the range the same size. The power spectrum is computed and fit to at the new angular range. The step size is initialized to be half the original angular range.

Autofitting:
Once fitting parameters have been set optimally and an appropriate angular range has been chosen, the Autofit All Steps button can be used to step automatically to a series of angular ranges, find the defocus, and store the defocus in the table.

Tile parameters:
The + pushbutton will open up a section of the dialog for parameters that are rarely adjusted; they include:

Expected defocus:
This field starts out with the expected defocus value specified in the parameter file, but you can change it. Initially, this value is used to compute the expected frequency of the first zero of the power spectrum and to set the initial values of the X1 and X2 ranges which determine what segments of the power spectrum are fitted. When non-center tiles are being included, Ctfplotter uses a defocus to compute shifts needed to align the power spectra of non-center tiles with the CTF curve of center tiles. With the radio button group Which defocus to use, you can specify whether to use the expected defocus shown in the Expected defocus (um) Edit field or the defocus previously found by the program as the defocus for computing the shifts.

Initial tiles to include radio button group:
Choose whether or not to include the noncenter tiles in the estimation when computing the power spectrum.
If Only central tiles is checked, only the center region defined by Center defocus tol will be included in the next computation, and the "Adding Non-center Tiles" button will be enabled. You need to push that button to add the left region defined by Left defocus tol and the right region defined by Right defocus tol to the estimation.
If All tiles  is checked, all regions (center, left, right) will be included when the curve is recomputed, and the "Adding Non-center Tiles" button will be disabled.

Store Defocus in Table:
Push this button to store the defocus found for the selected views in the angles and defocus table.  The defocus indicated by "D" is stored unless a second zero has been clicked, in which case the average defocus indicated by "D-avg" is stored.

Angles and Defocus Table:
This table shows the starting and ending tilt angle, the middle of the angular range, and the defocus value for each range where you have stored results. The lines are in order by the middle of the angular range. When you store a value for an angular range matching that of an existing line in the table, the existing defocus value is replaced with the new one. When the program starts, this table is loaded with values from an existing version of the output file. Below the table are three buttons that operate on the table:

Push the Delete Row button to delete the entry for the currently selected row of the table. If you store results for an angular range and then want to replace them with results from a wider or narrower range, you would need to delete the row with the initial results.

Push the Set Tilt Angles button to reset the starting and ending tilt angles to the values on the currently selected row of the table and recompute the power spectrum. To conveniently step through a series of angular ranges, click the mouse anywhere on a row to select that row of the table. Then press the Set Tilt Angles button with the mouse, or using the keyboard accelerator Alt-T. Thereafter, you can type an up or down arrow key to move up or down in the table and press this button again, without moving the mouse. Alternatively, you can double click in the table to select a row and have its power spectrum displayed.

Push the Save to File button to write the contents of the angles and defocus table to the output file.

Examples

The first example shows the appearance of the plotting window with a tilt series from bovine papilloma virus, taken at a nominal defocus of 3 microns and a pixel size of 0.76 nm. These data were taken on a CCD camera and there is little useful signal past the first zero. When the program is started with the default angular range in the command file, the window looks like this:

The range of the display in Y is dominated by the power at low frequencies, so it is essential to zoom the display. This graph was zoomed by pressing the left mouse button with the cursor just above the second low hump in the magenta curve (at ~0.13 in X), then dragging the mouse to just below the curves and just to the left of 0.4 to set the lower right corner of the rubber band. Then the window looks like this:

Now we can see more clearly that the background subtraction is giving a reasonable power spectrum that is close to flat at high frequencies. The next step is to add in all of the tiles, either by pushing the "Adding Non-center Tiles" button or by opening the Angle range dialog and switching to the All tiles option. These two methods will give slightly different results, and the latter is actually preferable.

The power spectrum is much smoother and it is now easier to see that it has a discernable dip, but that the green curve does not fit very well. If we open the Fitting Range & Method dialog, we see that it is fitting from 0.215 to 0.39, a range that was determined from the nominal defocus but is not quite appropriate for the actual defocus. The range was changed to what was shown above in the dialog: the left side was moved to 0.19 to include more of the falling phase of the power spectrum, and the right side was reduced to 0.29 because the power spectrum drops off after that point, well before its second zero. At this point it is also clear that the actual defocus is different from 3 microns, so we select the Current defocus estimate radio button in the Angle Range dialog so that the shifting from non-centered tiles will be more accurate. If the fitting were unstable, a better way to do this would be to change the Expected defocus entry. After recomputing the curves and zooming the display again, it looks like this:

Here we see that the CTF-like fitting works fairly well near the bottom of the dip, and that it leads to a defocus estimate significantly different from the nominal defocus. Turning on the Vary exponent of CTF function gives a slightly different fit:

This fitting method can now be used over different angular ranges, and the results can be stored from each range. If Autofit All Steps is used over the full extent of the tilt series, four ranges have defocus values near 3.5 but the last one has a value of only 3.1 microns. The curve for this range lacks a dip, so this value is wrong. This problem is solved by restricting the high end of the extent analyzed to 57 degrees. After running with this extent and loading the last range to verify that its spectrum has a dip, the angle dialog looks like this:

Although there is no need to try the different fitting methods with this data set, they are illustrated next.

This panel shows the power spectrum for the initial angular range with a fourth-order polynomial fit to the frequency range shown in the dialog above. As is typical of polynomials, the green curve goes off wildly outside the fitting range.

This panel shows the power spectrum with determination of the zero from the intersection of two curves, with the frequency range as shown in the dialog above.

The second example is from microtubules decorated with Eg5, taken with a DE-12 direct detector camera at a nominal defocus of 6 microns. This shows the spectrum and CTF-like fit for an angular range of -20 to 20 degrees, after switching to including all tiles included and using the current defocus estimate.

The fitting range here was 0.085 to 0.19, and it needs to be changed because the defocus is different from the nominal value, and also because there is good signal between the second and third zeros. Changing the fitting range to 0.1 to 0.25 and varying the exponent of the CTF curve gives the following:

The curve fits the second peak much better now because the fit includes two exponential decays, one dominated by the falloff of the power spectrum before the first zero and the other to accommodate the very different decay from the first to the second peak. With this data set, it was possible to fit ranges of 10 degrees, although ranges of 20 degrees gave cleaner results at one end of the tilt range, but the data were too noisy to allow reliable fitting to every individual image.

The third example is from the ventral disk of Giardia, taken with a Gatan K2 camera in an electron-counting mode at a nominal defocus of 4 microns. This is the initial spectrum of -20 to 20 degrees after zooming, and selecting all tiles and the current defocus estimate.

Here, for whatever reason, the power spectra of the noise images do not match that of the actual data, and it is necessary to turn on the fitting to the baseline in the Fitting dialog.

With the baseline fitting turned on (with order 2, in this case), it is clear that the data can be fit to the third zero, and the fit here is with the fitting range set to end at 0.375. These data had low enough noise that it was possible to fit every image. This is accomplished by turning on the Fit each view separately check box and then pressing the button now labeled Autofit All Single Views.

This is a representative spectrum and fit from a tilt of 33 degrees.
Refer to Ctfplotter man page