Stability

Analysis › Measure · version 4 · can run once per region

How still the sample is, from beads: the vibrations of each bead, their

What it does

Says how still the microscope holds the sample, measured on fiducials: bright, still particles on the coverslip such as fluorescent beads, seen in nearly every frame. A bead does not move, so whatever movement its localizations show is either the localization precision – how far a fitted position lies from the true one – or the instrument moving.

It is a diagnostic, with approaches ticked on or off. The first is vibrations: vibration is fast movement of the sample or the optics, from the building, a fan or a pump, which repeats many times a second. It blurs every localization by its amplitude, and no drift correction removes it. The plugin shows a bead's position against time, how much it jitters beyond its precision, and the amplitude spectrum: the movement taken apart into frequencies, where a vibration is a peak, so its source can be found – a 50 Hz peak is the mains, a peak that moves with a pump's speed is the pump.

The second, random scatter, asks how much of the movement is noise that averages away: the difference between one point and the next, divided by √2, is one localization's error when nothing moves between them, so its spread is the precision the experiment achieved – to set beside the precision the fit claims (the CRLB, xy_err_nm). It is the idea of NeNA, asked of a trace known to be one bead rather than of neighbours in consecutive frames, and it works for a bead in a camera acquisition as for a MINFLUX trace. Longer time scales follow from the Allan deviation (Allan 1966): the same difference between means over more and more points, which for pure noise falls as one over the square root of the points averaged, and which drift, slow vibrations or a bead that wanders lift above that line. Long-term drift and the drift between two channels are to follow as approaches of their own. To correct drift from beads, use Fiducials.

It needs the beads' localizations with an id attribute that says which belong to one bead: track_id from Link tracks, by default. It reads the localizations, not merged blinks, those the layer's filter and the drawn ROI keep: draw an ROI around one bead, as in SMAP, or let it take every bead in the view. It needs a short frame time to see fast vibrations: a frame of 1 ms sees up to 500 Hz, one of 20 ms only up to 25 Hz. Per region it runs too: in each ROI of the ROI manager, or as a block over track_id, once per bead.

How it works

1. A regular trace. Each bead's localizations are put in time order, one point per frame; time is the frame times the file's frame time (set in File > File properties for a file that records none). A bead missed in a frame leaves a hole, which is filled by a straight line between its neighbours, because the spectrum needs a point at every time step. How many points were filled is reported. A table with its own clock (time_s, MINFLUX) is put on a regular grid first.

2. Which trace. Each bead on its own, the mean over beads – which keeps what they share and averages their precision down – or a differential trace: one bead minus another, or each minus the mean of the others. What all beads share, the stage's movement and drift, cancels in a difference, and what is left is how the beads move against each other plus their localization noise. A vibration that survives the difference is not the sample moving as a whole.

3. Slow drift removed. Over seconds the sample drifts, by far more than it vibrates. A high-pass filter removes what is slower than high-pass, and the standard deviation (SD) of what is left is the jitter. It is shown beside the precision: their difference, in squares, is the vibration.

One bead (simulated, a frame per ms, 3 nm precision): drift, a 6 nm vibration at 37 Hz and a 2 nm one at 120 Hz on x. Left: the first 300 ms, high-passed, the localizations (light) and their running mean, where the vibration is seen directly. Right: the whole trace as measured (grey) and with the drift removed (blue).

