susan.modules.CtfEstimator¶
- class susan.modules.CtfEstimator[source]¶
Bases:
objectCTF estimation engine.
Wraps the
susan_estimate_ctfbinary. Estimates per-tilt defocus and astigmatism from the tilt-series stacks. Configure the attributes, then callestimate().Attributes
- list_gpus_ids¶
GPU device IDs to use. Default:
[0].- Type:
list of int
- resolution_max¶
Highest resolution, in Ångströms, included in the CTF fit. It sets the target sampling of the linearization (
new_apix = resolution_max/2) and so the outer edge of every spectrum the estimator works on. Rarely needs changing. Default:7.- Type:
float
- defocus_angstroms¶
Defocus search range (min, max) in Ångströms. Bounds the peak search in the linearized power spectrum, where defocus maps linearly onto the bin index. It also frames the ellipse fit report. Default:
range_params(10000, 65000).- Type:
- resolution_thres¶
Correlation threshold that sets
Defocus.max_res. The fitted CTF is correlated against the astigmatism-compensated radial average in sliding windows; the resolution limit is the highest frequency where that correlation stays above this value. Lower values report a more optimistic limit. Default:0.75.- Type:
float
- overfocus¶
If
True, the signal is assumed to be overfocus and the estimated defocus is returned as a negative value; ifFalse, it is assumed to be underfocus and the defocus is returned as a positive value. Default:False.- Type:
bool
- est_phase_shift¶
If
True, the hybrid refinement searches for an additional per-projection phase shift (Volta phase plate use case) and writes it toDefocus.ph_shft. IfFalse, the phase-shift search is skipped andph_shftis forced to0for every projection; defocus refinement still runs normally. Default:True.- Type:
bool
- dechirp_cs¶
If
True, the spherical-aberration contribution is removed from the linearized signal before the peak search. Underr = s**2its phase is exactly quadratic inrwith a coefficient that holds only microscope constants, so it is removed without knowing the defocus. This sharpens the peak and removes a bias that grows quickly asresolution_maxapproaches2*pix_size. Default:True.- Type:
bool
- est_initial_snr¶
If
True, an initial per-projection weight is estimated from the depth of the Thon ring modulation and written as a ninth column ofdefocus.txt, whichsusan.data.Tomograms.set_defocus()loads intoproj_wgt(andupdate_defocusthen copies into the per-particleprj_w). The weight is proportional to the SSNR of the projection and normalised so the best tilt of each stack is1; empty projections get0. IfFalse, the column is written as1for every projection, preserving the previous behaviour of uniform weights. Default:False.- Type:
bool
- verbosity¶
Amount of progress information printed to the console, as in every other module:
0silent,1basic,2full. Default:1.- Type:
int
- log_level¶
Amount of debug data written to out_dir.
0writes onlydefocus.txt;1adds the per-projection SVG reports and the main diagnostic volumes;2adds every intermediate power spectrum. This is whatverboseused to control. Default:0.- Type:
int
Methods
- get_args(out_dir, tomos_file, ptcls_in, box_size)[source]¶
Build the command-line argument string for
susan_estimate_ctf.- Parameters:
out_dir (str) – Output directory where per-tilt CTF results are written.
tomos_file (str) – Path to the
.tomostxttomograms file.ptcls_in (str) – Path to the input
.ptclsrawparticles file (used to select regions of interest).box_size (int) – Patch size in pixels used for CTF estimation.
- Returns:
Space-separated argument string ready to be appended to the
susan_estimate_ctfcommand.- Return type:
str
- estimate(out_dir, tomos_file, ptcls_in, box_size, tomos_out=None)[source]¶
Execute the CTF estimation and return a tomograms object with the newly estimated defocus values applied.
After the
susan_estimate_ctfbinary completes,tomos_fileis re-loaded and each tomogram’s defocus parameters are refreshed from<out_dir>/Tomo<tomo_id:05d>/defocus.txt.- Parameters:
out_dir (str) – Output directory for CTF results.
tomos_file (str) – Path to the input
.tomostxttomograms file.ptcls_in (str) – Path to the input
.ptclsrawparticles file.box_size (int) – Patch size in pixels.
tomos_out (str, optional) – If given, the updated tomograms object is saved to this path (
.tomostxt).
- Returns:
Tomograms loaded from
tomos_filewith the newly estimated defocus values applied for every tomogram.- Return type:
- Raises:
RuntimeError – If the
susan_estimate_ctfbinary returns a non-zero exit code.