ctfplotter(1)               General Commands Manual              ctfplotter(1)

       ctfplotter - estimate defocus values of a tilt series

       ctfplotter  options

       This GUI program will plot the logarithm of a rotationally averaged
       power spectrum of an input tilt series after subtracting background
       noise .  The method is based on periodogram averaging; namely, averag-
       ing of spectra from small, overlapping areas of the images, referred to
       as tiles.  The user can interactively choose which projection views are
       included in the averaging.  It is also possible to run the program non-
       interactively for automatic fitting.  A standalone version can be built
       without the Qt graphical toolkit and can only be used non-interactively
       for automatic fitting.

   Noise Files
       The noise floor can be based on actual measurements of noise in an
       image taken with no specimen in the beam.  The program does have an
       alternative method of subtracting a background level that is based on
       fitting two lines to the spectrum, one to the rapidly falling region at
       low frequencies and one to the more gradually falling high-frequency
       end.  This method work wells with data from an electron counting camera
       and may work on other data from direct detectors.  However, if this
       method does not work, you need to supply noise images.

       To get noise images, collect a set of blank images at a series of beam
       intensities.  They can be placed in separate files or all in one stack.
       These noise images are specific not only to the microscope but also to
       the camera used, the operating voltage, and the binning.  However,
       these are not factors that vary over time (unless there is some radical
       change in the camera), so you should only have to collect these images
       once.  The mean counts in these images should span the range of the
       mean counts in the data being analyzed.  The interval between intensi-
       ties can be a factor of 1.5; interpolation is used to estimate the
       noise for an image whose mean counts do not match one of the noise
       images.  For example, for a camera that has a gain of 10 counts per
       electron, one might collect images at mean counts near 100, 150, 225,
       etc., up to 1710.  With a 1 nm pixel size, these noise images could be
       used with images where the dose recorded at the camera ranged from 0.1
       to 1.7 electrons per square Angstrom.  If you need images for analyzing
       both unbinned and binned data, you can take one set of unbinned noise
       images and then bin them with a Newstack command like this:
          newstack -bin 2 -mult 4,0  input_file output_file

       The multiplication by 4 (the square of the binning factor) is necessary
       to make the counts be the same as they would be for binned images from
       the microscope with the same exposure.

       If there are significant numbers of X-rays in the noise images, you
       should clean them with Ccderaser, such as with:
          ccderaser -find -peak 8 -diff 6  input_file output_file

       The noise images must have positive means; i.e., their values should be
       proportional to the recorded electrons.  If they are acquired with
       software that subtracts 32768 before storing as signed integers, then
       you need to add this offset back to the data in order to use them as
       noise images.

       If the noise images are in one stack, its file name is entered directly
       with the -config option. If the noise images are in separate files,
       they are listed in a simple text file, the configuration file specified
       by the -config option.  To be found easily from within Etomo, the lat-
       ter file, or a single stack, should be placed in a directory named
       /usr/local/ImodCalib/CTFnoise or in $IMOD_CALIB_DIR/CTFnoise if the
       environment variable IMOD_CALIB_DIR has been defined differently from
       the default.  Noise files can be placed in a subdirectory of CTFnoise,
       for example, F20.  In this case, the configuration file would contain a
       list like this:

   Noise Files for Direct Detector Cameras
       For direct electron detector cameras, the actual power spectra may not
       fit the noise spectra very well, particularly if motion correction is
       applied to tilt series movie frames, or if electron counting is used.
       The fitting of a polynomial to the baseline of the power spectrum,
       described below, will generally give a flat enough power spectrum at
       higher frequencies.  However, when using motion correction, there are
       two potential solutions that may give better noise files.  Spectra from
       ordinary noise images will not fit the actual spectra if the aligning
       and summing of movie frames attenuates the high frequencies, which is
       inevitable if interpolation is done in real space to align the images.
       The best remedy is to shift frames into alignment with phase shifts in
       Fourier space instead of with interpolation.  This operation preserves
       the high frequency power.  Frames that have been aligned in SerialEM's
       plugin to DigitalMicrograph or in Alignframes have been shifted in
       Fourier space, preserving the power.  If you determine the frame align-
       ment some other way, you can transform the frames in Newstack with
       the -phase option to shift them in Fourier space.  The second remedy
       would be to collect movie frames for the noise images and apply small
       shifts to them by the same method used to shift actual frames before
       summing them.  Since the noise frames cannot be aligned, the shifts
       need to be obtained some other way; either take a set of shifts from
       real images, or use some random numbers between 0 and 1.

       At least currently, the response of an electron counting camera depends
       on the dose rate, which raises the question of whether to vary exposure
       time or beam intensity when taking the set of noise images.  In princi-
       ple, varying beam intensity will replicate the differences between
       light and dark areas in the same image; varying exposure time will give
       noise images applicable to a range of images taken with the same dose
       rate but different exposure times.  There does not seem to be a good
       solution here.

       As of IMOD 4.10.18, the baseline fitting option is turned on by default
       since its performance has been improved.  It can be disabled, or the
       polynomial order set, in a template file when processing through Etomo;
       for example, the template directive
         comparam.ctfplotter.ctfplotter.BaselineFittingOrder = 2
       will restrict the fitting to a parabolic baseline.

   Inverting Tilt Angles
       Several different conditions can result in the defocus gradient of
       tilted images being in the wrong direction, and the remedy is to invert
       the sign of tilt angles with the -invert option both here and in Ctf-
       phaseflip(1).  Two common ways for gradient inversion to occur are if
       the tilt series images have inverted handedness relative to a true pro-
       jection of the structure, or if the tilt axis rotation angle is off by
       180 degrees.  Tests indicate that when tilt images have inverted hand-
       edness and the tilt axis rotation angle is set by applying the same
       inversion to the tilt axis as to the image, the handedness is restored
       in reconstructions, but the tilt angles need inversion here.  If the
       tilt axis is set 180 degrees away from that, the tilt angles do not
       need inversion, but the tomogram still has inverted handedness.  In
       such a case, the tomogram should be post-processed by flipping Y and Z
       instead of rotating about X.  In contrast, if the images are not
       flipped but the axis is mistakenly set 180 degrees from its true value,
       the tilt angles DO need inversion and the tomogram will have inverted

       The standard SerialEM configuration for a JEOL microscope with an omega
       filter is to have the properties "InvertStageXAxis" and "RotateHead-
       erAngleBy180" set, in which case tomogram handedness will be correct
       but the tilt angles will need inversion here.  If you have data from
       such a microscope, you need to set the -invert option.

       One way to assess the need to invert angles is to examine the images in
       a stack aligned for reconstruction, with the tilt axis vertical.  At
       positive tilt angles, the right side of the images should be more
       underfocused than the left side; if not, then this option is needed.
       An easier way is to use the "Test Left-Right Differences" button in
       "Tile & wedge parameters" section of the Angle Range dialog.

       The tests mentioned above indicated that in each case where tilt angle
       inversion is needed, the resulting tomogram is upside-down relative to
       its normal orientation when there are no inversions and all angles are
       correct.  If 3D CTF correction is to be applied by computing CTF cor-
       rections at multiple Z levels, the direction of defocus offsets needs
       to be inverted with an upside-down tomogram.  Both Ctf3dsetup and
       Subtomosetup will invert offsets by default if the -invert option is
       set in the command file for CTF correction, but each program has its
       own -invert option to override this default.

   Program operation
       When you start the program, it will first load and analyze all of the
       noise images.  Then it will read in the images within the specified
       initial angular range and compute power spectra from the central tiles.
       This initial computation of tile power spectra is the most time-consum-
       ing step, whereas recomputing a summed power spectrum from the spectra
       of individual tiles is quick.  The program thus stores the power spec-
       trum for each tile in a cache when it is computed.  You will have to
       wait several seconds whenever you change the angular range to include
       views that have not been analyzed before.  However, once all of the
       tiles on all views have been analyzed, the program will respond quickly
       when you change angular ranges or defocus values.

       You may find that the power spectrum curves up or down at high frequen-
       cies, indicating that the noise power spectra do not adequately
       describe the noise in the actual data and that the baseline fitting is
       not working optimally to make the power spectrum be flat at high fre-
       quencies.  This fitting is controlled by an entry set in the Fitting
       dialog, whose value can be initialized with the -baseline option.  To
       do this fitting, the program first identifies points that could define
       a noise floor, primarily using points at local minima in the spectrum,
       but sampling other points if needed at the highest frequencies.  The
       program then fits a concave or convex polynomial of a selected order to
       those points and subtracts it from the power spectrum.  The result is
       to flatten the spectrum, except perhaps past 0.45/pixel. The order can
       be set to 1 to fit a line, 2 to fit a parabola, or 3 or 4 to fit 3rd or
       4th order equations.  (To keep higher order polynomials well-behaved,
       they are constrained to have a monotonically changing first derivative,
       as a parabola does.)  This fitting should be adjusted when the baseline
       deviates from flat by enough to impair the ability to visualize the
       zeroes or fit the spectrum.

       To read a general description of the plots and tool buttons, click the
       handbook icon to access the HTML help page.

       The defocus values found by the program, as well as astigmatism and
       phase shift if those are also found, can be saved in a text file that
       can be used as input to the CTF correction program Ctfphaseflip.

       Ctfplotter uses the PIP package for input (see the manual page for
       pip).  Options can be specified either as command line arguments
       (with the -) or one per line in a command file (without the -).
       Options can be abbreviated to unique letters; the currently valid
       abbreviations for short names are shown in parentheses.

       -input (-inp) OR -InputStack   File name
              Input stack whose defocus will be estimated.  In principle, this
              should be a raw stack, not an aligned stack, because the inter-
              polation used to make an aligned stack attenuates high frequen-
              cies and the noise power spectra would no longer match.  Also,
              the usable CTF signal at high frequencies would be reduced.

       -offset (-of) OR -OffsetToAdd       Floating point
              The program must analyze data values where 0 corresponds to no
              electrons recorded.  Use this option to specify a value to add
              to your input stack that will make values positive and propor-
              tional to recorded electrons.  The value will not be added to
              noise files; they are required to be positive.  The program
              automatically sets this value to 32768 if it recognizes a file
              from FEI data acquisition software with a minimum below 0, or if
              the minimum and mean of a non-FEI file are sufficiently nega-

       -config (-con) OR -ConfigFile       File name
              If a text file is entered, this configure file specifies a set
              of single-image noise files used to estimate the noise floor,
              one file per line.  The files can be specified with either abso-
              lute paths or with paths relative to the location of the config-
              ure file itself.  Alternatively, all noise images can be in one
              stack and the name of the stack provided here.

       -angleFn (-an) OR -AngleFile   File name
              File containing tilt angles for the input stack.  Each line of
              this file is the tilt angle for a view of the input stack.  The
              angles are listed in order starting from view 1.  If no file is
              entered, the angles are assumed to be 0, or the value entered
              with the -single option.  In order to make the interface some-
              what usable, the views are assigned angles at 0.01 degree incre-
              ments, but all spectrum computation uses 0 or the value entered
              with -single.

       -single (-si) OR -SingleTiltAngle   Floating point
              Tilt angle to use when there is no angle file entered.  This
              option may not be entered with -angleFn.

       -invert (-inv) OR -InvertTiltAngles
              Invert the sign of the tilt angles.  See the section on .B
              Inverting Tilt angles above for details.

       -taOffset (-ta) OR -TiltAngleOffset      Floating point
              Amount to add to entered tilt angles when adjusting off-center
              tile spectra for being at different heights before summing them.
              This entry should not duplicate the AngleOffset entry to Tiltal-
              ign if tilt angles from alignment are being used for the Angle-
              File entry here.  An offset does not affect the tilt angles
              shown in the angle dialog or saved to the defocus file.

       -aAngle (-aA) OR -AxisAngle    Floating point
              Specifies how much the tilt axis deviates from vertical (Y
              axis).  This angle is in degrees.  It follows the right hand
              rule and counter-clockwise is positive. This entry is required
              if a tilt angle file is entered or if the -single option is
              entered with a non-zero value.

       -defFn (-defF) OR -DefocusFile      File name
              File to store found defocuses, a required entry.  Each entry in
              the file will consist of the starting and ending view number of
              the range of views being fit to (numbered from 1), the starting
              and ending angle of the tilt angle range being fit to, and the
              defocus value in nanometers (underfocus positive).  The full
              specification for defocus files acceptable to Ctfphaseflip is
              given in a section at the end of that man page.  When Ctfplotter
              writes a new defocus file, it puts a version number (currently
              2) at the end of the first line.  If this file already exists
              when the program starts, it will be read in and the results dis-
              played in a table in the Angle Range and Tile Selection dialog.
              The previous version will become a backup file (with ~ added to
              its name) when new results are saved to this file.
                If you supply an initial defocus file with more than line, be
              sure to use the exact angles from the tilt angle file specified
              with -angleFn; do not round to one decimal place.  Alterna-
              tively, add the number "2" as an extra value at the end of the
              first line of the file; this will prevent the program from
              thinking that the view numbers might be off by one.  If you use
              the -invert option, you must do one of two things: 1) either
              invert all the tilt angles in this file, 2) or start the file
              with a line to indicate that it is a version 3 file in which the
              angles need to be inverted.  That line starts with a sum of
              flags for various options, where 16 is the flag that angles need
              to be inverted; if that is the only flag, then the line would be
              "16 0. 0. 0 3".  See Ctfphaseflip for a description of all

       -pixelSize (-pi) OR -PixelSize      Floating point
              Image pixel size in nanometers.  If this option is not entered,
              the pixel size will be obtained from the header of the input
              image file.

       -crop (-cr) OR -CropToPixelSize     Floating point
              Crop power spectrum to the given pixel size in nanometers.  This
              option spreads out the low-frequency part of the power spectrum
              and throws away the highest frequencies; the new Nyquist fre-
              quency is 2 divided by the entered value.  Cropping may improve
              the fits to closely spaced zeros, but it will average less data
              in each frequency bin and thus make the power spectrum more
              noisy.  The entered pixel size must be larger than the actual
              size for this option to have any effect.

       -fitZeros (-fit) OR -FitZerosForPhase
              When finding phase, try to find and fit to zero positions in the
              spectrum instead of just fitting to the power spectrum.  Fitting
              to zero positions can prevent the first few zeros from dominat-
              ing the fit and may improve the fit to the higher zeros, but it
              may also result in the first zero being noticeably off.

       -volt (-vo) OR -Voltage   Integer
              Microscope voltage in kV, a required entry.

       -cs OR -SphericalAberration    Floating point
              Microscope spherical aberration in millimeters, a required
              entry.  A value of 0 can be entered; it will be made slightly
              larger to prevent division by 0 in the CTF equations.

       -ampContrast (-am) OR -AmplitudeContrast      Floating point
              The fraction of amplitude contrast. For cryo-EM, it should be
              between 0.07 and 0.14.  The default is 0.07.

       -degPhase (-deg) OR -PhaseShiftInDegrees      Floating point
              The expected value for the phase shift imposed by a phase plate,
              in degrees.  Equations relating the CTF and defocus will include
              this phase shift when phase is not solved for.  It can be
              entered with either positive or negative sign; the absolute
              value of the entered value will be subtracted when computing
              phase within the program.

       -phase (-pha) OR -PhasePlateShift   Floating point
              The expected value for the phase shift imposed by a phase plate,
              in radians.  See the -degPhase option, which should be used
              instead.  The two may not both be entered.

       -phRange (-phR) OR -PhaseRangeToSearch   Floating point
              Total range of phase shift to search around the expected shift,
              in degrees.  The default is 120.

       -cuton (-cu) OR -CutOnFrequency     Floating point
              A fixed value for cut-on frequency that attenuates phase at low
              frequency, in reciprocal nanometers.  With a cut-on frequency,
              the phase is modeled as rising exponentially from zero at zero
              frequency to its true value at high frequency.  The ratio of the
              first zero to the cut-on frequency is the rate constant of the
              exponential decay to the true value.  Whenever the cut-on fre-
              quency is non-zero, the phase shift displayed on the screen and
              stored in the defocus file is actually the phase at a fixed fre-
              quency of 0.3/nm rather than the shift at infinity.

       -maxCuton (-ma) OR -MaxCutOnToSearch     Floating point
              Maximum frequency to test when searching for cut-on frequency,
              in reciprocal nanometers.  The default is the frequency of the
              first zero at the expected defocus and phase shift.

       -skip (-sk) OR -ViewsToSkip    List of integer ranges
              List of views to leave out of the analysis; views are numbered
              from 1 and ranges can be entered.  The program will behave as if
              those views do not exist unless the option is set for skipping
              only for analysis of astigmatism or phase shift.  If it is,
              defocus can be found for every view, but astigmatism and phase
              will be solved from adjacent views to ones in the skip list.

       -bidir (-bi) OR -BidirectionalNumViews   Integer
              Number of views in the first half of a bidirectional tilt
              series.  Entering this option will turn on the checkbox "Break
              groups at view" to prevent combining of views for analysis
              across the two halves of the series.  Do not use this option for
              a tilt series taken with the Hagen scheme.  If the option is set
              for skipping and breaking only for analysis of astigmatism or
              phase shift, the program will still combine views for defocus
              fitting across the boundary.

       -onlyAP (-on) OR -SkipOnlyForAstigPhase
              Skip views in the list of ones to skip, or avoid combining views
              for analysis, only for analysis of astigmatism and phase shift.
              With this option set, the program will exclude views in the skip
              list and avoid combining views across the bidirectional boundary
              only when getting a combined spectrum for finding astigmatism
              and phase shift.

       -expDef (-exp) OR -ExpectedDefocus       Floating point
              Expected defocus at the tilt axis in nanometers, with a positive
              value for underfocus.  The frequency of the first zero of the
              CTF curve is first computed based on this expected defocus.  The
              initial fitting range is set based on the location of first and
              second zeros.

       -scan (-sc) OR -ScanDefocusRange    Two floats
              Lower and upper defocus values of range to scan, in nanometers.
              Scanning can be used in place of setting an expected defocus.
              An initial spectrum is computed and analyzed for a series of
              expected defocus values in this range.  The final defocus is
              taken from the fit with the lowest error and most consistency
              with defocus values from fits with nearby expected defocus val-
              ues. If the fitting range is set either in the options or in
              local settings, that range will be used; otherwise the program
              will use a fitting range up to 0.3/pixel with automatic weight-
              ing and truncation (see -truncate).  If spectrum cropping is set
              either in the options or the local settings, that cropping will
              be used; otherwise up to 2-fold cropping will be used for a
              pixel size less than 0.27 nm.  The scan is skipped if there is
              an expected defocus available from local settings and the defo-
              cus file is not empty.

       -tune (-tu) OR -TuneFittingAndSampling
              Adjust fitting range, spectrum cropping, and power spectrum res-
              olution automatically when starting, after a defocus scan if
              any.  This procedure happens after a scan of a defocus range, if
              any, and the spectrum cropping and fitting range are initially
              set just as described for -scan.  With a given spectrum, the
              program first refines the fitting range, shortening it if
              weights fell to zero before the end of the range, or trying
              longer ranges until weights do fall to zero.  Then it assesses
              whether a change in spectrum cropping or in the PS resolution is
              advisable to avoid either CTF aliasing or unnecessarily low SNR.
              A new spectrum is obtained after such a change and these two
              steps are repeated until no more significant changes in cropping
              or resolution are indicated.  After running autotuning via this
              option or interactively, the expected defocus is set from the
              initial focus, "Use current defocus" is turned on, and automatic
              weighting and truncation is turned on.  Also, the graph is
              scaled so that the first zero and peak after it occupy most of
              the range.  The procedure will not run if there are fewer than
              three zeros within the initial fitting range of 0.3/pixel, where
              spectrum cropping will be relaxed to achieve this if possible.
              Also, the procedure is skipped if -autofit and -range options
              are entered, there is a local settings file, and there are val-
              ues in the defocus file, since Ctfplotter is presumably being
              opened after being run with Batchruntomo.

       -assess (-ass) OR -AssessTiltAngleOffset
              Estimate the tilt angle offset on startup, after scanning for
              defocus and and tuning the fitting, if those steps are done.
              The defocus on left and right sides will be measured for up to 5
              sets of views near zero tilt, with at least 3 views in each set,
              to get multiple estimates of the offset.  These will be averaged
              and set as the offset, then the measurement will be iterated up
              to two more times until the change in offset is under 0.5.

       -fpOffset (-fp) OR -FocalPairDefocusOffset    Floating point
              Normally, ctfplotter processes a single stack whose name is
              given by InputStack. It can optionally process a pair of stacks
              with identical tilt angles and mutually aligned projections,
              taken with a constant defocus offset between them. If, for exam-
              ple, InputStack is myData.st, one could place a stack with 6 um
              underfocus in myData_1.st and a stack with 2.175 um underfocus
              in myData_2.st and specify an ExpectedDefocus of 6000 and a
              FocalPairDefocusOffset of -3825.  There is some possibility that
              this processing still works after the major changes in 2018, but
              using it will prevent some of the new features from being avail-

       -range (-ra) OR -AngleRange    Two floats
              When the -autoFit option is not entered, this entry sets the
              starting and ending tilt angles for the initial analysis and is
              a required entry when a tilt angle file is entered.  Views with
              a tilt angle within this range are used to compute the CTF
              curve.  When -autoFit is entered, this entry sets the whole
              extent over which steps will be taken in autofitting.

       -autoFit (-au) OR -AutoFitRangeAndStep   Two floats
              Do initial autofitting over the whole tilt series with the given
              range of angles in each fit and step size between ranges.  A
              value of zero for the step will make it fit to each single image
              separately, regardless of the value for the range.  The range
              entry can also be zero to fit to a single image.  This aut-
              ofitting differs from that invoked through the Angles dialog in
              several respects: 1) Fitting is done at each angle with the cur-
              rent defocus from the previous angle, if any, and the "Use cur-
              rent defocus" radio button is left selected at the end, unless
              the -useDef option is entered.  If phase is being found, it will
              also use current phase.  2) Three fitting iterations will be
              done.  3) The size of the range is determined by the parameter
              entered here, not by the starting and ending angles entered with
              the -range option.  This autofitting will not be done if there
              are already values in the defocus file and if the -range option
              is entered, in order to prevent an annoying message when opening
              Ctfplotter after processing with Batchruntomo.  Otherwise, if
              autofitting is specified and there are existing defocus values,
              the program will ask you to confirm whether to replace them.

       -more (-mo) OR -FitMoreViewsAboveAngle   Two integers
              Higher number of views to fit above a certain angle when aut-
              ofitting, and the angle above which to fit more views.  This
              option can be used if the CTF signal at high tilt degrades more
              than can be handled just by automatic truncation of the fitting
              range.  This entry affects the number of views included in each
              high-tilt view but not the step between views, which will still
              be 1 if that was specified by the -autofit option.  It has no
              effect if the number of views is not higher than the number
              being fit at lower tilt.

       -useDef (-use) OR -UseExpectedDefForAuto
              Use the expected defocus value at each angle instead of the cur-
              rent defocus when doing initial autofitting.  This is the behav-
              ior of the program before IMOD 4.10.18.  At each angle, the
              expected defocus is used the first time and the defocus estimate
              is used for the next two iterations.

       -frequency (-fr) OR -FrequencyRangeToFit      Two floats
              Starting and ending frequencies of range to fit in power spec-
              trum, in reciprocal pixels or in Angstroms, or -1 to use the
              default defocus-based frequency for either value.  The entry
              will be used to set the "Start fit at" and "End fit at" fields
              in the fitting dialog after the pixel size that governs the
              meaning of these frequencies has been adjusted for any cropping
              of the spectrum.  In other words, if you are also entering the
              -crop option and these values are in reciprocal pixels, enter
              the fitting range that works for the cropping specified by that
              option.  Entering the values as Angstroms avoids this issue
              because the same value applies before and after cropping.  If
              you using 0 0fcrop, the starting value will be maintained while
              the ending value will be replaced after successful tuning.  The
              main use for setting a starting value is to start the fit after
              the peak following the first zero, which may be necessary when
              fitting data taken with a phase plate.

       -extra (-ext) OR -ExtraZerosToFit   Floating point
              By default, the ending frequency of the fitting range is set
              midway between to the expected locations of the third and fourth
              zeroes.  With this entry, the range will be extended from the
              second zero (the original program default) by the given multiple
              of the interval between first and second zeros.  For example,
              entries of 1 or 2 will fit approximately to the third or fourth
              zeros, respectively, while the new default corresponds to an
              entry of 1.5.  An entry of more than 0.5 will trigger fitting to
              two exponentials, which is important for fitting multiple peaks
              between zeros.

       -truncate (-tr) OR -AutoTruncateAndWeight     Integer
              This option controls weighting of some frequencies in the fit
              and provides automatic truncation of the fitting range.  With a
              value of 1 or 3, the program does an initial fit, determines the
              local correlation between the power spectrum and the fitted
              curve, assigns reduced weights to frequencies where the correla-
              tion is low, and truncates the fitting range after the correla-
              tion falls to a very low level.  The start of the fitting range
              is also changed to exclude the region before the first zero
              where the curve is more than 1.5 times higher than the peak
              after the first zero, to keep the fit from being influenced by
              this much higher, but essentially irrelevant, signal.  Thus, one
              set can the fitting range at low tilt and use the same nominal
              range at higher tilts where the useful range is less.  With an
              entry of 3, the large-amplitude early parts of the spectrum are
              downweighted by up to a factor of 2 so that they do not dominate
              the error measurement of the fit.  Specifically, regions with an
              amplitude larger than half of the maximum amplitude are weighted
              by half of the maximum amplitude divided by the region's ampli-
              tude.  This weighting is experimental and its value is unknown.

       -vary (-va) OR -VaryExponentInFit
              Vary exponent of CTF function when fitting a CTF-like curve

       -baseline (-ba) OR -BaselineFittingOrder      Integer
              Baseline fitting is used to make the power spectrum be flat at
              high frequencies; this entry initializes the "Baseline fitting
              order" setting in the Fitting dialog.  For details, see above.
              The default is 4 unless the expected position of the first zero
              is 0.25 reciprocal pixels or higher, in which case it is set to

       -find (-fin) OR -FindAstigPhaseCuton     Three integers
              Enter 1 to find astigmatism or 0 not to, 1 to find phase shift
              or 0 not to, and 1 to find cut-on frequency also, or 0 not to.

       -sAstig (-sA) OR -SearchAstigmatism
              Search for astigmatism when fitting.  This option cannot be
              entered with -find.

       -sPhase (-sP) OR -SearchPhaseShift
              Search for phase shift when fitting.  This option cannot be
              entered with -find.

       -sCuton (-sC) OR -SearchCutonFrequency
              Search for cut-on frequency when finding phase shift.  This
              option cannot be entered with -find.

       -minViews (-mi) OR -MinViewsAstigAndPhase     Two integers
              Minimum number of views for finding astigmatism and phase shift;
              the default is 3 for astigmatism and 1 for phase.

       -save (-sa) OR -SaveAndExit
              Save defocus values to file and exit after autofitting.  The
              program will not ask for confirmation before removing existing
              entries in the defocus table.

       -png (-pn) OR -SavePNGsOfGraphs     Integer
              When saving and exiting after autofitting, also save a PNG of
              the graph for rows of the table at the specified interval.
              Enter 1 for all rows.  The saved file names will consist of the
              root name of the input stack, "_ctfp", and either the starting
              and ending angle of the fitting range or just one angle when a
              single view was fit.  With this option, the plotter window and
              its two dialogs must be opened, so a display must be accessible.
              The program will not run with this option in a situation where
              it could not be run interactively.

       -tiff (-tif) OR -SaveTIFFsOfGraphs       Integer
              When saving and exiting after autofitting, this option makes the
              program save a TIFF file of the graph for rows of the table at
              the specified interval.  Otherwise, the option switches the two
              PNG-saving buttons in the angle range dialog to save TIFF files
              instead.  The TIFF files will have ZIP compression and be compa-
              rable in size to PNGs.  The naming will be the same as for PNGs,
              with the extension ".tif" instead of ".png".  The program must
              be able to open dialogs, just as for -png.  This option and -png
              are mutually exclusive.

       -snap (-sn) OR -SnapshotFilename    File name
              Name of file saving graph when fitting a single image.  Either
              -png or -tiff must be entered.  This entry has no effect when
              the input image file has more than one image.  If the filename
              does not end in the appropriate extension for the file type,
              "tif" or "png" (or upper case variations of that), the extension
              will be added.

       -psRes (-ps) OR -PSResolution       Integer
              The number of points over which CTF will be computed.  The fre-
              quency range up to Nyquist is divided into equal intervals
              delineated by these points.  The default is 101.

       -tileSize (-til) OR -TileSize       Integer
              The tile size for computing spectra.  The size is in pixels and
              the tiles are square.  The whole image is divided into tiles
              that overlap by 50% in each direction.  For each view, these
              tiles are assigned to strips that are considered to have con-
              stant defocus.  The default is 256.

       -defTol (-defT) OR -DefocusTol      Integer
              Defocus tolerance in nanometers defining the strip width.  The
              center strips are taken from the central region of a view that
              has defocus difference less than this tolerance. Similarly, the
              off-center strips are defined to include tiles whose defocus
              range is less than this amount.  The default is 50.

       -leftTol (-lef) OR -LeftDefTol      Floating point
              Defocus tolerance in nanometers for strips to the left of the
              center strip.  When non-center strips are included in the aver-
              age, strips to the left of center are included if their defocus
              difference is less than the given value.  The default is 2000.

       -rightTol (-ri) OR -RightDefTol     Floating point
              Defocus tolerance in nanometers for strips to the right of the
              center strip.  When non-center strips are included in the aver-
              age, strips to the right of center are included if their defocus
              difference is less than the given value.  The default is 2000.

       -cache (-ca) OR -MaxCacheSize       Integer
              To speed up computation, ctfplotter uses a cache to hold the
              rotationally averaged power spectra of strips of tiles at 20
              times the final power spectrum resolution (or whatever is
              entered with the -hyper option).  It also caches the FFTs of
              tiles when possible, so that spectra of different resolutions
              can be extracted from them.  This entry in megabytes controls
              the cache size.  The default value is 1000 megabytes if the sys-
              tem physical memory cannot be determined; otherwise the size is
              the minimum of 15 GB, 3/4 of physical memory, and physical mem-
              ory minus 1 GB, for memory up to 30 GB, and half of physical
              memory above 30 GB; but in any case at least 400 MB.

       -hyper (-hy) OR -HyperResolutionFactor   Integer
              Ratio of points in cached spectra to ones in computed curves
              (default 20)

       -sectors (-se) OR -NumberOfSectors       Integer
              Number of sectors for astigmatism analysis.  A power spectrum is
              stored separately for each sector; spectra can then be computed
              fairly quickly for wedges of any size that is a multiple of the
              sector size.  The default is 36, giving 5 degree sectors.

       -wedge (-w) OR -WedgeRangeAndInterval    Two floats
              Initial value for the angular range and interval of wedges for
              astigmatism analysis.  The default is a range of 90 degrees and
              an interval equal to one sector.

       -astigMax (-ast) OR -MaximumAstigmatism       Floating point
              Maximum astigmatism, in microns.  During the fitting to wedge
              spectra, the defocus is allowed to vary from the global value by
              more than half of this amount.  The default is 1.2.

       -hideTest (-hi) OR -HideAngleTestAndOffset
              Hide the button to test left-right differences and the tilt
              angle offset fields by making them appear only when the "Tile &
              wedge parameters" section is opened.

       -colors (-col) OR -ChangeColors
              Switch to colors that are better for some forms of color-blind-
              ness; this option will turn on the checkbox for this change on
              the plotter window.  The power spectrum changes from magenta to
              white, a fitted curve changes from green to magenta, and the
              background is set to black.

       -legacy (-leg) OR -ShowLegacyFitting
              Include options for fitting a polynomial or two curves in the
              fitting dialog, the original methods in the program.

       -dump (-du) OR -DumpWedgeSpectra    List of integer ranges
              List of wedge spectra to print out, numbered from 0, or -1 for
              final spectra from complex fits, or -2 for spectra after aut-
              ofitting.  With a list of wedge spectra, these background-sub-
              tracted spectra will be printed for each iteration of the astig-
              matism fitting.  The frequency as fraction of Nyquist, actual
              spectrum value, and fitted value will be prefixed by a type
              value equal to 100 times the iteration number plus the wedge
              number.  Wedge spectra will be printed only if the option in the
              angle range dialog is set to show them.  If just -1 is entered,
              then final spectra will be printed instead, but only when doing
              complex fitting including astigmatism or phase through the mul-
              tipleSpectraAndFits routine.  When just -2 is entered, the last
              computed spectrum will be printed when a defocus is saved in the
              table during autofitting.  In the latter two cases, the type
              number at the beginning of each line is simply incremented each
              time a spectrum is printed.

       -debug (-deb) OR -DebugLevel   Integer
              Debug level, 0-3. 0: quiet.  1: user messages.  2: cache, tile
              iteration messages.  3: additional fitting messages. The default
              is 1.

       -param (-pa) OR -ParameterFile      Parameter file
              Read parameter entries from this file.

       -help (-he) OR -usage
              Print help output

              Read parameter entries from standard input

       The program can be run at the command line with relatively few entries
       for a single image or stack of untilted images.  With a standalone ver-
       sion built without Qt and untilted images, this command will find defo-
       cus and astigmatism after scanning for defocus in the range from 1 to 5
       microns, and running autotuning:

          ctfplotter -volt 300 -cs 2.700 -sAstig -scan 1000,5000 -tune
       -input test.mrc -defFn test.defocus

       where "-find 1,0,0" can be used instead of "-sAstig". Autofitting and
       exiting is automatic with the no-Qt version, but if you are running a
       full version, these options are also needed:

          -save -autoFit 0,0

       With a single tilted image, you need to add the tilt angle and tilt
       axis rotation angle relative to the Y axis, for example

          -single 30.00 -aAngle 85.3

       To set a fixed phase shift or the initial shift when searching for
       phase, specify it in degrees with the "-degPhase" option.  To search
       for phase as well as astigmatism, add "-find 1,1,0" instead of

       Quanren Xiong
       David Mastronarde
       John Heumann

       ctfphaseflip, newstack

       Prior to IMOD 4.0.29, Ctfplotter had a bug in which the view numbers
       written to the defocus file were numbered from 0, not 1.  When Ctfplot-
       ter reads in an existing defocus file, it will do its best to detect
       this situation and adjust all the view numbers up by 1.  If it does
       detect an inconsistency between view numbers and angular ranges, it
       will issue a warning.

       Email bug reports to mast at colorado dot edu.

IMOD                                4.12.61                      ctfplotter(1)