4. The spectrum. The high-passed trace is cut into segments of segment points, half overlapping, and each is taken apart into frequencies by a Fourier transform. Their power is averaged (Welch's method): one transform of the whole trace is as noisy as its mean at every frequency, the average over segments much less, so a small peak stands out. The amplitude is scaled so that a vibration of amplitude A shows a peak of height A, in nm. The spectrum reaches half the sampling rate (the Nyquist frequency): a vibration faster than that is not seen, or folds back as a false lower one.

5. Peaks and the cumulative RMS. The largest peaks above high-pass are listed with their frequency and amplitude. The cumulative RMS (root mean square) adds up the spectrum from the lowest frequency: where it climbs is where the jitter is. At the top it is the SD.

The same bead: the amplitude spectrum (left), its peaks marked (×) with the true vibrations (circles), and the cumulative RMS (right), which climbs at each vibration and over the flat floor of the localization noise to the SD.

Three beads that share the vibrations at 37 and 120 Hz; the third also shakes on its own at 75 Hz. Left: each bead's spectrum shows the shared peaks. Right: each bead minus the mean of the others – the shared peaks cancel, and the 75 Hz one stays, on the bead that moves (and, smaller, on the others, whose reference includes it).

6. The random scatter. Only the measured points of each trace are compared – a filled point lies on the line between its neighbours and would make the noise look smaller than it is – and only points no further apart than gap typical steps, so a difference never spans a long pause. Nothing is high-passed: drift moves two neighbouring points by the same amount and cancels in their difference. The scatter is given as the RMS of the steps, robustly from their median absolute deviation, and as a ratio to the precision. Along the averaging it is split in two: the part that falls as 1/√n – noise that averaging removes, as a multiple of the precision the fit claims – and a floor that does not fall, the noise correlated over longer times. A multiple near 1 and no floor is a bead measured as well as its photons allow.

One bead (simulated, a frame per ms, 3 nm precision) with drift and the 6 nm vibration at 37 Hz on x. Left: the Allan deviation of x and y against the time averaged, with the precision over √n (dashed) – y follows the line of pure noise; x stands above it – a bump at half the vibration's period, dips where the mean is over whole periods – and rises with the drift. Right: the steps of y, diff(y)/√2, whose spread is the precision.

In detail

The grid. Frames give the grid directly: one point per frame, from the first frame any bead of the run is seen in to the last, so every bead shares it. A table with time_s is put on a grid whose step is the 20th percentile of the intervals between its times, so most intervals hold one sample. Samples that land on one grid point are averaged; a grid point between two samples with none of its own is interpolated linearly and counted as filled. Before a bead's first sample and after its last there is no trace; a spectrum is taken over the longest stretch without such a hole. Each trace is centred on its own mean.

Combining. With beads, the mean is , averaged over the beads seen at . The differences are (minus the first bead) or (minus the others). The precisions are combined as independent errors: for the mean of beads of precision , for a difference of two, for one minus the others. A bead's precision is the RMS of its localizations' xy_err_nm (z_err_nm for z).

The high-pass. A second-order Butterworth filter at high-pass, run forwards and backwards, so that it shifts nothing in time (a fourth-order response in all). At 0 Hz only the mean is removed. The SD and everything after it are of the high-passed trace.

The vibration. Localization noise and vibration add in variance, so the vibration's RMS is

with the precision (0 where the precision explains all of the SD; the SD itself when the table has no precision). A sinusoid of amplitude has an RMS of .

The spectrum. Segments of points (segment, or the whole trace when shorter) start every points; each, minus its mean, is multiplied by a Hann window and Fourier transformed, . The power spectral density is

averaged over the segments, in nm²/Hz, with the sampling rate; its sum times the bin width is the variance. The amplitude shown is , so that a sinusoid on a bin reads its amplitude, as SMAP's did. The cumulative RMS at is .

A peak. A local maximum of above high-pass that is at least 4 times the floor around it (the median of from 3 to 20 bins either side), and more than a main lobe (4 bins) from a larger one. A sinusoid whose frequency falls between two bins reads up to 15 % low at its tallest bin, so its amplitude is taken from the power over the five bins around it, above the floor: , and its frequency is their power-weighted mean.

Per region. The values are pooled over the region's traces: the SD and the precision as the root of their mean squares, the spectra averaged in power, and the largest peak of that average. With one trace they are its own. The arrays are the first trace's spectrum and cumulative RMS.

The Allan deviation. Over the measured points of a run, the means over consecutive points, , starting at every point (overlapping), give

averaged over every of every run at least points long, and over the traces of the region (their sums added, so a long trace counts by its differences). At it is . For independent errors of SD it is ; a linear drift adds , which grows with . The time averaged is with the median step between measured points. The curve takes about 24 values of evenly spaced in log from 1 to longest, and the one that is time scale when it is set. The robust value is of the steps , the factor making a median absolute deviation a Gaussian's SD.

The floor. The Allan variance from up to its minimum – past it, drift makes it rise – is fitted by weighted least squares as , each value weighted by the square root of the differences behind it, both terms held at zero or above: is how much of the claimed precision the averaged noise is, the floor in quadrature. The MFX scripts fit the same form, , across laser powers; here the photons grow with the points averaged instead.

A run ends where a step is longer than gap times ; a point filled over a missed frame is not measured and ends one too. This differs from NeNA's estimate in the Localization Precision plugin in two ways: the pairs are known (one bead's consecutive points), so no distribution of neighbour distances is fitted, and it goes beyond one step. On a moving molecule the steps include its motion – for diffusion in each axis' variance – so it is the noise only for a still emitter or a slow one.

Parameters

settingdefaultwhat it does
vibrations
vibrations
onThe jitter of the beads and its spectrum.
random scatter
scatter
offThe noise that averages away, from point-to-point steps, against the precision.
id attribute
id_column
track_idWhich localizations are one bead.

Any integer attribute whose value is the same on one bead's localizations: track_id from Link tracks (link with a generous memory, so a missed frame does not split a bead), bead_true of a simulation, or tid from a MINFLUX file. An id of -1 is no bead.

traces
traces
each beadWhat is analysed; a differential trace cancels what all beads share.

each bead to see whether all beads agree; the mean over beads for the sample's own motion with less noise; a differential trace to tell motion of the whole sample (which cancels) from motion within it, or from the optics of one part of the field.

Choices: each bead; the mean over beads; differential: minus the first bead; differential: minus the others
z
use_z
onZ too, when the table has z_nm.
frame time (more)
frame_time_ms
autoAuto: the file's, else its exposure.

