Panels
The PSF calibration window's bead average – turns z-stacks of fluorescent beads into the measured 3D PSF model the Spline 3D fitters use, and for a split camera into two models and the transformation between the halves.
A 3D fit needs to know what one molecule looks like at every height. On a real microscope that image – the point spread function, PSF – is not a textbook Gaussian: a cylindrical lens stretches it, the objective adds its own aberrations, and both differ from one microscope to the next. The reliable way to know it is to measure it.
This method measures it from beads: sub-diffraction fluorescent beads stuck to a coverslip, imaged while the objective is stepped through focus. Each bead gives a small 3D image of the PSF (a bead stack). It finds the beads, cuts them out, aligns them onto one another, averages them, smooths the average and turns it into a cubic-spline model – a spline calibration (also called a bead calibration, cspline or experimental PSF model), the method of Li et al. 2018. The model is saved as an .h5 file, which the Spline 3D fitter reads; how the fit uses it is explained on that page.
It has two modes (the window's mode):
What it needs:
It is the bead average of the PSF calibration window – sample beads in a z stack, method bead average – whose other methods learn a model of the optics instead; that page explains the window itself: adding stacks, Detect beads, Calibrate, marking beads, saving. smappy-calibrate --out FILE runs the same calibration without a window. (Until 2026-11 it had a window of its own, Bead calibration.)
1. Find the beads. The stack is collapsed to its brightest value per pixel (a maximum projection), smoothed, and every local maximum clearly above the background noise (threshold, in multiples of the noise) is a bead. A bead too close to the image edge is dropped, and so are both beads of a pair closer than min distance: two overlapping PSFs are not one PSF. A faint speck does not count as a neighbour – a spot whose height in the projection is below the typical bead's divided by the square root of brightness range – so dust beside a bead does not cost the bead; bright dirt and anything saturated still do. The smoothing can merge a second bead 5 to 7 pixels from the first into one spot, so the projection is searched again with half the smoothing, and a spot found there away from every bead counts as a neighbour too. Two beads closer than that – 2 pixels, say – are one spot to any search; they are told by their shape: each bead's maximum projection is compared with the median of all, and a bead far from it (doubles (k)) is marked a double and excluded, as by hand, where the table lets it in again.
2. Cut them out. Around each bead a box of bead box pixels (plus a margin, padding, for the alignment to shift into) is cut from every plane. One background value is subtracted from the whole box – the median of its border pixels over all planes, so that the PSF's faint tails, which change with z, are kept – and the box is divided by the light in its brightest plane, so that a bright and a dim bead count alike. A bead whose brightness is far from the others' (brightness range) or that reaches the camera's maximum (saturation) is set aside: it is either two beads, a clump, or clipped.

Left: the maximum projection of a simulated bead stack, with the beads that were found (boxes, the size of the bead box). Right: one bead's box at three heights of the objective – the astigmatic spot is stretched one way below focus and the other way above.
3. Align them. The beads do not sit at the same place in their boxes, nor at the same height on the coverslip, so each is shifted in x, y and z until it matches a reference – the average of the half of the beads that look most alike. The shift is found by 3D cross-correlation, first over the whole stack, then refined over the planes around the centre (alignment range, iterations), and is applied with sub-pixel, sub-plane precision. A bead that has to move further than max xy shift or max z shift is taken for a misdetection and dropped.
4. Reject the odd ones out. Every aligned bead is compared with the average of all the others (so it cannot vouch for itself). A bead whose shape differs much more than the typical bead's does (rejection (MAD)) is left out of the average: a bead with a neighbour, a tilted one, a speck of dirt. The bead table lists every bead with its shift, its similarity to the others and why it was used or not.
5. Average and smooth. The accepted beads are averaged. The average still carries the noise of a finite number of photons, which a spline would faithfully reproduce as ripples, so it is smoothed along z (smoothing z; laterally only if smoothing xy is set), clipped at zero and scaled so that its brightest plane holds exactly one photon. A fitted photon number is then the photons in the molecule's in-focus image. Only the planes that every accepted bead covers after its z shift are kept.

Left: side views (x against emitter z) of one bead as it was cut out, of the aligned average of the accepted beads, and of the smoothed model the fitter uses; the spot is narrow in x on one side of focus and wide on the other. Right: the light in each plane of the model – nearly constant in z, since a bead loses little light out of the box, and 1 in the brightest plane by construction.
6. The spline. The model is interpolated with cubic polynomials between the grid points, so that the fitter can evaluate it, and its slopes, at any sub-pixel position and height. This is what the window saves.
7. Check it. The Fit quality page fits the calibration's own beads, plane by plane, with the same fitter the data will meet, and compares the fitted z with the objective's position. A good calibration gives a straight line of slope 1. The check is on the beads that made the model, so it shows that the model is self-consistent, not how precise a fit of dim molecules will be.

The calibration's own beads refitted plane by plane (thin lines, one per bead) and the averaged stack (black): fitted z against where the objective was. Right: the same after removing each bead's own offset – the part that says whether the model is distorted along z.
Dual colour: two halves, one calibration. The frame is cut at the split position into the main half (main channel) and the other, the secondary. Steps 1 and 2 run in each half on its own. Then:

Dual colour. Left: the light in each plane of the two models; the grey band is the five planes around the stack's centre over which the two together are set to one photon, so the main half (70 % of the beads' light in this simulation) and the secondary (30 %) keep their share. Right: how far each bead pair lands from its partner after the transformation, in pixels; the box is the dx/dy limit a pair must meet.
Detection. With the maximum projection smoothed by a Gaussian of width detection sigma, a pixel is a bead if it is a
local maximum and
the threshold: 1.4826 times the median absolute deviation estimates the noise's standard deviation without being pulled up by the beads. The bead's position is the centre of mass of its maximum, rounded to a pixel.
Isolation. A neighbour within min distance counts if its height at its maximum is at least
, or it is saturated;
is the median of the heights of all spots of all stacks weighted by the heights themselves, and
the brightness range. Weighted so,
stays among the beads however many faint specks a low threshold finds: on the Zenodo example beads, 60 to 332 specks beside 58 beads. The height, not the box's light, judges a neighbour: a box around a speck beside a bead holds the bead's light too. With no brightness range, every neighbour counts.
Merged neighbours. The projection is searched again with half the smoothing, detection sigma/2, by the same rule. A maximum found there at least 3 pixels from every maximum of the first search is a neighbour the smoothing merged into a bead; within min distance of a bead it counts as above, its height taken on the first search's scale by the ratio of the two smoothed projections at the bead. The beads' own projections stay one maximum at half the smoothing: on the DECODE and Zenodo example beads none split, though an astigmatic bead's defocused lobes lie 2 pixels either side of its centre. On the DECODE example beads this drops 5 of 104 beads, each a double 5 to 7 pixels apart.
Doubles by shape. Each bead's maximum projection over z, in a square of 17 pixels (at most the bead box), less the median of its border and clipped at zero, is moved by its centre of mass to the middle (linear interpolation) and divided by its sum. Its score is the sum of its absolute differences from the median of all these, between 0 and 2. The maximum projection does not depend on the plane a bead's focus is in, so beads at different heights compare. With the median score and
1.4826 times the scores' median absolute deviation, over the beads with specks left out, a bead scoring above
is marked a double, the doubles (k); it is excluded as a bead excluded by hand is. Fewer than five beads have no median to go by, and none is marked. On the DECODE example beads, taken on an EMCCD with an astigmatic lens, the doubles scored 0.22 to 0.71 against a median of 0.09 (
0.03); on the Zenodo example beads the highest of 58 scored 0.16 against 0.08, and of the field-dependence set's, whose shapes change over the chip, 0.73 against 0.25 (
0.10): none marked in either.
Extraction. A box of pixels (
the bead box,
the padding) is cut from every plane;
, the median of its outermost pixels over all planes, is subtracted, and the box
is divided by its brightness
, the light of its brightest plane
. The brightness limits are
and
, with
the median over unsaturated beads and
the brightness range, so the brightest accepted bead is at most
times the dimmest. Stacks of different lengths are cropped to the shortest, centred.
Alignment. A shift is the maximum of the normalised linear (not circular) cross-correlation
each lag normalised by the energy in the part of the two volumes that actually overlap at that lag, so an edge contributes nothing it does not have. The search is within a central pixel window laterally. The integer peak is refined to a fraction of a pixel and a plane from the correlation itself, without resampling the bead:
is taken, over one fixed overlap, at the 27 whole-voxel lags around the peak, the triquadratic through their logarithms (every
with
) is found, and its maximum within
voxel is the shift. The logarithm, because the peak is close to a Gaussian; the triquadratic rather than a quadratic, because at 20 nm steps the peak is some two hundred times flatter along z than across, and its z curvature changes with the lateral offset (an astigmatic PSF's width changes with z) – a quadratic folds that change into the z shift and pulls every bead towards a whole plane. On simulated beads at 20 nm steps the shifts come back within 1.4 nm rms in z and 0.004 pixels laterally. Maximising the correlation of a linearly interpolated bead, as this did before, took nine times as long and left 5.7 nm: interpolation smooths by an amount that depends on the fraction, and draws the optimum towards whole planes. The first pass covers the whole stack; the median shift is subtracted, so that max xy shift and max z shift are measured from the consensus of the beads and not from the reference; the refinement passes (iterations minus one) correlate the central planes only,
of them,
the alignment range. Every bead is resampled once, with cubic interpolation, from its original box by its accumulated shift.
Shape score. Each bead is scaled to the current average by
over the brightest quarter of
's voxels (four passes), and compared with the average of the other accepted beads,
:
their correlation coefficient (the table's correlation, and
its residual). Dividing by
keeps a bead that is broadly wrong but locally smooth from scoring well. A bead is kept if
,
the rejection (MAD), where the mean and standard deviation are taken over the beads within 4 MAD of the median when there are at least six. This is repeated three times after the last alignment pass.
The model. With the average of the accepted, aligned beads over the planes all of them cover and the central
pixels,
a Gaussian of standard deviation smoothing z
planes along z and smoothing xy pixels laterally (reflected at the edges). The spline coefficients are the not-a-knot cubic interpolant along x, then y, then z; the file stores them with the model, the unsmoothed average, every bead's shift and the reasons. z = 0 is the centre plane of the cropped stack, and the convention is that of the fitter: z is where the emitter is relative to the focal plane, in objective nanometres.
Dual colour: the normalisation. Both averages are smoothed the same way. Before clipping, each half's light is read as the mean plane sum over the centre plane and FOCAL_PLANES = 2 planes either side,
so that the two models together hold one photon around focus and keep the beads' ratio. Each also stores its share, , as
photon_normalization. Fitted with one photon number for both halves (biplane), that number is the molecule's total; fitted with a number per half (two colours), each is multiplied by its to give that half's photons. The light is counted before clipping because clipping keeps the noise in the tails above zero, and counted as light that noise read the photons about 1.5 % high; counted before, it averages out. Several planes are used so that one plane's noise does not set the scale, and few enough that light defocusing out of the box does not. The lowest value the spline takes between knots, relative to its peak, is stored as
spline_minimum (the fitter floors its model for that).
Dual colour: pairs. A bead's position is the elliptical Gaussian fit (75 iterations) to the mean of the central 11 planes, 13 by 13 pixels; a fit that fails or lands more than 4 pixels off rejects the bead. The offset between the halves is voted for in a histogram of 2-pixel bins of every difference between a main-half and a secondary-half bead of the same stack, smoothed; pairs are mutual nearest neighbours within 12 pixels of each other after that offset (coarse matching, 12 pixels by default), and never cross stacks. Fewer than minimum pairs stops the calibration.
Dual colour: the layout. On microscope, the microscope is the one the first bead file's metadata names (beads_microscope), its entry as it stood then; its arms' sides give the layout, a mirror on one arm makes it mirrored, the named main arm gives main channel, and a split position in the entry is used (resolve_arrangement). A main channel left to a microscope without one is the left or the upper half. Until 2026-11 the layout was voted for from the beads' positions, which a regular grid of beads – its own mirror image – could not decide.
Dual colour: the transformation. In homogeneous coordinates the map is (
a
matrix, secondary to main, in chip pixels). Round one: RANSAC (Fischler & Bolles 1981) – 500 draws of four pairs (a fixed seed, so it is reproducible), each solved by the normalised direct linear transform, keeping the draw with the most pairs within outlier threshold; the inlier set is refitted until it stops changing, and then refined by least squares on the reprojection error in the main half with the robust soft-L1 loss
half the dx/dy limit, which is quadratic for small errors and grows only linearly for large ones. Round two keeps the round-one inliers whose
and
are both within the dx/dy limit and fits again on that fixed set. The map must not cross infinity anywhere on the camera image, forwards or backwards. The PSFs never enter this fit: a pair rejected for its shape still counts for the transformation, and the transformation list and the PSF list are kept apart (the table's state says which a pair is in).
Dual colour: the paired stacks. The secondary box is mirrored if the layout is, and shifted by the sub-pixel difference between where it was cut and where the transformation puts the partner of the main box – a shift, not a projective warp of the image. Both halves are divided by one number, the sum of their brightnesses, and then aligned with one shift per pair: the correlation adds each half's numerator and energies, never correlating one half with the other. A pair whose correction exceeds the padding is kept for the transformation but not the PSF. The secondary model is mirrored back to the camera's orientation before it is saved.
Fit quality. Single channel: every fifth plane of each accepted bead (a fit box of the bead box minus 4 pixels, the camera values restored) and of the average stack, fitted with the spline fitter from five z starts, keeping the best likelihood. Dual colour: the pairs fitted with the two-channel global fit, x, y and z shared, one z per pair (Li et al. 2022), which also shows the fitted split of the photons. The centred error removes each bead's median error, since a bead's absolute height on the coverslip is not known; it measures how distorted the z scale is, not how accurate.
Compared with the paper. The method is that of Li et al. 2018: beads registered in 3D, averaged, and interpolated by cubic splines. The main changes are those listed under Differences from SMAP: a Gaussian smoothing in place of a smoothing B-spline, a linear correlation, a leave-one-out shape rejection, and the joint normalisation of the two halves.
The settings of the window's beads part (and, in dual colour, its channels and registration), as the bead average reads them. The common ones are shown; more has the rest, whose defaults rarely need changing.
The model's width, in camera pixels; odd, at least 7. It must hold the spot at the ends of the z range, where it is widest: too small cuts off the tails, too large lets neighbouring beads in. The fitter's fit box may be smaller.
Leave it on auto when the files record the step. A wrong step stretches or squeezes every fitted z by the same factor.
Lower it if clear beads are missed, raise it if noise or dim debris is detected; 6 is a good start for bright beads.
Larger than twice the half-width of a defocused bead's spot, or the tails of a neighbour end up in the model. Beads closer than this are both dropped, so dense fields lose many beads. Faint specks do not count as neighbours (brightness range decides what is faint).
How far, in robust standard deviations of the beads' shape scores, a bead's shape may be from the median before it is marked a double; never closer than twice the median score. Lower it if doubles are missed (look at the maximum projection in the bead table's selection), raise it if single beads are marked; auto marks none.
The width of the smoothing along z. About one to two z steps is usual. Too little leaves noise ripples that become stripes in z; too much blurs the PSF's change with z and costs z precision.
Extra pixels around the bead box for the alignment to shift into; must exceed max xy shift by more than one pixel. Auto, the default, is max xy shift plus two, rounded down: 5 px for the default 3 px.
The smoothing before detection; about the spot's width.
Beads that need a larger lateral shift than this are rejected.
Beads that sit further than this from the others in height are rejected: a bead stuck higher up, or one the correlation mismatched.
The z range around the centre that the refinement correlates over. Around the focus the PSF has most structure, far from it least.
The number of alignment passes: one coarse, then refinements.
The shape cut, in standard deviations of the beads' scores (see In detail). Smaller rejects more beads, larger keeps more.
Lateral smoothing in pixels; 0, the default, is usually right, because the beads' alignment already averages laterally.
The fewest accepted beads the calibration will be built from. Fewer than ten gives a warning in any case.
The largest ratio between the brightest and the dimmest accepted bead, centred on the median; auto disables the check.
The camera value at which a bead counts as saturated; auto takes the file's integer maximum (65535 for 16-bit).
Where the two channels lie on the chip, in the same words as the two-colour fitters' channels part: the microscope's entry, or chosen by hand for a microscope without one. It is a fact about the microscope, kept apart from how the beads are paired (registration).
How the camera chip is split: right-left or up-down, and whether the secondary half is mirrored along the split (an image splitter with an odd number of mirrors in one path). microscope takes it from the microscope's entry, and the status bar says what it is. For a microscope without an entry, look at a bead frame: if the pattern of beads in one half is the other's mirror image, choose a mirrored layout.
Which half is the reference that positions are reported in, for a layout chosen by hand. It must match the layout: left/right for right-left, upper/lower for up-down. On the microscope's layout it is the entry's main arm.
For a layout chosen by hand: the first pixel of the second half, on the camera chip (the bead image's camera ROI corner added), as the two-colour fitters read it; empty is the middle of the first bead image. Each acquisition is cut where that chip position falls in it, so acquisitions taken with different ROIs share one seam.
How the beads are paired and their map fitted: the same settings as a movie registration's (Calibrate transform), with a bead slide's defaults – tens of bright pairs rather than thousands of localizations, so fewer pairs are enough and the screen is tighter. The settings a bead calibration does not use (the second matching round, the polynomial) are not shown. Where the channels lie is channels, not this.
How far a bead may lie from where the most common offset between the halves puts its partner. It has to cover the rotation and scale between the halves across the field; beads are at least min distance apart, so it can be generous without pairing the wrong ones.
The fewest bead pairs the transformation may be fitted from; at least 4, which is what a projective map needs. More pairs, spread over the field, make the map reliable towards the edges.
The first round's tolerance, in pixels. It only has to separate right pairings from wrong ones, so it can be generous.
The second round's tolerance on each axis, in pixels. Good bead data sits well below 0.1 pixel; if too few pairs pass, look at the Transformation page before raising it.
The pages the window shows after a bead average. Select a bead in the table to see its own stack.
The stack's projection with its beads (green used, red rejected), the brightness of every bead against its lateral shift with the accepted brightness band, a side view of the model, and each bead's shape residual against its z shift. In dual colour: the split frame with its pairs, and the main half's field with pairs used for the PSF and the transformation (green), for the transformation only (orange), rejected (red) and unpaired beads. Select a bead in the table to see its own stack.
Dual colour: how far each pair lands from its partner after the transformation (round two), and the first round's residuals with the dx/dy limit box. A tight, round cloud centred on zero is good; a cloud with a tail or two clusters means wrong pairs or the wrong layout.
Fitted against expected z for every bead and for the average, the centred error, and the lateral and axial profiles of the beads against the model. Good: a straight line of slope 1 over the useful range and a centred error of a few nanometres; the ends of the range, where the spot is faint and wide, are always worse. Dual colour adds the fitted photon split, secondary over total, which should be flat in z at one half: the models already carry the beads' split.
Dual colour: the main half's beads overlaid with the transformed secondary ones, and how the beads' shape mismatch varies over the field. A mismatch that grows towards one side is a PSF that changes over the field, which one model cannot describe.
Dual colour: per half, brightness against lateral shift, and the shape residual against the z shift and against the correlation, coloured by what each pair was used for.
How precisely a fit with this calibration could localize a molecule at each height: the Cramér-Rao lower bound (CRLB) of x, y and z against z, all in nm on one graph, for a molecule of 2000 photons on a background of 20 photons per pixel, in the fitters' 13-pixel box, with the photons and background fitted too. It is computed from the spline itself, with the model the fitter evaluates and Poisson noise only: on an EMCCD, whose gain doubles the variance, the real precision is about √2 worse. x and y are converted with the pixel size the beads' camera gives (the file, then the camera database); where neither does, 100 nm is assumed, and the title says so in orange. The status line gives the values at focus. The graph opens on ±500 nm around focus, scaled to the curves there, so the bound's climb at the spline's ends does not flatten them; the house button of the toolbar above it shows the whole range, and its magnifier zooms. Good: a z bound that stays low and smooth over the range you want to image; a bound that climbs steeply marks where the PSF stops changing with z, and a jagged curve a noisy model – more beads, or more smoothing. It scales as one over the square root of the photons, so at 500 photons it is twice as large. In dual colour the solid lines are both halves fitted together, as Spline 3D 2C does, with 2000 photons shared between them by the beads' split; dashed and dotted are the main and the secondary half alone, each with its share of them, and the axis is scaled to the solid lines. Where one half's bound climbs and the other's does not, that half carries the measurement there.
Based on SMAP's bead calibrator, calibrate3D_GUI_g in fit3Dcspline (calibrate3D_g and getstackcal_g for one channel, calibrate_globalworkflow for two; Ries 2020). The main changes:
photon_normalization), so a fit with the photons linked (biplane) returns the molecule's total and a fit with a number per half returns each half's photons.