Localize · version 3
make the PSF calibration Spline 3D and Spline 3D 2C read: from bead z-stacks, the bead average or a physical model of the pupil and its aberrations learnt with uiPSF v2; or that model learnt in situ from the blinking molecules of a measurement; opens its own window
A 3D fit needs to know what one molecule looks like at every height: the point spread function (PSF). The PSF calibration makes it from bead z-stacks by the bead average (its page), or a model of the microscope's optics learnt from the same stacks: the objective's pupil, with its aberrations written as Zernike modes, from which the PSF at any height follows. This is uiPSF (Liu et al. 2024, doi:10.1038/s41592-024-02282-x), re-implemented in PyTorch as uiPSF v2 and run inside SMAPpy.
The same model can also be learnt in situ, from the blinking molecules of a measurement itself, with no beads: it then includes what the sample adds, the spherical aberration that grows with depth above all.
A model is smooth without smoothing, says which aberrations the microscope has and how sure it is of each, and shows where it does not fit the data. Saved, it is turned into the same kind of spline calibration the bead average writes, so Spline 3D and Spline 3D 2C read either alike, and the model is kept inside the same file.
By hand, this section only opens the PSF calibration window, with the Open button in its title bar; the window's page explains the methods, their settings and what they show. It replaces the Bead calibration plugin and window, retired in 2026-11. The pupil model, from beads or in situ, needs PyTorch, an optional part of SMAPpy; without it the window says what to type to install it.
The settings below are for a calibration made without the window: by the AI assistant (run_plugin), in a chain, or from a script. The section in the tab never shows them: the window has its own. They are the window's, by the same names. Each part is one of the window's sections, and it is read only where the chosen method reads it, as the window shows only those sections.
Such a run does what the window's Detect beads and Calibrate do with no bead marked by hand. The beads the detection marks as doubles are left out. The method's finish follows: for a pupil model, the fit quality and the model against the data. With save model on, the calibration is saved beside the stacks, as the window saves it, unless save as names another file. Either way it is listed for the fitters' auto, as the window lists it. The figures are the window's pages, with no bead selected, and a page that is a table (the Zernikes) goes into the result's data.
The method is named by its key, because two methods share a label. pupil, average and elliptical read bead z-stacks. molecules and molecules elliptical read molecules on the coverslip in z sweeps. insitu reads a blinking measurement. A pupil model needs the microscope's NA and emission wavelength. If the database does not give them for the stacks, type them under microscope; the run refuses before any work and says which are missing.
A run without the window does not put the calibration into the fitter. Set the fitter's calibration to the file it reports, or leave it on auto.
| setting | default | what it does |
|---|---|---|
stacksstacks | – | A bead z-stack, z sweep or movie, or a folder of them: every acquisition found in it is used. A file is one acquisition. A folder is searched as the window's Add... searches it, so a folder of bead stacks calibrates from all of them. |
search subdirectoriessubdirectories | on | A folder's subfolders searched too. |
methodmethod | pupil | Pupil: uiPSF's model from beads; average: the bead average; elliptical: astigmatic widths; molecules: from molecules on the coverslip; insitu: from a blinking measurement. Choices: pupil; average; elliptical; molecules; molecules elliptical; insitu |
modemode | Single channel | One channel, a split camera's two (dual colour), or 4Pi's four. Dual colour and 4Pi are offered only by the methods that have them, as in the window. Another mode is refused, with the modes the method has. Choices: Single channel; Dual colour; 4Pi |
save assave_as | – | Where the calibration is written; empty: beside the stacks, as the window saves it, if save model is on. |
| run – What a run starts from and leaves behind. | ||
start fromrun.start_from | – | A previous model of this microscope (its calibration, or an older .uipsf.h5): the start, and the reference the Zernikes are drawn against. |
save modelrun.save_model | on | Save the calibration and its model beside the stacks; off: figures only. |
microscope – The microscope. Each field on auto takes the microscope database's value for the file's microscope (microscope_db, carried in CameraMetadata.microscope): its NA, its immersion, the emission of each arm from the filter it was set to. A value typed beats it. There is no default for the NA and the emission: without a microscope that gives them, a run refuses to start. | ||
microscopemicroscope.microscope | auto | Auto: recognised from the stacks' metadata, else the last one used. |
cameramicroscope.camera | auto | Auto: identified from the stacks' metadata, else the microscope's. |
NAmicroscope.NA | auto | The objective's numerical aperture; auto: the microscope's (required without one). 0.1 to 1.7 |
emissionmicroscope.wavelength_nm | auto | The beads' emission wavelength; auto: from the microscope's filter (required without one). 300 to 1200 nm |
emission, 2ndmicroscope.wavelength2_nm | auto | Dual colour: the secondary channel's; auto: the microscope's other arm, or the same without one. 300 to 1200 nm |
immersion indexmicroscope.n_immersion | auto | The immersion medium's refractive index; auto: the microscope's, else oil's 1.518. 1 to 2 |
sample indexmicroscope.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: water's 1.33, the immersion's for 4Pi. Choices: auto; water; blinking buffer; index matched; typed |
nmicroscope.n_medium | auto | The sample's refractive index the choice stands for; type over it for another. 1 to 2 |
coverslip index (more)microscope.n_coverslip | auto | Auto: the microscope's for its objective, else the immersion's. 1 to 2 |
coverslip thickness (more)microscope.coverslip_um | auto | The coverslip's thickness; auto: the objective's design thickness. Only with a coverslip of another index. 0 to 1000 µm |
pixel xmicroscope.pixel_x_nm | auto | On the sample; auto: the microscope's for its 3D lens, or the camera's. at least 1 nm |
pixel ymicroscope.pixel_y_nm | auto | Auto: as x, or the microscope's. at least 1 nm |
conversionmicroscope.conversion | auto | Photoelectrons per count; auto: the camera database's. |
offsetmicroscope.offset | auto | The count of a pixel that saw no light. |
EM gainmicroscope.emgain | auto | Auto: from the stacks. |
model – The choices a bead calibration exposes, one channel or two; the instrument comes as Optics. | ||
PSF model – The PSF model's choices, one section wherever a model is learnt – beads in one or two channels, in situ, 4Pi – and what uipsf's builder reads (uipsf.model.build): the pupil's order and magnitude, the blur. Each workflow keeps its own fields beside it (BeadSettings, InSituModelSettings), and the form hides what one does not read (model_shown). | ||
Zernike ordermodel.psf.zernike_order | auto | The highest radial order of the pupil's modes; auto: 6. 2 to 12 |
pupil magnitudemodel.psf.magnitude | minimal (cos θ^γ) | Minimal: cos θ^γ, the ring beyond the critical angle and the NA, a few physical numbers; Zernike: every mode up to the order; symmetric: the rotationally symmetric ones; fixed: uniform, the apodisation only. Choices: minimal (cos θ^γ); Zernike; symmetric Zernike; fixed (apodisation) |
blur (more)model.psf.blur | round | A Gaussian blur of the image beyond the pixel's own, learnt (round: one σ for x and y) or held at its value. Choices: free; round; fixed |
blur σ (more)model.psf.blur_nm | 20 nm | The blur beyond the pixel's: its start when learnt, its value when fixed. |
SAF damping (more)model.psf.saf_damping | on | Minimal magnitude: learn a damping of the supercritical-angle ring, the light beyond the critical angle; off: the ring of a point on the coverslip. |
learn NA (more)model.psf.learn_na | off | Minimal magnitude: learn the aperture's NA, an effective one at most 5 % above the objective's; off: the objective's NA as typed. |
learn sample index (more)model.psf.learn_n_med | off | Learn the sample's refractive index from the microscope's sample index, a diagnostic; off: as typed. |
bead diametermodel.bead_diameter_nm | 0 nm | The beads' size, taken out of the model; 0: point-like. |
field dependencemodel.field_dependence | off | Learn astigmatism and coma that vary over the field of view; the spline is then one per point of a grid over the chip, blended per spot. |
drift (more)model.drift | linear per stack | A lateral drift of the stage through each stack, learnt: linear per stack, or free per slice. Choices: none; linear per stack; free per slice |
learn coverslip tilt (more)model.fit_tilt | off | Learn the coverslip's tilt against the optical axis, mostly a coma: in situ, or beads seen through a coverslip of another index than the immersion's. |
rejection (k) (more)model.rejection_k | 3 | Robust standard deviations above the median at which a bead is rejected. at least 1 |
held out (more)model.heldout | 0 | The fraction of beads kept out of learning and localised for the held-out report. 0 to 0.5 |
largest z step (more)model.max_dz_nm | 50 nm | Learn from every n-th slice, n the most whose step stays within this. at least 1 nm |
learn z range (more)model.z_range_nm | 1500 nm | ± about focus learnt from, a shorter stack whole; auto: the whole stack. at least 100 nm |
| spline – How the learnt model is sampled into the spline the fitter reads. | ||
spline z stepspline.dz_nm | auto | Auto: the stacks' step. at least 1 nm |
spline z rangespline.z_range_nm | auto | ± about focus; auto: the range every used bead covers. at least 50 nm |
beads – A single-channel calibration's settings, where the two channels lie (channels, the microscope's or chosen, never detected) and how the beads are paired and their map fitted (registration: the same RegisterSettings a movie registration reads, with a bead slide's defaults). The map is always measured from these beads: no source has asked for another yet. | ||
bead boxbeads.roi_size | 27 px | The square cut around each bead; the model's size. at least 7 px |
padding (more)beads.padding | auto | Auto: max xy shift + 2, rounded down. at least 1 px |
z stepbeads.dz_nm | auto | Auto: from the acquisition. |
detection sigma (more)beads.detection_sigma_px | 2 px | The smoothing before beads are found. |
thresholdbeads.detection_threshold_sigma | 6 sigma | How far above the background noise a bead must stand. |
min distancebeads.min_distance_px | 25 px | Beads closer than this to a neighbour are dropped. |
doubles (k) (more)beads.double_k | 5 | Robust standard deviations above the median shape difference at which a bead is marked a double; auto: none marked. at least 1 |
max xy shift (more)beads.max_xy_shift_px | 3 px | The largest lateral shift the alignment allows a bead. |
max z shift (more)beads.max_z_shift_nm | 250 nm | The largest shift in height the alignment allows a bead. |
alignment range (more)beads.alignment_range_nm | 500 nm | The z range around the focus the alignment correlates over. |
iterations (more)beads.registration_iterations | 2 | Alignment passes. at least 1 |
rejection (MAD) (more)beads.rejection_mad | 1.5 | The shape cut, in robust standard deviations. |
smoothing zbeads.smooth_z_nm | 20 nm | The spline's smoothing along z, a Gaussian's sigma. |
smoothing xy (more)beads.smooth_xy_px | 0 px | The spline's smoothing across. |
min beads (more)beads.min_beads | 1 | The fewest accepted beads to build from. at least 1 |
brightness range (more)beads.brightness_range | 6 | Largest accepted max/min; auto disables it. |
saturation (more)beads.saturation_adu | auto | Auto: the integer type's maximum. |
| channels – Where a split chip's two channels lie: the microscope's entry, or chosen by hand. | ||
layoutbeads.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 channelbeads.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)beads.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. | ||
coarse matchingbeads.registration.coarse_tolerance_px | 12 px | How far a bead may lie from where the offset the beads voted for puts its partner. at least 0.1 px |
minimum pairs (more)beads.registration.min_pairs | 8 | Fewer pairs than this and the registration refuses. at least 4 |
outlier threshold (more)beads.registration.reprojection_threshold_px | 2 px | The first round's robust (RANSAC) inlier radius. at least 0.01 px |
dx/dy limit (more)beads.registration.transform_axis_limit_px | 0.15 px | The largest |dx| or |dy| a pair may keep after the first round. at least 0.01 px |
| in situ – What in situ learning needs beyond the microscope and the model's choices. | ||
focusin_situ.focus_nm | auto | The focal plane's height above the coverslip, as the objective was moved from it; auto: estimated from the molecules on the coverslip. |
astigmatism (more)in_situ.astigmatism_nm | auto | The start's vertical astigmatism (Noll 6), with the microscope's sign; auto: the microscope's, for its 3D lens; not used with start from. |
holdin_situ.hold | the start's | The start's: γ (a Zernike model's symmetric magnitude) and the phase above the order held from start from or the microscope's pupil, else the microscope's γ; every aberration: the start model's whole pupil, only the focus and the blur learnt; nothing: γ learnt, the focus then pinned. Choices: the start's; every aberration; nothing |
focus fitin_situ.focus_fit | learnt | Learnt with the pupil; from the coverslip: set by the lowest molecules' edge each round, not fitted; typed: held at focus. Choices: learnt; from the coverslip; typed |
on the coverslipin_situ.coverslip | on | The sample touches the coverslip: its lowest molecules pin the focus. |
roundsin_situ.max_rounds | 4 | At most this many rounds of localising every molecule, choosing and learning. 1 to 8 |
spline zin_situ.spline_z | above the plane in focus | What the spline's z is: the height above the plane in focus, or above the coverslip. Choices: above the plane in focus; above the coverslip |
| in situ detection – How molecules are found and chosen. One number to set, molecules; under more the few that depend on the data; the rest hidden, the defaults decided in M5 (a script or a chain still sets them). | ||
moleculesin_situ_detection.molecules | 2000 | How many spots to learn from, each frame of a blink one: the movies are read until this many pass the selection. at least 21 |
significance (more)in_situ_detection.significance | 6 | Photons above the background in a disc, in standard deviations of its noise, for a detection. at least 1 |
region (more)in_situ_detection.roi_px | auto | The square region each molecule is fitted in (odd); auto: 3 µm on the sample. at least 7 px |
z proxy (more)in_situ_detection.proxy | astigmatism: σx² − σy² | How the first round sorts by height: an astigmatic PSF's elongation, or a 2D PSF's size. Choices: astigmatism: σx² − σy²; size: σx² + σy² |
| molecules – How molecules are found and chosen in z sweeps. One number to set, molecules; under more what depends on the data, and the molecules' height (held at 5 nm, learnt on auto); the rest hidden, the prototype's on M5's AF647 (November 2026). | ||
moleculesmolecules.molecules | 4000 | How many spots to learn from at most, drawn evenly over the defocus. at least 50 |
height (more)molecules.height_nm | 5 nm | The molecules' height above the glass, held; auto: learnt. 0 to 200 nm |
PSF (more)molecules.psf_shape | auto | How each file's focus is found: where σx = σy (astigmatic) or the spot is smallest (round); auto: from the widths. Choices: auto; astigmatic; round (2D) |
illumination radius (more)molecules.illumination_px | auto | Molecules only inside this circle about the image's centre; auto: the circle inscribed in the image. at least 5 px |
significance (more)molecules.significance | 3.5 | A detection's peak in the matched filter, in robust standard deviations of the filtered frame. at least 1 |
region (more)molecules.roi_px | auto | The square region each molecule is fitted in (odd); auto: 2.6 µm on the sample. at least 7 px |
z step (more)molecules.z_step_nm | auto | For files that do not record the stage's z: its step; auto: from the metadata. at least 1 nm |
frames per sweep (more)molecules.sweep_frames | auto | With a typed z step: the frames of one sweep, all upwards. at least 2 |
| channels – Where a split chip's two channels lie: the microscope's entry, or chosen by hand. | ||
layoutmolecules.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 channelmolecules.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)molecules.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 |
registrationmolecules.registration | – | Dual colour: the halves' map, a dual bead calibration or a registration file; empty: measured from the molecules. |
| elliptical Gaussian | ||
fit boxelliptical.fit_box_px | 13 px | The box the data will be fitted in: a Gaussian's widths depend on it. at least 5 px |
higher orderselliptical.higher_orders | on | Fit Huang's A and B as well; off: the plain defocus curve. |
start sigma (more)elliptical.start_sigma_px | 1.2 px | The width the fits start from. at least 0.1 px |
4Pi – The 4Pi beads section of the PSF calibration window: the PSF model a section of its own (PSFModelSettings), as in every other workflow, and 4Pi's own fields. | ||
channels – Where a 4Pi's phase channels are on the chip: the channels part of Spline 4Pi and of the PSF calibration window's 4Pi beads, one part so that the two read a chip alike (fourpi_layout). The maps between the channels are not here: they are the model's, learnt with the PSF. | ||
layoutfourpi.channels.layout | the file's, else the microscope's | Where the phase channels are: the file's own layout, the microscope's (the database), typed, or the 4Pi-SMS design. Choices: the file's, else the microscope's; the microscope's; as the file lays them out; typed corners; 4Pi-SMS (Bewersdorf lab) |
x cornersfourpi.channels.x_corners | 0, 200, 400, 600 | Each channel's left edge on the chip, comma-separated. |
y cornersfourpi.channels.y_corners | 0, 0, 0, 0 | Each channel's top edge on the chip. |
widthfourpi.channels.width | 200 px | One channel's width. at least 8 px |
heightfourpi.channels.height | 200 px | One channel's height. at least 8 px |
mirrored in xfourpi.channels.mirrored | – | The channels mirrored left-right, by number from 1, comma-separated; empty: none. |
z stepfourpi.z_step_nm | 0 nm | The stage's step between slices; 0: from the scan's own record. |
mirror stepsfourpi.mirror_steps | 2, 0, -2 | A scan's phase steps per slice, as set; a scan of one phase per slice has none. |
boxfourpi.roi_size | 21 px | The box each bead is cut to, per channel. at least 9 px |
peak thresholdfourpi.threshold | 0.2 | A bead's peak, as a fraction of the brightest's: lower finds dimmer beads. 0.01 to 1 |
isolationfourpi.min_distance_px | 0 px | Beads closer than this are both left out; 0: the box. |
outlier factorfourpi.brightness_range | 2.5 | Beads brighter or dimmer than the median by more than this factor are marked excluded (clusters, dim specks); 0: none. |
bead diameterfourpi.bead_diameter_nm | 40 nm | The beads' size, taken out of the pupil model: its dyes, spread over its height, average the fringe; 0: point-like. |
PSF model – The PSF model's choices, one section wherever a model is learnt – beads in one or two channels, in situ, 4Pi – and what uipsf's builder reads (uipsf.model.build): the pupil's order and magnitude, the blur. Each workflow keeps its own fields beside it (BeadSettings, InSituModelSettings), and the form hides what one does not read (model_shown). | ||
Zernike orderfourpi.psf.zernike_order | auto | The highest radial order of the pupil's modes; auto: 6. 2 to 12 |
pupil magnitudefourpi.psf.magnitude | minimal (cos θ^γ) | Minimal: cos θ^γ, the ring beyond the critical angle and the NA, a few physical numbers; Zernike: every mode up to the order; symmetric: the rotationally symmetric ones; fixed: uniform, the apodisation only. Choices: minimal (cos θ^γ); Zernike; symmetric Zernike; fixed (apodisation) |
blur (more)fourpi.psf.blur | round | A Gaussian blur of the image beyond the pixel's own, learnt (round: one σ for x and y) or held at its value. Choices: free; round; fixed |
blur σ (more)fourpi.psf.blur_nm | 20 nm | The blur beyond the pixel's: its start when learnt, its value when fixed. |
SAF damping (more)fourpi.psf.saf_damping | on | Minimal magnitude: learn a damping of the supercritical-angle ring, the light beyond the critical angle; off: the ring of a point on the coverslip. |
learn NA (more)fourpi.psf.learn_na | off | Minimal magnitude: learn the aperture's NA, an effective one at most 5 % above the objective's; off: the objective's NA as typed. |
learn sample index (more)fourpi.psf.learn_n_med | off | Learn the sample's refractive index from the microscope's sample index, a diagnostic; off: as typed. |
vectorial (more)fourpi.vectorial | on | The pupil model follows each arm's dipole fields through the quarter-wave plates and the polarising split: keep it on. Off: uiPSF v1's scalar model, to compare with v1. |
magnitude modes (more)fourpi.magnitude_modes | auto | A Zernike magnitude's modes, Noll indices comma-separated (4, 11); auto: as the PSF model's magnitude says (symmetric: every one with a scalar model); empty or none: a flat magnitude. |
same magnitude (more)fourpi.same_magnitude | on | Both objectives one magnitude shape (one γ), as twin objectives have; how much light each brings stays free. |
photons per frame (more)fourpi.photons_per_observation | on | A bead's photon count free in every frame, as its light varies. |
model z range (more)fourpi.model_z_range_nm | 600 nm | +- this: the z range the saved model covers. at least 100 nm |
model z step (more)fourpi.model_dz_nm | 20 nm | The saved model's z step. at least 5 nm |