SMAP took the frame time from the file and allowed it to be overwritten; here too. A wrong frame time scales every frequency.

at least 0.001 ms
vibrations
   high-pass
   vibration.highpass_hz
1 HzSlower motion is drift, removed before the SD and the peaks; 0: only the mean.

Above the slowest drift and below the slowest vibration of interest: 1 Hz for a frame time of a few ms. Too high removes real vibrations; 0 leaves drift in the SD, which then says little about vibration.

   segment
   vibration.segment
1024 pointsThe spectrum is averaged over segments this long.

Sets the frequency resolution, the sampling rate over this, and how many segments are averaged. 1024 points at 1 kHz resolves 1 Hz; longer segments resolve close peaks, shorter ones give a smoother spectrum.

at least 16 points
   peaks
   vibration.n_peaks
5How many of the largest peaks are listed. 1 to 20
   trace, zoomed
   vibration.zoom
onThe first points of the trace, with a running mean.
   zoom to
   vibration.zoom_points
1000 pointsHow many points the zoomed trace shows. at least 10 points
   running mean
   vibration.smoothing
10 pointsThe overlay on the zoomed trace. at least 1 points
   whole trace
   vibration.whole
onAll of it, high-passed, with its SD and the precision.
   amplitude spectrum
   vibration.amplitude
onThe amplitude in nm against frequency.
   cumulative RMS
   vibration.cumulative
onThe RMS of everything up to each frequency.
   table of peaks
   vibration.peak_table
onThe largest peaks' frequencies and amplitudes.
random scatter
   time scale
   random.time_scale_ms
autoAlso the deviation of means over this time; auto: one point only.

The time over which a measurement is averaged in practice – a localization's dwell, or the length of a MINFLUX trace – to read off the deviation there (x_scatter_at_nm) beside the precision over √n that pure noise would give.

at least 0.001 ms
   gap
   random.max_gap
3 stepsPoints further apart than this many typical steps are not compared.

For frames, 3 bridges a missed frame or two and stops at longer gaps. On MINFLUX's irregular clock the steps vary; raise it when the runs come out short, lower it when a trace has long pauses in which the bead could move.

at least 1 steps
   longest
   random.longest_points
1000 pointsThe curve averages up to this many points. at least 2 points
   Allan deviation
   random.allan
onThe deviation against the time averaged, with the precision's 1/sqrt(n).
   steps
   random.steps
onHistogram of diff(x)/sqrt(2) beside the precision's Gaussian.

Output

Per axis – x, y, and z when the table has it – a line of the text: the SD above high-pass, the precision, the vibration's RMS and the largest peak. The figures, each ticked on or off: the zoomed trace (the localizations, light, and their running mean), the whole high-passed trace with its SD and precision in the title, the amplitude spectrum with its largest peak marked and high-pass dotted, the cumulative RMS with the precision dashed, and a table of the peaks, also in the text. Up to 8 traces are drawn over each other.

With each bead, run on the view, the same numbers for every bead are also kept as a region table of the id attribute ("per track_id: Stability"): per axis x_sd_nm, x_precision_nm, x_vibration_nm, x_peak_hz and x_peak_nm (and y, z), with n_points. Summarize/Histograms then compares the beads, and the region filter can leave out one that shakes more than the others. Not when an ROI is drawn, since the table stands for every bead the layer shows.

A stable instrument shows an SD at the precision, a vibration RMS of a nanometre or less, and a flat spectrum. A vibration of several nm is worth finding: it blurs every localization. If more than a fifth of the points are filled gaps the plugin warns: above the rate of the gaps the spectrum is interpolation, not data.

Per region the values are x_sd_nm, x_precision_nm, x_vibration_nm, x_peak_hz and x_peak_nm (and y, z), with n_traces, n_points and n_filled; the arrays frequency_hz, x_amplitude_nm and x_cumulative_rms_nm, which Curves summarises over beads.

With random scatter ticked, per axis a line: the scatter at one point, its robust value, the precision and their ratio, and the deviation at time scale when it is set. A ratio near 1 means the fit's precision is what was achieved; above 1, there is noise the fit does not know about – vibration faster than a frame, a PSF model that is off, or the emitter moving. The figures: the Allan deviation against the time averaged with the precision over √n dashed and the fit of the floor dash-dotted, and the histogram of the steps with the Gaussians of the precision and of the scatter (heavy tails are jumps, which the robust value ignores). The values are x_scatter_nm, x_scatter_robust_nm, x_scatter_ratio, x_scatter_eta, x_noise_floor_nm and x_scatter_at_nm, with x_precision_nm; the arrays allan_tau_s and x_allan_nm. With each bead the per-bead table gains x_scatter_nm and x_scatter_ratio.

Differences from SMAP

Ported from SMAP's Analyze/measure/Vibrations (Ries 2020).

References