# Tutorial: Patch Motion and Patch CTF

## Patch-Based Motion Correction

`Patch Motion` is a very fast, auto-tuning patch-based local motion correction method built on top of CryoSPARC's original `Local Motion Correction` method (a variant of *alignparts*). `Patch Motion` performs the functions of both `Full-frame Motion Correction` and `Local Motion Correction` in one job. Particle locations are **not needed** beforehand. The job outputs non-dose weighted **and** dose-weighted micrographs, ready for CTF Estimation using the new `Patch CTF` job.

**Performance:** Less than 10s/movie (single GPU) for both full-frame and local anisotropic motion correction. Uses less than 10GB of GPU RAM, allowing for large movies to be processed seamlessly on commonly available GPUs. Multi-GPU mode also available. Natively supports parallelized TIFF and MRC.BZ2 decompression.

## Patch-Based CTF Estimation

`Patch CTF` fits a locally-variable CTF landscape to each micrograph and is based on new robust methods for reference-free background and CTF envelope estimation, and *LBFGS* optimization to maximize simulated 2D CTF fit. Particle locations are **not needed**. Together these enable `Patch CTF` to work very well on tilt data, bent/deformed ice, exposures containing very small particles, phase plate data and a range of defocus values.

**Performance:** Outputs per-particle local CTF estimates in \~3s/micrograph (single GPU). Multi-GPU mode also available.

## Workflow Example

### **1. Import**

You will need to import raw movies using the `Import Movies` job, ensuring you specify the `Gain reference path` if available, `Raw pixel size (A)`, `Accelerating voltage (kV)`, `Spherical aberration (mm)` and `Total exposure dose (e/A^2)`. If movies have been previously imported, you can start this workflow directly.

### **2. Patch Motion**

Build a new `Patch Motion Correction` job and drag in the imported movies as Inputs. You can choose to limit processing to a certain number of movies by entering an integer value in `Only process this many movies`. This parameter is useful if you want to understand motion from a subset of movies in a large dataset.

Once `Queued` and running, rigid and patch motion trajectory plots can be viewed in the job streamlog for each exposure (example below). The job will output dose weighted and non-dose weighted micrographs as a single output group. (Check out this [tutorial on Inputs and Outputs in CryoSPARC](https://guide.cryosparc.com/guides-for-v3/job-builder-tutorial) to learn more about working with individual outputs.)

![](https://1916621962-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M7DGv3GkRvGGpbVPCgg%2F-MNe9qMGqxhKztbCGyNm%2F-MNeAqa-kn7-_9FA1DGH%2FPatch_patch_motion.png?alt=media\&token=eba2e03f-370f-4961-b997-e4b19a793f67)

### **3. Patch CTF**

Drag and drop the motion-corrected micrographs into a new `Patch CTF` job.\
Once `Queued` and running, you can view progress and diagnostic plots in the streamlog:

![](https://1916621962-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M7DGv3GkRvGGpbVPCgg%2F-MNe9qMGqxhKztbCGyNm%2F-MNeAtiI24ZmOq-axl-c%2FPatch_3d_patch.png?alt=media\&token=3424a12d-bbb4-4f33-a0b7-a9fc01d18c0f)

![](https://1916621962-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M7DGv3GkRvGGpbVPCgg%2F-MNe9qMGqxhKztbCGyNm%2F-MNeAwx10CSDwhB2mxv7%2FPatch_2d_patch.png?alt=media\&token=9b7487b0-6c07-4206-b7ee-ab4adefc3292)

The 3D surface plot above shows the local defocus estimated across the micrograph. Units of the X Y and Z axes are all Angstroms.

The 1D CTF fit plot shows the fit between the simulated and observed Thon rings in the micrograph (correcting for defocus variations and astigmatism). The light blue line indicates the cross-correlation fit level, and the CTF fit resolution is the resolution at which this value drops below a threshold.

### **4. Picking (If no prior particle locations available or you wish to pick particles again)**

If working with fresh movies for which no particle locations are available, or if you wish to perform picking again, you can proceed to particle picking using the `Manual Picker`, New `Blob-Based Picker` or `Template Picker`. (**NB.** CryoSPARC's new Blob Picker is a fully automatic picker that uses circular and/or elliptical blobs in less than 1s/micrograph on a single GPU.)

### **5. Extraction**

Following picking, particles can be extracted using `Extract from Micrographs`. This job will also extract local CTF values from the Patch CTF model that has been estimated. Note that `Local Motion Correction` **no longer** needs to be performed. If you already have a group of extracted particles in an existing project, and have only re-computed the Patch CTF for corresponding micrographs, you can proceed to re-extract *only* the CTF values per-particle using a `Patch CTF Extraction` job, ensuring you drag the CTF-estimated exposures and particle locations as inputs. This will leave previously extracted or local-motion-corrected particle data intact.
