Patch Motion Correction query

Hi,

How are the number of patches (knots in X/Y) and the rolling window of frames (knots in Z) determined during Patch Motion?

In a recent dataset with ~1.5e-/Å2 per frame (& 102 frames), knots in Z is automatically set to 15, which seems rather too high, so I am trying to figure out how the algorithm arrives at this number. I also notice that this number changes with the nominal dose - if I override and set the nominal dose to 1e-/Å2/frame, the estimated “knots Z” reduces to 11, which is a bit counterintuitive, because I would expect it to need more frames for a good fit at lower dose, not less…

Also, how exactly does the algorithm work with regards to knots in Z? My assumption is that for each patch, it is aligning averages of the specified number of frames in a rolling window, and then interpolating the shifts for the individual frames - is this more or less accurate, or is there more to it than that? Is the same Z value used for the preceding rigid fit as for the patch based fits?

Cheers
Oli

EDIT:

Reducing Z from the auto-estimated value seems to give more sensible, smoother & less noisy patch trajectories:

EDIT2: Manually overriding Z did not improve resolution, although manually fiddling with the dose weighting did, so I am still curious about the details of this process.

1 Like

Hi Oli,

Great questions. I think there’s a slight misunderstanding here — knots are not the number of patches, but rather a control on the smoothness of patch movement in each dimension. You can see in the image below that as we decrease the number of knots the movement is smoother, to the limit where with 1 knot we don’t let the patches move relative to each other at all. However, the number of patches doesn’t change in any case — these are set to a specific physical area in Å and cannot be set by the user.

We fit a spline function to the movement in each dimension to model patch movement. If you consider that splines are a series of third-order polynomials “tied together” to model the data, the knots are the joins between those polynomials. Here are some examples where I’ve highlighted the position of knot(s) in the fit:

So when the number of knots are manually overridden to a lower number, you’ll get a smoother curve not due to changing the averaging window (spatially in X/Y or temporally in Z) but by reducing the degrees of freedom that patch motion has to fit the data.

The auto-tuning of the spline knot count works as follows, where K_z, K_x, K_y are the knot count in x/y (frame pixels) or z (movie frame index)

Each of these are rounded to an integer value and can’t be less than 1.

    K_z = (dose per frame per sq A) * (number of frames) / (calibrated constant) 
    K_x = (pixel size) * (frame size x) / (calibrated constant)
    K_y = (pixel size) * (frame size y) / (calibrated constant)

The calibrated constants all have values in physical units (e.g. Angstroms for x/y) and are tuned to values that we’ve found work for the usual deformation per unit dose and/or distance. Hopefully that gives a sense of why and how the spline knot count changes with dose and other micrograph properties.

4 Likes

That is very helpful, thanks Harris!!

So in that case, if I am trying to compare different dose values in Patch Motion, I should probably fix K_z to the value estimated for the nominal dose (so I am not changing two things at once - otherwise if I lower the estimated dose, I will both be changing the degree of filtering per frame, and the “smoothness” of the fit in Z)’

This would be great info to add to the guide I think - the description of patch motion in there at the moment is a bit sparse, this really helps to understand what is going on under the hood.

1 Like