Localize · version 11 · has a preview
Detect and fit with an experimental spline PSF from a bead calibration: adds z.
This is the 3D fitter. It does what Gaussian 2D does – reads the camera frames, finds the single fluorophores that are on, and fits each one to get its position far below the size of a pixel – but the model it fits is not a Gaussian. It is the measured image of a point source on this microscope, at every height, taken from a bead calibration (also called a spline calibration, cspline or experimental PSF model) and interpolated with cubic splines – the method of Li et al. 2018. Because that image changes with the emitter's distance from the focal plane, the fit also tells how far it was: every localization gets a z_nm and a z_err_nm besides x, y and the photons.
The shape has to change with z in a way that tells above from below. The usual way is a weak cylindrical lens in the detection path (astigmatism): the spot is then stretched along one axis above focus, along the other below, and round in between. Any other engineered PSF (point spread function: the image one molecule makes on the camera) works as well, as long as the calibration was measured with it – and so do the aberrations of an ordinary objective, which a Gaussian would get wrong and a measured model does not.
What it needs:
_3dcal.mat works as well, and can be kept as an .h5 by loading and saving it: save_spline_calibration("beads.h5", load_spline_calibration("beads_3dcal.mat")), both from smappy.io.calibration (SMAP's averaged bead stack is not carried over; the spline is, turned round if it was mirrored). Take the beads with the same objective, lens, filters, camera and camera settings as the data; a calibration from another day is fine as long as none of these changed. Left empty, calibration is auto: the calibration made for this microscope in the state the data were taken in is found and used (Parameters).For 2D data without a calibration, use Gaussian 2D; for two channels on one camera, Spline 3D 2C.
The detection, the fit boxes and the fit itself are those of Gaussian 2D, which explains them step by step: the counts are converted to photons, candidates are found in a difference-of-Gaussians filtered image, a square fit box is cut around each, and the fit box is fitted by maximum likelihood with Levenberg-Marquardt. Fits of one frame that end less than a pixel apart are one molecule's, and only the one nearest its candidate is kept: far from focus an astigmatic spot is a streak whose two ends are both found as peaks, and without this a molecule there was fitted twice (on the simulated movies of the DECODE benchmark, 12 – 20 % of isolated molecules 300 – 700 nm from focus; the share of fits that are real molecules rose from 0.83 to 0.99, and as many molecules were found). What is different here is the model, and where it comes from.
1. The calibration. Beads are small and bright, so a bead's image is the PSF (the point spread function: what the microscope makes of a single point of light). A bead calibration steps the objective through focus over a few beads, finds them, aligns their stacks to each other in x, y and z below a pixel, averages them, and smooths the average a little along z. The result is the PSF sampled on a grid: one image every dz nanometres (the step of the bead stack) over a range of about a micrometre or more.
2. A smooth model between the samples. An emitter is almost never exactly on the grid. To get the PSF anywhere – a fraction of a pixel off centre, and between two planes – the grid is interpolated with a cubic spline in x, y and z: within each small box of the grid, a smooth polynomial that passes through the measured values and joins its neighbours without a kink. That makes the model, and how it changes with x, y and z, available everywhere, which is what a fit needs.

The calibration. Top: the spline model at five heights, as the fitter sees it in a 13-pixel fit box. Bottom: the PSF the simulated beads were drawn with. The spot is stretched along x below focus and along y above it; the model has learnt that from nine beads.
3. The fit. Each fit box is compared with the model: the calibrated PSF at position and height
, scaled to
photons, on a flat background
per pixel. The five parameters
that make the observed photons most probable are the result. z is found the same way x and y are: the shape of the spot is what depends on it, and the fit changes z until the model's shape matches the spot's.
The fit starts at the centre of mass of the fit box, at the background of its border pixels, and at the start z – the focal plane of the calibration unless set otherwise. From there Levenberg-Marquardt walks to the best z; with an astigmatic PSF the shape changes monotonically over the range, so there is one best z to find.
4. Precision. As for the Gaussian fitter, the Cramér-Rao lower bound (CRLB) from the model says how precisely each parameter can be known from the photons there are, and it is written as x_err_nm, y_err_nm and z_err_nm. It depends on z: where the spot is small it is sharp and precise; far from focus it spreads over more pixels and more background, and the precision falls. z is typically two to four times less precise than x and y.

The fit gives z back. Spots simulated at known heights (2000 photons, 10 background photons per pixel) from the true PSF, not from the spline, and fitted with the calibration of the figure above. Left: fitted against true z, with the line of perfect agreement. Right: the scatter of each coordinate about the truth (dots) against the precision the fitter reported (lines) – x and y trade places above and below focus, and z is best near focus.
5. The table. Positions are converted to nanometres with the pixel size (which the file records, so a position in camera pixels is x_nm divided by it; no pixel attributes are kept), fits that failed or whose z is not a number are dropped, and the table is saved as <acquisition>_locs.hdf5.
6. The focus in the sample. A bead calibration is the PSF of a bead on the coverslip. A molecule some way into a watery sample looks different. The index mismatch (also called refractive-index mismatch: oil and water bend light differently) adds a spherical aberration that grows with the depth. And only molecules within about a wavelength of the coverslip send the extra light beyond the critical angle (SAF, supercritical-angle fluorescence) into the objective. A calibration made with the pupil (Zernike) method keeps its model inside the spline's file. From it, the fit draws a new spline for the sample: the beads' aberrations, with molecules at every height above the coverslip and the objective's focus moved focus depth into the sample. z is then the height above the coverslip, not the objective's movement.
focus says how the position is known:
auto and in situ are found once for a file and its settings: Preview finds them and draws the heights they came from, with the coverslip at 0 and the plane in focus marked, and the Run after it uses what Preview found. An in situ result is also kept on disk, so it is not learnt again in the next session. A bead-average calibration has no model: there the setting is not shown, and auto fits as calibrated.
Without a bead calibration: the microscope's pupil. PSF calibration's Add to microscope... keeps the objective's pupil with the microscope, for each state of its 3D lens and each colour; smappy comes with one for M2 and for M5. calibration's menu offers it where the file's microscope keeps one for the file's state and camera. The pupil is drawn into a spline with the file's emission and pixel, once, and kept as a file in smappy's settings folder, which the fit and its history name. It has a model, so focus draws it in the sample as it draws a pupil calibration. It is the PSF of beads of another day: the blur, a re-aligned 3D lens and the coverslip of the data are not in it, so a bead calibration of the data's own day is better where there is one. auto never takes it.
After the fit. Once the last frame is fitted, the steps of the folded section *after the fit* run over the whole table before it is saved: a drift correction (none by default), which corrects z as well unless its correct z says otherwise, and a chain of your own. Run these now, at the foot of the section, runs them on the open localizations later, without fitting again.
The spline. The calibration is a grid of boxes (voxels): one pixel wide laterally,
deep. Within each box the PSF is a tricubic polynomial of the fractional offsets
of the point from the box's corner, in x, y and z,
so 64 coefficients per box, stored as an array of shape in the order
. The bead average computes them by not-a-knot cubic interpolation of the averaged bead stack along each axis in turn, after normalising it so that the brightest plane sums to 1 over the calibration ROI;
is then the photons in that plane. A SMAP file brings its own coefficients.
The model. For pixel of a fit box centred on the candidate,
where the fit box sits in the middle of the (larger) calibration grid. Its derivatives are those of the polynomial,
and the same for y; z is fitted in units of grid planes and converted at the end. The likelihood, the Levenberg-Marquardt steps (with the expected information as curvature) and the CRLB are exactly those of the Gaussian fitter, with these five derivatives: the Fisher information
at the fitted , and
. Because the model is the measured PSF, the CRLB includes everything the PSF does with z – which is what makes the z precision curve of the figure above come out of the fit rather than from a formula. A calibration made from few, noisy beads has bumps of its own that the fitter takes for information, and then reports a z precision that is too good; smoothing the calibration along z (the bead average's smoothing z) is what prevents it.
z. The spline's z index is converted with the calibration's plane spacing
and its focal plane
(
z0 in the file),
The minus sign is the convention SMAP uses: the calibration records where the objective was, and a bead is below the focus by as much as the objective was raised. z is therefore relative to the calibration's focal plane, not to the coverslip, and in the nanometres the objective moved – no correction for the different refractive index of the sample is made (for an oil objective imaging into water, real distances are shorter, by a factor of roughly 0.7 to 0.8; Math Parser can apply one).
The start and the limits. x and y start at the fit box's centre of mass, the background at the mean of the fit box's border pixels, the photons at the brightest pixel above background divided by the model's central value, times 4, and z at start z (0 nm by default, the plane ). A z step is capped at a third of the calibration's depth (at least two planes) at first, and the cap is halved whenever the step reverses. z is held inside the calibration: a fit that tries to leave it stops at an end. During the fit
and
; x and y are not held.
Mirroring. SMAP flips bead images in x before it builds the spline when they were read out through the EM register of an EMCCD, which mirrors them, and flips data from that register the same way when it loads them. Here the data are never flipped, so such a calibration is turned round once, when it is loaded, and is from then on a calibration like any other. The spline is reflected about the middle of its grid, along x: the boxes are taken in reverse order, and since each is now crossed the other way (
), its polynomial is rewritten in powers of the new offset,
with the z and y powers untouched. An odd gains one box, a copy of the new last one, which keeps the fit box where the fitter centres it in the grid. Fitting the data as they are with the turned spline gives the positions, z and photons that fitting the flipped data with the original gives, to within the rounding of single precision (checked on simulated splines). Whether SMAP flipped the beads is read from its own record of it,
EMon, not from its setting emmirror, whose "no mirror" (2) was once taken here for a flip; a file with no EMon is taken as flipped if emmirror is 1 or 3. Calibrations from the bead average are never mirrored.
EM gain. A calibration records whether the beads were taken with EM gain – the electron multiplication of an EMCCD camera – the PSF calibration reads it from the bead files' metadata, a SMAP calibration carries it – and if the data's camera says otherwise, the spline is mirrored in x to match: the EM register of many EMCCDs reads out mirrored, so a model from beads on the other port (the conventional amplifier's, say, as the DECODE example beads were taken) is mirrored against the data. The turn is the one above, exact, done when the model is made; the DECODE fitter flips its frames instead, for the same reason, and so does focus on auto: it fits the beads' spline and its drawings, all in the beads' orientation, so the spots it reads are mirrored into it. The fit says so in a warning, which stays in the plugin's output and its status, and goes into the run's text, so the history and the fitted file (metadata["warnings"]) keep it. Where either side does not record its EM gain, nothing is turned. A field-dependent calibration is not turned – mirroring its grid of splines needs the chip's width – and the fit only warns. The EM gain's excess noise is handled as in the Gaussian fitter. So is the camera's read noise: its variance is added to data and model, one electron without EM gain by default (read noise), which also keeps a pixel whose spline model nears zero from dominating a fit at low background (see Gaussian 2D).
The focus in the sample. The pupil model is drawn (smappy.calibrate.depth) for an emitter at height with the objective moved
(focus depth) from the coverslip: the stage defocus
, and the emitter's depth
in the sample. The sample's index is the one the calibration was learnt with (recorded with the spline as
sample_index) unless sample index chooses another; index matched is the model's immersion index. The bead's size is left out and the learnt blur kept. The planes are the calibration's apart, as many about the plane in focus as the bead spline has about its own. They reach at most 300 nm below the coverslip, into the glass, where an emitter is drawn as one on the coverslip with the focus that much farther away. Nothing is there, but with a focus slightly wrong the lowest molecules are fitted there instead of being parked on the spline's edge. Fits below 0 are filtered afterwards, like any other.
auto reads 10 blocks of 50 frames spread over the fitted range and cuts the fit boxes as the fit does. It keeps the 4000 with the most photons above the fit box's edge (not the brightest peak, which would favour molecules in focus), and fits them with 30 iterations. It takes the lower edge of their heights by maximum likelihood, as in situ learning does: on the lowest 30 % of the heights, a flat density above the edge, optionally a pile-up on it, each height blurred by at most 3 times its CRLB. The first fit is on the bead spline, whose z is the objective's movement, and its edge gives the first focus. Then come at most 4 passes on drawn splines, each moving the focus by the edge's offset times the focus per height ( to begin with, then measured between passes). They stop once the edge is within 15 nm of 0, and the pass with the edge nearest 0 is kept. The position found is written into the settings as typed, so the history and the file name it. Without molecules on the coverslip the edge belongs to the lowest molecules, above it, and the position comes out short by their distance: on simulated heights starting 250 nm above the coverslip, by about 200 nm. The run says so in its log. So little depends on the depth there that it rarely matters.
in situ runs the in situ calibration (insitu_run.run_insitu) with hold set to every aberration. The bead model's whole pupil, phase and magnitude, is held – a minimal model's γ, a Zernike model's magnitude modes – and a phase mode up to its order that it lacks is held at 0. The beads' SAF damping is not: it is the beads', and a molecule's light beyond the critical angle follows its own depth. Learnt are the focus, the blur and each molecule; with nothing of the pupil to learn there is no twin test. It starts at the position auto finds, from 1000 molecules, in at most 2 rounds. The spline is the learnt model drawn as above, at the learnt focus. It is kept in the configuration directory's sample_depth folder (not beside the data, where calibration on auto would take it for a bead calibration), and the run fits with it as as calibrated, so the history names the file.
A PSF that varies over the field. A calibration learnt with field dependence in the PSF calibration holds one spline per point of a grid over the chip, as many as its learnt astigmatism and coma need: one when the field is flat. Each spot is then fitted with the four splines around its place on the chip, blended in proportion to how near each is (bilinearly). A spline is linear in its coefficients, so the blend is exactly the spline of the blended PSFs. A spot outside the grid takes its edge's splines. With four splines a fit takes about 1.7 times as long as with one. A focus in the sample draws every spline of the grid at that depth. The study behind it, with the bias it removes, is in the repository's docs/uipsf/field-dependence.md.
Compared with the paper. The method is that of Li et al. 2018; what the code does differently (the first two concern the bead average; a SMAP calibration brings its own coefficients):
| setting | default | what it does |
|---|---|---|
| source – Where the frames come from. | ||
filesource.path | – | Any file of the acquisition: a Micro-Manager TIFF series, an NDTiff directory, one image out of a folder written one file per frame, or a simulation (*.sim.yaml, File > Simulate). |
first frame (more)source.start | 0 | Frames before this one are skipped. |
last frame (more)source.stop | auto | Auto: to the end. at least 1 |
livesource.live | off | The file is still being written: fit what is there and keep watching for new frames. |
stop after (more)source.live_timeout | 30 s idle | Live: give up after this long without a new frame. at least 1 s idle |
frames per block (more)source.chunk | 200 | Frames read and detected at once; only memory and speed depend on it. at least 1 |
microscope – The microscope and its camera: ADU -> photons and pixel -> nm. Empty fields come from the file, the camera database and the microscope database; shown as one line and a window (gui.microscope_form), the values locked until unlocked. | ||
microscopecamera.microscope | auto | Auto: recognised from the file's metadata, else the last one used. |
cameracamera.camera | auto | Auto: identified from the file's metadata, else the microscope's. |
conversioncamera.conversion | auto | Photoelectrons per count; auto: from the file or the camera database. |
offsetcamera.offset | auto | The count of a pixel that saw no light. |
EM gain oncamera.em_on | auto | An EMCCD with its electron multiplication on: the counts are divided by the gain, and the noise is doubled. Also compared with the calibration's EM setting; see EM gain above. |
EM gaincamera.emgain | auto | The EM gain the camera was set to. |
pixel sizecamera.pixelsize_um | auto | The pixel's size in the sample, after the magnification. |
pixel size ycamera.pixelsize_y_um | auto | Auto: square pixels, the same as in x, or the microscope's. |
read noisecamera.read_noise_e | auto | Rms per pixel; auto: the camera's, else 1 (an sCMOS). |
channels – How the camera chip is read: whole, or as a split camera's two channels, and how the split lies – the microscope's arrangement, or chosen for a microscope without an entry (calibrate.dual.resolve_arrangement); never detected. | ||
readchannels.split | whole chip | Two channels: a split camera, each channel detected and fitted on its own; whether the dichroic was in, no file says. two channels is for a split camera: the frame is cut into its two channels by layout and split position, a mirror undone, and each channel is detected and fitted on its own – a dim channel then has a threshold of its own instead of the bright one's. Nothing pairs the two, and nothing maps one onto the other: each localization is on the chip where its channel saw it, with |
layoutchannels.layout | the microscope's | How the chip is split: the microscope's entry, or chosen by hand with the main channel and the split. On microscope, the entry of the microscope the file was taken on gives it (Microscope manager) – the layout, the main channel and where the channels lie, its arms' regions or the frame's halves – and the part says it in one line; a file no entry recognises asks for it to be chosen. main channel is shown either way: on the microscope's it is the entry's, its transmitted arm, and choosing the other half swaps the two dyes while the entry's regions and mirror stay. Choose a layout by hand and split position appears too. Read only on two channels. Choices: the microscope's; right-left; right-left mirrored; up-down; up-down mirrored |
main channelchannels.main_channel | the microscope's | The channel the other is registered onto: the microscope's (its transmitted arm), or either half, to swap them. Choices: the microscope's; left; right; upper; lower |
split position (more)channels.split_position | auto | The first pixel of the second channel, on the chip, for a layout chosen by hand; empty: the middle of the frame. at least 1 px |
| detection – Finding candidates in the filtered image. | ||
filterdetection.filter | difference of Gaussians | What the frame is smoothed with before maxima are looked for; the difference of Gaussians also removes a smooth background. Choices: difference of Gaussians; Gaussian |
filter sigmadetection.sigma | 1.2 px | The width of the smoothing: about the PSF's. at least 0.1 px |
cutoffdetection.cutoff_mode | dynamic (x noise) | Dynamic: set per frame from the noise of the filtered image; absolute: a fixed value. Choices: dynamic (x noise); absolute (photons) |
cutoff valuedetection.cutoff | 1.7 | Lower finds dimmer molecules, and more noise. |
| fit region – Where in the frame to fit: shapes drawn on the preview's frame. | ||
drawnregion.shapes | Drawn on the Preview's frame: candidates outside the include shapes, or inside an exclude shape, are not fitted. To fit only part of the camera frame – one cell of several, or everything but a bright bead or a dirty corner – press Preview and draw on the frame it shows: the buttons above the figure draw a rectangle or a polygon to fit in (green) or to leave out (dashed red); undo and clear take shapes away, and edit takes a drawn shape back: click it, then drag its handles or its middle (a polygon by its corners; shift-drag moves it whole). With shapes to fit in, only the candidates inside one of them are fitted; a candidate inside a shape left out never is. The frame is still filtered whole, so a dynamic cutoff is set as without a region. The shapes are in the frame's pixels and kept with the settings – in the workspace, a chain or a batch they apply to every file. Read as two channels, a shape marks a part of the sample, not of the camera: its part on either channel is copied onto the other, where the channels' layout puts the same part of the sample (dotted on the Preview). A cell outlined on one half is fitted in both, and a strip left out along the boundary between the channels – where the filter's edge and scattered light give dim, false localizations – crops both channels' inner edges. Before version 5 a shape acted only on the half it was drawn on, so a fit in rectangle on one half left the other unfitted. A region that leaves a channel nothing to fit is said under the form, in the Preview and at the run. | |
use the regionregion.use | on | Off fits the whole frame and keeps the shapes. |
model – An experimental PSF from a bead calibration (.h5, or SMAP's _3dcal.mat): adds z. | ||
calibrationmodel.calibration | – | Empty: auto, the calibration listed for this file's microscope and state (the menu: all found, and the microscope's pupil); a bead calibration .h5 or a SMAP _3dcal.mat; a fitted .h5, for the calibration it was fitted with; or 'microscope', its kept pupil. A pupil (Zernike) calibration adds focus: the PSF drawn for the focus in the sample. Made once per microscope configuration, with the objective, filters and camera settings of the data. Empty, it is auto, and the field says in grey which calibration that is. Every calibration PSF calibration saves is kept in a list, as a link to its file, with the microscope its beads were taken on: the entry and its setup version, the state of each device the PSF depends on (the 3D lens, the filters), the camera and EM gain on or off. auto takes one that matches the data on all of these – the one taken nearest in time to the data – and calibrations saved in the data's folder or the folder above it are found too, without being listed. A calibration that matches none of this is never taken on auto: one of another lens state fits, badly, without an error. ▾ beside the field, or a right click in it, lists every calibration found, those that do not match marked, and auto. A fitted The menu's last line, M2's pupil, 3DA: on · far red, is the microscope's pupil (above, "Without a bead calibration"): the field then reads |
focusmodel.focus | auto | Where the focus is in the sample, for the PSF drawn there from the pupil model, z then the height above the coverslip: auto, from the lowest localizations; in situ, learnt from the molecules with the beads' aberrations; typed; or as calibrated, the beads' PSF at the coverslip. auto is right for most data, and costs a second or two before the fit. in situ for a measurement where the depth matters more than a few minutes: deep in the sample, or TIRF and other work on the coverslip where the SAF counts. as calibrated for molecules near the coverslip with the focus there too, or to compare with an older fit. Drawing needs torch ( |
focus depthmodel.focus_nm | 0 nm | How far into the sample the objective was moved from the coverslip; typed here, else found at Preview or Run. How far the objective was moved up from the coverslip, as its focus drive reads, not the true distance in the sample. An error of a few hundred nanometres changes little. On auto and in situ it shows what was found for this file, once a Preview or a Run has found it. |
sample indexmodel.medium | auto | What the sample is in: water 1.33 (beads, live cells), blinking buffer 1.345 (fixed cells in a dSTORM buffer), index matched (the immersion's), or typed; auto: the index the calibration was learnt with. What the sample is in, which can differ from what the calibration's emitters were in. auto draws the PSF at the index the calibration was learnt with (auto (as calibrated), the number beside it showing it): right for a calibration made in the same medium as the data, such as molecules on glass in the same buffer. For beads calibrated in water and cells imaged in a dSTORM buffer, choose blinking buffer (1.345: a GLOX buffer with about 10 % w/v glucose; fixed cells in PBS are about 1.340); for a mounting medium matched to the oil, index matched, and the depth then hardly matters. water for live cells in medium. When the PSF is drawn for another index than the calibration's, a line under the form says so: expected for beads in water and a sample in buffer, worth a second look for a calibration made in the data's own medium. A spline from a bead average has no model and no index to draw at. Choices: auto; water; blinking buffer; index matched; typed |
nmodel.sample_index | auto | The sample's refractive index the choice stands for; type over it for another. In grey, the index the choice stands for; typing over it makes the choice typed. Around 1.45 for glycerol-based mounting media. 1 to 2 |
start z (more)model.z_start_nm | 0 nm | Where each fit starts in z, relative to the calibration's focal plane. Worth moving only when most of the data is far from focus on one side, where a start at the focal plane has the farthest to go. With a focus in the sample it is relative to the plane in focus, wherever that lies above the coverslip. |
| fit – Everything about the fit that is not the camera or the PSF model. | ||
fit boxfit.roisize | 13 px | The square cut around each candidate and fitted. At least 2 pixels smaller than the calibration laterally (the Bead calibration's bead box, 27 by default), or the fit refuses to start: beyond the grid the model would only repeat its edge. Large enough for the widest, most defocused spot; the default 13 holds the spots of the figures above, over |
iterations (more)fit.iterations | 50 | The most steps a fit may take. Defocused spots can take more steps than in 2D; 50 is usually plenty, and the |
max fit distance (more)fit.max_fit_distance | auto | Reject fits that ran off; auto: keep all. |
per-pixel noise (more)fit.per_pixel_noise | off | An sCMOS's offset and read noise pixel by pixel, from the camera's noise map. For an sCMOS: each pixel's own offset and read noise, from the noise map of the file's camera and readout mode, which Camera noise calibration makes from a dark movie. It helps most at low backgrounds and near hot pixels, costs about 1 % of the fitting time, and the precisions then account for each pixel's noise. Without a map for the readout mode, or with frames outside the map, the fit is refused and the form says why. |
| output | ||
save HDF5output.save | on | Write the table to a file as it is fitted. |
fileoutput.path | – | Filled from the source: <acquisition>_locs.hdf5 next to the folder the images are in. |
raw frames (more)output.raw_frames | 50 | Camera frames kept with the table, in photons, after their average; 0: none. 50 is enough to see what the camera saw at the start, the end and a few points between. Each kept frame costs its size in the file: for a 256 x 256 camera ROI about a quarter of a megabyte, for a full 2048 x 2048 sCMOS chip 16 MB, so fifty of those are 800 MB – set fewer there. |
show image tags (more)output.show_tags | PIZStage | Image tags drawn while the fit runs and when it is done, names or parts of names; empty: none (Analysis/Process/Image Tags).
|
| after the fit – The steps in the order they run; each step's settings follow its switch. | ||
astigmatic zfinish.astigmatic_z | off | Z from the widths of the elliptical Gaussian, before any drift correction so that it can correct z (Analysis/After fit/Astigmatic z). |
| z calibration | ||
calibrationfinish.astigmatic.calibration | from a file | A file from the PSF calibration window (elliptical Gaussian), or the curves typed. Choices: from a file; typed |
filefinish.astigmatic.path | – | An astigmatic z calibration (.h5). |
| curves – One curve per axis, s(z) = s0 sqrt(1 + u^2 + A u^3 + B u^4), u = (z - focus) / depth. | ||
width xfinish.astigmatic.typed.sigma_x_nm | 130 nm | s0: the narrowest the spot gets in x. at least 1 nm |
focus xfinish.astigmatic.typed.focus_x_nm | 300 nm | The z where x is narrowest; z = 0 is the round spot. |
depth xfinish.astigmatic.typed.depth_x_nm | 400 nm | How far from its focus the x width has grown by sqrt(2). at least 1 nm |
width yfinish.astigmatic.typed.sigma_y_nm | 130 nm | s0: the narrowest the spot gets in y. at least 1 nm |
focus yfinish.astigmatic.typed.focus_y_nm | -300 nm | The z where y is narrowest. |
depth yfinish.astigmatic.typed.depth_y_nm | 400 nm | How far from its focus the y width has grown by sqrt(2). at least 1 nm |
A x (more)finish.astigmatic.typed.a_x | 0 | Huang's cubic term in x. |
B x (more)finish.astigmatic.typed.b_x | 0 | Huang's quartic term in x. |
A y (more)finish.astigmatic.typed.a_y | 0 | Huang's cubic term in y. |
B y (more)finish.astigmatic.typed.b_y | 0 | Huang's quartic term in y. |
z rangefinish.astigmatic.typed.z_range_nm | 800 nm | +- this: where the curves are trusted. at least 10 nm |
z scalefinish.astigmatic.z_scale | 1 | True z per apparent z: about 0.7-0.8 for an oil objective imaging in water, 1 for none. at least 0.01 |
4Pi zfinish.fourpi_z | on | Z from the interference phase of a 4Pi fit, unwrapped by its envelope z (Analysis/After fit/4Pi z). |
| 4Pi phase | ||
calibrationfinish.fourpi.slope | as fitted | The phase's slope in z: kept with the table by the 4Pi fit, or read from a 4Pi model file. Choices: as fitted; from a model file |
modelfinish.fourpi.path | – | A 4Pi model (.h5): this program's or uiPSF v1's. |
time windowfinish.fourpi.window_frames | 1000 frames | The cavity's phase is measured over this many frames. at least 10 frames |
smoothingfinish.fourpi.smoothing | 1 windows | Average each window with its neighbours, this many in all. at least 1 windows |
refine periodfinish.fourpi.refine_period | off | Find the fringe period that the data agree with best. |
z scale (more)finish.fourpi.z_scale | 1 | True z per apparent z: 1 when sample and immersion index match. at least 0.01 |
overlay channelsfinish.overlay | off | Move the second half of a two-channel fit onto the first, by beads; channel is the half (Analysis/After fit/Overlay channels). |
| channel overlay | ||
transformation fromfinish.overlay_channels.source | transformation file | A saved registration, beads already fitted as two channels, or bead movies to fit. Choices: transformation file; fitted beads; bead movies |
filefinish.overlay_channels.path | – | A _2ct.h5 (Calibrate transform, or this plugin's), or a dual-colour bead calibration. |
fitted beadsfinish.overlay_channels.beads_table | – | Bead localizations fitted with channels > read: two channels. |
bead moviesfinish.overlay_channels.beads | – | A folder of bead movies, or one movie's path; beads seen in both halves. |
| bead fit – How the bead movies are fitted: Gaussian 2D, two channels, the sample's camera. | ||
cutofffinish.overlay_channels.bead_fit.cutoff | 1.7 | The detection threshold, in units of the filtered frame's noise (the fitters' dynamic cutoff). at least 0.1 |
at mostfinish.overlay_channels.bead_fit.max_frames | auto | Frames fitted per bead movie; auto: all. at least 1 frames |
| channels – Where a split chip's two channels lie: the microscope's entry, or chosen by hand. | ||
layoutfinish.overlay_channels.channels.layout | the microscope's | How the chip is split: the microscope's entry, or chosen by hand with the main channel and the split. Choices: the microscope's; right-left; right-left mirrored; up-down; up-down mirrored |
main channelfinish.overlay_channels.channels.main_channel | the microscope's | The channel the other is registered onto: the microscope's (its transmitted arm), or either half, to swap them. Choices: the microscope's; left; right; upper; lower |
split position (more)finish.overlay_channels.channels.split_position | auto | The first pixel of the second channel, on the chip, for a layout chosen by hand; empty: the middle of the frame. at least 1 px |
| registration – How a registration between two channels is measured: the vote, the pairing and the fit. | ||
transformationfinish.overlay_channels.registration.model | projective (8 coefficients) | Projective extrapolates gracefully; the polynomial describes a distorted field far better where the pairs reach, and is refused when they do not reach far enough. Choices: projective (8 coefficients); polynomial, order 3 (20) |
vote bin (more)finish.overlay_channels.registration.vote_bin_px | 2 px | The bin of the histogram of pair vectors the offset is voted in. at least 0.1 px |
vote smoothing (more)finish.overlay_channels.registration.vote_smooth_px | 4 px | The width of the difference-of-Gaussians filter the vote is scored with. at least 0.1 px |
coarse matchingfinish.overlay_channels.registration.coarse_tolerance_px | 20 px | First pass; must cover the rotation between the channels – 3 degrees over 512 px is 27 px. at least 0.1 px |
fine matchingfinish.overlay_channels.registration.fine_tolerance_px | 1 px | Second pass over clean matches only, which is where the accuracy comes from; 0 skips it. |
adapt fine matching (more)finish.overlay_channels.registration.adapt_fine_tolerance | on | Widen the fine matching to what the coarse fit misses its own pairs by, when those pairs are clean. |
minimum pairs (more)finish.overlay_channels.registration.min_pairs | 20 | Fewer pairs than this and the registration refuses. at least 4 |
pairs used in the fit (more)finish.overlay_channels.registration.max_pairs | 20000 | At most this many pairs, drawn at random, go into each fit. at least 4 |
outlier threshold (more)finish.overlay_channels.registration.reprojection_threshold_px | 1 px | The robust (RANSAC) fit's inlier radius, at least; it widens with the matching tolerance. at least 0.01 px |
dx/dy limit (more)finish.overlay_channels.registration.transform_axis_limit_px | 0.5 px | The largest |dx| or |dy| a pair may keep after the first fit, at least; it widens with the matching tolerance. at least 0.01 px |
keep the registrationfinish.overlay_channels.save | on | Write it beside the beads as <name>_2ct.h5 and use it again while the beads and these settings are unchanged. |
drift correctionfinish.drift | none | Estimate the drift from the finished table and subtract it from every localization. Off by default: it is minutes of work on a dataset it cannot see beforehand. Choices: none; RCC; COMET |
| RCC drift – How finely to bin, render and search. | ||
time windowsfinish.rcc.n_timepoints | 20 | How many windows the acquisition is cut into: more follow faster drift, fewer are less noisy. at least 2 |
pixel sizefinish.rcc.pixelsize_nm | 15 nm | The pixel of the images that are correlated; about the localization precision. at least 1 nm |
z bin (more)finish.rcc.z_pixelsize_nm | 5 nm | The bin width of the z histograms. at least 0.1 nm |
max driftfinish.rcc.max_drift_nm | 500 nm | The largest drift between any two windows that can be found. at least 1 nm |
peak fit half-width (more)finish.rcc.fit_window | 3 px | The patch the correlation peak is fitted over, for its sub-pixel position. at least 1 px |
max image size (more)finish.rcc.max_pixels | 2048 px | A wider field of view is folded back onto itself, to keep the correlation fast. at least 64 px |
correct zfinish.rcc.use_z | auto | Auto: if the table has z. |
merge blinksfinish.rcc.group | on | Merge the localizations of one blink into one before measuring. |
within (more)finish.rcc.group_dx_nm | auto | How close localizations in consecutive frames must be to be one blink; auto: the session's merge settings. |
dark frames (more)finish.rcc.group_dt | auto | How many dark frames a blink may skip; auto: the session's merge settings. |
tile (more)finish.rcc.tile_nm | 200 nm | The axial pass correlates z histograms in tiles of the field of view this size. at least 1 nm |
tile y (more)finish.rcc.tile_y_nm | auto | Auto: square tiles. at least 1 nm |
max axial drift (more)finish.rcc.axial_max_drift_nm | 200 nm | How far from zero the axial correlation peak is looked for. at least 1 nm |
skip zero shift (more)finish.rcc.exclude_zero_lag | on | Leave the zero-shift sample out of the axial peak search. |
error barfinish.rcc.split_half | on | Estimate again from each half of the field and show both: how far they differ is twice the curve's noise. |
reference (more)finish.rcc.reference | as estimated | The frame the drift is zero at; first or last frame for consecutive files. Choices: as estimated; first frame; last frame |
| COMET drift – COMET parameters. The defaults suit a typical SMLM movie. | ||
window unit (more)finish.comet.segmentation_mode | frames | What window size counts; time-window fit only. Choices: frames; localizations; windows |
window sizefinish.comet.segmentation_var | 500 | Frames or localizations per time window, or the number of windows; time-window fit only. at least 1 |
max driftfinish.comet.max_drift_nm | 300 nm | The largest drift expected; also the radius within which localizations are paired. at least 1 nm |
target sigmafinish.comet.target_sigma_nm | 30 nm | The finest width of the overlap Gaussian, where refinement stops. at least 0.1 nm |
initial sigma (more)finish.comet.initial_sigma_nm | auto | The width the refinement starts from; auto: a third of max drift. |
smoothing (more)finish.comet.boxcar_width | 1 windows | Running mean over this many windows between refinement steps; 1 is none; time-window fit only. 1 to 1000 windows |
interpolation (more)finish.comet.interpolation | cubic | The curve from the window estimates to every frame; time-window fit only. Choices: cubic; catmull-rom |
max locs / window (more)finish.comet.max_locs_per_segment | auto | A random subset of at most this many per window; auto: all; time-window fit only. at least 1 |
ftol (more)finish.comet.optimizer_ftol | 1e-07 | Relative change of the cost at which the optimizer stops. |
approximate kernel (more)finish.comet.approximate_kernel | on | Skip pairs more than 6 sigma apart; the spline fit always does. |
ftol coarse (more)finish.comet.optimizer_ftol_coarse | auto | Ftol for the steps above the target sigma; auto: ftol; time-window fit only. |
quality control (more)finish.comet.quality_control | off | Discard time windows whose fit does not beat no correction; needs fit spline off. |
min lift (more)finish.comet.min_lift | 0 | How much a window's fit must improve its overlap over no correction to be kept. |
merge blinksfinish.comet.group | on | Merge the localizations of one blink into one before estimating. |
within (more)finish.comet.group_dx_nm | auto | How close localizations in consecutive frames must be to be merged; auto: the session's merge settings. |
dark frames (more)finish.comet.group_dt | auto | How many dark frames a blink may skip; auto: the session's merge settings. |
two stage (more)finish.comet.two_stage | off | A grouped pass, then an ungrouped one within fine radius. |
fine radius (more)finish.comet.two_stage_radius_nm | 30 nm | The max drift of the second, ungrouped pass. |
RCC first (more)finish.comet.rcc_prepass | off | Correlate rendered time windows to take out the bulk of the drift, then run COMET over a small max drift. |
RCC windows (more)finish.comet.rcc_prepass_windows | 10 | The time windows RCC correlates. at least 2 |
RCC max drift (more)finish.comet.rcc_prepass_max_drift_nm | auto | Auto: RCC's own default. |
fit splinefinish.comet.spline | on | Fit the drift as a smooth curve in time rather than one value per time window. |
knot spacingfinish.comet.spline_knot_frames | 2000 frames | Frames between the spline's coefficients. at least 10 frames |
spline penalty (more)finish.comet.spline_penalty | 0 | Extra penalty on the curve's bending; 0 is none. |
transformationfinish.comet.transformation | shift | What changes over time besides the position; spline fit only. Choices: shift; xy scale; xy scale + rotation; xy affine; xy affine + z scale; 3D affine |
transformation knots (more)finish.comet.transformation_knot_frames | auto | Frames between the transformation's spline coefficients; auto: the knot spacing. at least 10 frames |
transformation penalty (more)finish.comet.transformation_penalty | 0 | Pulls the transformation towards none where the data say little; 0 is none. |
correct zfinish.comet.use_z | auto | Auto: if the table has z. |
precision weightsfinish.comet.precision_weights | on | Widen each pair's Gaussian by the two localizations' precisions, so imprecise ones count less; needs xy_err_nm, and z_err_nm for z. |
z width (more)finish.comet.sigma_z_factor | 1 x lateral | The overlap Gaussian's width in z as a multiple of its lateral width; 1 is one width for all axes. 0.1 to 20 x lateral |
error barfinish.comet.split_half | on | Estimate again from each half of the field and show both: how far they differ is twice the curve's noise. |
reference (more)finish.comet.reference | as estimated | The frame the drift is zero at; first or last frame for consecutive files. Choices: as estimated; first frame; last frame |
assign coloursfinish.assign_colors | on | Split the localizations by their photon ratio and write channel (Analysis/After fit/Assign colours). |
| colour assignment | ||
methodfinish.colors.mode | split at the minima | A cut in r, or a posterior per localization. Choices: split at the minima; probabilistic |
coloursfinish.colors.colors | 2 | How many species the histogram of r holds. 1 to 6 |
exclusion drfinish.colors.exclusion | 0.05 | Minima: leave this much of r on either side of a boundary unassigned. |
sigmafinish.colors.tolerance | 3 | Probabilistic: a colour is given only within this many sigma of its expected split, the sigma being that localization's own photon statistics plus any extra spread. 0: assign to the nearest colour however far away. |
keep the tailsfinish.colors.keep_tails | off | Probabilistic: apply the sigma test only between the outermost colours, so a localization more extreme than the first or the last mode is kept rather than refused. |
allowed crosstalkfinish.colors.crosstalk | 0.05 | Probabilistic: refuse what is too close to call as well – the largest expected fraction of wrongly assigned localizations. Narrow beside the sigma test, and what matters where two colours overlap. 1e-06 to 0.5 |
extra spreadfinish.colors.spread | 0 | Probabilistic: a species' own width in r, added in quadrature to the shot noise, for a dye whose splitting ratio varies across the field or between molecules. 0: shot noise alone (the summary prints what the modes suggest). |
use fitted errorsfinish.colors.use_errors | on | Take the photon errors from the fit where the table has them; otherwise sqrt(photons). |
use abundances (more)finish.colors.use_prior | on | Probabilistic: weight each species by how much of the sample sits under its mode. |
minimum photons (more)finish.colors.min_photons | 0 | Localizations with fewer photons in total are ignored and left unassigned. |
intensity LUT (more)finish.colors.cmap | viridis | The colour map of the intensity plot's 2D histogram. Choices: viridis; cividis; turbo; magma; inferno; Greys; Greys_r |
histogram bins (more)finish.colors.bins | 200 | How many bins the histogram of r has over its whole range, -1 to 1. 10 to 2000 |
smoothing (more)finish.colors.smoothing | 2 bins | The histogram is smoothed by this much before its maxima are looked for; it also sets how far apart two modes must be. |
expected r (more)finish.colors.expected | auto | The species' ratios, comma separated ("-0.65, 0.96"), measured on single-label samples or computed from the spectra. auto: the histogram's own maxima. |
channel 1 attribute (more)finish.colors.channel1 | auto | Auto: photons_ch0, or the first pair of per-channel attributes in the table. |
channel 2 attribute (more)finish.colors.channel2 | auto | The attribute r counts negative; name both attributes or neither. |
then chainfinish.chain | – | A saved chain run last, on the finished table; empty: none. |
The table has the attributes of Gaussian 2D with z instead of the PSF width:
| attribute | meaning |
|---|---|
x_nm, y_nm | the position on the camera chip (the camera ROI's corner added) |
camera_channel | on two channels: which channel saw it, 0 the main one |
z_nm | height relative to the calibration's focal plane, in objective nanometres; drawn for a focus in the sample (focus not as calibrated), the height above the coverslip |
z_err_nm | its precision (CRLB) |
x_err_nm, y_err_nm, xy_err_nm | the lateral precision (CRLB) |
photons, background, photons_err, background_err | |
logl, logl_rel | the log-likelihood, and per pixel |
peak_x_pix, peak_y_pix, iterations | the candidate, and the steps taken |
The file also records the calibration used: its path, ,
, the grid, whether its beads were taken with EM gain, and, for a SMAP calibration of mirrored beads, that it was turned round on load.
What to check:
logl_rel separates good fits from bad. Two emitters close together are fitted as one rounder spot, whose z is pulled towards focus; those fits have a poorer logl_rel, and filtering on it is the remedy. In simulations that was the whole of an apparent z compression of 7 %.z_err_nm of 10 to 30 nm for a few thousand photons is usual (the figure above); much larger values belong to dim or strongly defocused spots.The camera frames. The file also keeps a few of the frames the table was fitted from, in photons (counts minus offset, times the conversion): first the average of every frame fitted, then the first fitted frame, then the rest spaced evenly up to the last one, as many as raw frames asks for, each with its frame number – the same number as in frame. In the Render tab they are a source of an image layer, placed in the table's coordinates, so they lie under the localizations: whether a structure is really there, where the cell edge is, or whether the focus was lost can be checked without the original stack. The average is the one to start with; a localization of frame 17 should sit on a spot in frame 17.
Based on SMAP's fit_fastsimple workflow and its MLE_GPU_Yiming fitter in Spline mode (Ries 2020). The main changes:
calibrate3D_g, but uses a linear rather than circular correlation to align beads, and crops z to where all accepted beads overlap, which can make its z range narrower than SMAP's.diffrawframes-th frame after the average; here a number of frames is kept, spaced evenly over the fitted range, so that a long acquisition does not fill the file with them.