DECODE

Localize · version 2 · has a preview

Deep-learning fitter for high densities (DECODE).

What it does

DECODE (Speiser et al. 2021, doi:10.1038/s41592-021-01236-x) localizes molecules with a neural network instead of fitting a model of the PSF to each spot. The network was trained on frames simulated with this microscope's PSF, where the true positions are known. Given a frame, it says for every pixel how likely a molecule is there, and where in the pixel, in z, how bright, and how uncertain each of these is.

This helps most where spots overlap. A fitter like Spline 3D needs each spot on its own in its fit box, and at high density it misses or merges molecules. The network has learnt what two spots in one place look like. On sparse data with bright molecules a spline fit is as precise and needs no training.

The fitter needs a trained model, a .safetensors file. A training writes one into its job folder (smappy-decode train), and a model that the original DECODE trained can be exported to one. A model belongs to one calibration, one camera and one range of brightness and background, the ones it was trained on: it gives confident answers for data of another PSF too, and they are wrong. So the fitter checks what it can (below).

The network runs on PyTorch, which a plain pip install smappy-smlm does not bring: pip install "smappy-smlm[decode]" does. Without it the form says so, and run on can still send the frames to a training host that has it.

There is no peak finding and no fit box: the form has none of the other fitters' detection and fit parts.

Three kinds of model. A model is one of three networks, and the fitter reads which from the file; there is nothing to choose here.

The form's line and Model info... name the kind. DECODE and the optimised models fit the same way: the same columns, the same checks, run on and frames per batch.

Two channels. An optimised model can read a split camera's two channels as one molecule: two colours, or two focal planes (biplane). It is trained on a two-channel calibration, and its two channels part appears in the form. The fitter cuts each frame into the two channels through the calibration's registration, the second channel resampled onto the first's pixels (aligned channels). It reports positions on the calibration's main half, as Spline 3D 2C does, with each channel's photons and background. For two colours, Assign colours then tells the dyes apart from the two counts, as after the fit does by default.

How it works

The frames become photons. The counts are converted with the camera: the offset taken off, times the conversion, divided by the EM gain. The network was trained on frames simulated with the camera's noise, so the photons are not divided by the excess-noise factor of an EMCCD as a likelihood fit's are.

Each frame is seen with its neighbours. A model trained with a frame window of three sees the frame before and after the one it localizes: a molecule that is on in the next frame too is easier to tell from noise. The movie is read in blocks. The last frames of a block are kept and put in front of the next, and the frames whose later neighbours have not been read yet wait for them. So the localizations do not depend on the block size, and a live fit of a file still being written gives the table the finished file gives. At the first and last frame of the movie that frame is repeated in place of the neighbour it does not have, as DECODE did.

The network. The frames are cut to a multiple of 8 pixels in each direction, as the network's halvings need, and scaled as in training: the middle of the training's background taken off, divided by a fiftieth of its mean photons. The network (SigmaMUNet) is two U-Nets in a row. The first sees each of the three frames alone, the same network for each; the second sees what the first made of all three together, and so learns what a molecule on in two frames looks like. Four small heads read its output, and give, for every pixel:

How it learnt. A training shows it simulated frames whose molecules it knows, and adjusts it to make those molecules probable. Its answer for a frame is read as a mixture model: one bell curve a pixel, centred on the position, z and photons the pixel predicts and as wide as its uncertainties, weighted by its probability. The loss – the number a training makes small – is how improbable the true molecules are under that mixture, plus how far the summed probabilities are from the number of molecules in the frame, plus the background's squared error. So a pixel's uncertainty is learnt as the spread of its own errors, and its probability as how often a molecule is there. Molecules of fewer than 100 photons are drawn in the training frames but not counted in the loss: the network is not asked to find what is too dim to be found.

Probabilities become localizations. A pixel whose probability is the largest in its 3 × 3 neighbourhood and above threshold starts a localization; its probability is summed with that of the four pixels it shares an edge with, capped at 1. A neighbouring pixel with a probability above 0.6 starts a second one, so two molecules in adjacent pixels are both kept. Where the summed probability is above threshold, the position, photons and uncertainties are read from the network's output at that pixel.

The probabilities a network gives (left) and what they become (right): a molecule's probability spread over its pixel and the next is summed into one localization (circled) where the summed value passes the threshold; two molecules in adjacent pixels, each above 0.6, stay two; the faint smear passes 0.1 but sums to too little to count at 0.5.

Positions go on the chip. The positions are put back on the frames as they were read – the crop and any flip undone – and the camera ROI's corner is added, as for every fitter.

The network can run on a workstation. Without a GPU the network is slow: a laptop's CPU localizes about one frame of 512 × 512 pixels a second, a GPU 50 to 250. With run on set to a training host (File > Preferences, Training hosts, the hosts the training window trains on), everything but the network still happens here – the movie is read, cut to the camera ROI, turned into photons and cut into blocks – and each block is sent there over ssh, through the network, and its localizations sent back. The model file goes there at the start; it need not be there before. A two-channel model's frames are cut into its two channels here, by the registration and the move, and only the network runs there; the goodness and the bound are drawn here, the goodness over the background map the network sends back. The host needs a SMAPpy of this version or later. The table is the same as here, but for the last digits where two GPUs round differently. A live fit always runs here.

In detail

The crop. Frames whose sides are not a multiple of 8 lose up to 7 pixels of each side, split between the two edges (the extra one at the top and the left). Molecules on those edge pixels are not localized.

The mirror. SMAPpy keeps a bead calibration in the orientation of the camera its beads were taken with, and an EMCCD read out through its EM register mirrors the image in x. The model file records whether the calibration's beads were taken with EM gain (calibration_em_on). Data taken the other way round – beads without EM gain, data with it, as in DECODE's example data – are flipped before the network sees them, and the positions flipped back. Where either side does not say, nothing is flipped, as Spline 3D does not flip.

The check before a run. The network needs no calibration to localize: the PSF it knows is the one it was trained on. What matters is that the data were taken under the same conditions as that calibration's beads. A model trained in SMAPpy keeps them: the microscope and its setup version, the camera, the state of every device the PSF follows (the 3D lens, the filters), and the channel's colour, from the microscope database as the calibration list described the calibration. The data's conditions come from the same database. Where they differ, the form says so under the model, and the run's text and its file repeat it – a warning, not a refusal: a model of the same lens on another day may serve. Where either side is not recorded, nothing is said. Model info... lists what the model file says: its calibration, the conditions, where in the sample its PSF was drawn (PSF drawn for: a focus depth, z the height above the coverslip, for a pupil calibration trained with in the sample; else the beads', z above their focus), the ranges it drew, how far it trained and how well it did on its test set, with the differences from the data first. The check reads the model file's header only, without loading the network.

The check after a run. The fit's photons and background are compared with what the training drew. More than 5 % of the localizations brighter than the training's mean plus three spreads, or with a background outside its range, is a warning in the run's text, and so in the session's history, and in the fitted file's warnings: the network has seen no molecule like those, and their numbers are extrapolated.

What the network ran on. The training's quantum efficiency and spurious charge are taken off the photons as DECODE's camera model did. The network runs without TF32 on NVIDIA GPUs, which moved its output by 1.5 % of a channel's range. Different batch sizes round differently on the CPU, by float32's last digits.

The network's numbers. Two U-Nets of depth 2, 48 features each (DECODE's defaults), three frames in. The probability is a logistic function of the network's value, clamped to plus or minus 8 before it (so between 0.0003 and 0.9997); the offsets and z a hyperbolic tangent, so the offset stays within a pixel and z within plus or minus z_max; the photons and the background a logistic function times phot_max and bg_max; an uncertainty a logistic function times 3, plus 0.001. The scales come from the training's ranges where its file does not set them (autoset_scaling): the input offset the middle of the background range, the input scale a fiftieth of the mean photons, phot_max the mean photons plus 8 spreads, z_max 1.2 times the top of the z range, bg_max 1.2 times the top of the background range. A model file keeps the values it was trained with.

The second molecule's 0.6. Of the summed probability's maxima, only those of a pixel that is the largest of its 3 × 3 neighbourhood start a localization; a pixel next to one, above 0.6 on its own, starts another. DECODE's constant (split_th), unchanged: lower, a molecule spread over two pixels would become two.

The window. The localizations of each frame come from that frame and its neighbours, the frames before and after only as context. A jump in the frame numbers, as in a live acquisition that skipped frames, is treated as the end of one movie and the start of another.

Differences from the original DECODE

The network, its training and its post-processing are DECODE v0.10.2's, ported to current PyTorch: a model the original trained gives the original's localizations on the same frames, and one the port trained scores as the original's do (within the spread of two of its runs). What can change the numbers:

Parameters

settingdefaultwhat it does
source – Where the frames come from.
   file
   source.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
0Frames before this one are skipped.
   last frame (more)
   source.stop
autoAuto: to the end. at least 1
   live
   source.live
offThe file is still being written: fit what is there and keep watching for new frames.
   stop after (more)
   source.live_timeout
30 s idleLive: give up after this long without a new frame. at least 1 s idle
   frames per block (more)
   source.chunk
200Frames 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.
   microscope
   camera.microscope
autoAuto: recognised from the file's metadata, else the last one used.
   camera
   camera.camera
autoAuto: identified from the file's metadata, else the microscope's.
   conversion
   camera.conversion
autoPhotoelectrons per count; auto: from the file or the camera database.
   offset
   camera.offset
autoThe count of a pixel that saw no light.
   EM gain on
   camera.em_on
autoAn EMCCD with its electron multiplication on: the counts are divided by the gain, and the noise is doubled.
   EM gain
   camera.emgain
autoThe EM gain the camera was set to.
   pixel size
   camera.pixelsize_um
autoThe pixel's size in the sample, after the magnification.
   pixel size y
   camera.pixelsize_y_um
autoAuto: square pixels, the same as in x, or the microscope's.
   read noise
   camera.read_noise_e
autoRms per pixel; auto: the camera's, else 1 (an sCMOS).
model – The trained network, and the calibration it is checked against.

Train a model... opens the training window with this fitter's movie, microscope, PSF calibration and run on filled in.

   trained model
   model.path
–A trained DECODE model (.safetensors): a job folder's model.safetensors, or an original DECODE model exported.

A job folder's model.safetensors is rewritten after every epoch of a training, so a training still running can be tried; take it from a finished training for the fit that counts.

   run on
   model.run_on
this computerThis computer, or a training host (Training hosts... below): the frames are read and converted here and sent there, the network runs there.

Worth it when this computer has no GPU: the frames go there as photons, four bytes a pixel, so a movie of 512 × 512 pixels needs about 50 MB a second at a GPU's pace – a wired network carries that, a slow one makes the network the limit. The example movie's 20 000 frames of 180 × 179 took 153 s on a workstation's H100 from a laptop, 166 s on the laptop's own GPU. device then names the device there. The workstations are added under Training hosts..., at the foot of model: File > Preferences, Training hosts, the same list the training window trains on (how to connect one).

   threshold (more)
   model.threshold
0.1The detection probability a pixel must reach to start a localization (DECODE's raw_th); every localization keeps its own in prob.

0.1 is DECODE's Fit notebook's. A low threshold keeps uncertain detections, which carry their prob: filtering the table by prob afterwards (0.5 to 0.7) is the usual way to trade missed molecules against false ones, and can be undone.

0.01 to 0.99
   device (more)
   model.device
autoWhere the network runs; auto: a GPU if there is one. Choices: auto; CPU; CUDA; Apple GPU
   frames per batch (more)
   model.batch
0Frames through the network at once; only memory and speed depend on it; 0: as many as half the GPU's free memory holds.

0 lets SMAPpy choose: on an NVIDIA GPU as many frames as half its free memory holds, at 2.5 kB a pixel for a DECODE model (the network takes 1.8 kB a pixel on CUDA, 2.1 on an Apple GPU) and 5 kB for an optimised one (4.7 on an Apple GPU), up to 256; on a Mac's GPU at most 3 GB – it has no memory of its own and shares the computer's, and half of what macOS allows it put a Mac into swap, one frame a second; 8 on the CPU. Set a number if the GPU runs out of memory, or the computer slows down, with others using it. It changes the speed, never the localizations, beyond the last digits.

two channels – A model that reads a split camera's two channels (aligned channels): where they are, and the checks (docs/decode/gui-plan.md, step 3). Shown for such a model only.
   calibration
   two_channels.calibration
–The two-channel calibration the model was trained on, for its registration; empty: the one the model names, where it is on this computer.

The model file names the calibration it was trained on and its fingerprint; empty takes that file where it is. A copy elsewhere is fine; a different calibration is refused, since the registration is part of what the network learned.

   camera ROI at column (more)
   two_channels.roi_column
autoWhere the frames' first column lies on the chip; empty: the file's camera ROI (a file that names none: 0).
   row (more)
   two_channels.roi_row
autoWhere the frames' first row lies on the chip; empty: the file's.
channel move – How far a split camera's second channel moved on the chip since the beads, on top of their registration: the same part in every two-channel fitter and the DECODE training's prefit.
      move
      two_channels.move.move
measuredNone: the registration as it is; typed: moved by the rows and columns below; measured: from this movie, by the fit with x and y free per channel (Preview shows it; kept beside the movie).

A splitter moves between the bead calibration and the measurement, by a pixel or more: DECODE-Plex's Fig. 2a movie lies 5.8 rows from where its beads put the second channel. Left out, the network sees each molecule as two spots that do not pair. It finds many more, and the colour shares fall to 0 and 1. A move is a translation, which the network handles without new training.

typed takes the rows and columns below. measured measures it from the movie as Spline 3D 2C measures its own channel move: that fitter, with x and y free in each channel, on the model's own two-channel calibration, over blocks spread through the movie. The spline model made the registration the network was trained on, so its fit says where the second channel is; the network is not asked. The move is kept beside the movie, and Preview draws it before a long inference. With over time, the network reads each block of frames with the move at the block's middle frame. The move used, and how it was found, is in the run's text and in its file. measured is the default; where the move cannot be measured, the fit goes on with the registration as it is and says so. learn > affine adds a rotation, scale and shear of the map learnt from the same pairs (Spline 3D 2C's page says how); the network reads the turned map through its offset maps. The run's record keeps the transformation used (transformation_used), the correction composed with the map.

Choices: none; typed; measured
      moved by
      two_channels.move.rows
0 rowsHow far the second channel lies from where the registration puts it, along the chip's rows.
      and
      two_channels.move.columns
0 columnsThe same along the columns.
      over time
      two_channels.move.over_time
offA smooth curve over the frames instead of one move: for a splitter that drifts during the acquisition (the figure shows the drift either way).
      learn
      two_channels.move.learn
shiftShift: how far the second channel moved; affine: also how it turned, scaled and sheared, learnt from the same pairs (for a splitter turned since the beads). Choices: shift; affine
      blocks (more)
      two_channels.move.blocks
20Blocks of frames spread over the movie the move is measured on. at least 2
      frames a block (more)
      two_channels.move.block_frames
50Frames in each block. at least 5
   goodness of fit
   two_channels.goodness
offEach localization's neighbourhood against the fit drawn back, a column goodness (about 0 explained, a few and more not): finds false positives; about 0.1 s per 10 000 localizations on a GPU, 1 s on a CPU.

goodness is each localization's neighbourhood – 9 x 9 pixels in each channel – against every localization of the frame drawn back with the calibration, over the background the network itself estimated, pixel by pixel. A level for the whole frame would count an uneven background's light under a spot – a cell, an out-of-focus nucleus – against that spot. It is the Poisson deviance, scaled so that 0 is noise alone. Values of a few and more mark a neighbour the network missed or merged, or a false molecule. On simulated data it removed false positives better than the reported sigma did. Filter on it after the fit.

   bound from the fit
   two_channels.bound
offEach localization's CRLB from its own fitted values, crlb_x_nm and so on: a reported sigma far above it marks a position outlier; about 0.4 s per 10 000 on a GPU, 9 s on a CPU.

The bound computed from each localization's own fitted values (its photons, background, z), with the frames read: what a perfect fit of that molecule could reach. A reported sigma well above it marks a position outlier. On simulated data it found the outliers better than goodness did (plex-plan §16).

output
   save HDF5
   output.save
onWrite the table to a file as it is fitted.
   file
   output.path
–Filled from the source: <acquisition>_locs.hdf5 next to the folder the images are in.
   raw frames (more)
   output.raw_frames
50Camera frames kept with the table, in photons, after their average; 0: none.
   show image tags (more)
   output.show_tags
PIZStageImage 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 z
   finish.astigmatic_z
offZ from the widths of the elliptical Gaussian, before any drift correction so that it can correct z (Analysis/After fit/Astigmatic z).
z calibration
      calibration
      finish.astigmatic.calibration
from a fileA file from the PSF calibration window (elliptical Gaussian), or the curves typed. Choices: from a file; typed
      file
      finish.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 x
         finish.astigmatic.typed.sigma_x_nm
130 nms0: the narrowest the spot gets in x. at least 1 nm
         focus x
         finish.astigmatic.typed.focus_x_nm
300 nmThe z where x is narrowest; z = 0 is the round spot.
         depth x
         finish.astigmatic.typed.depth_x_nm
400 nmHow far from its focus the x width has grown by sqrt(2). at least 1 nm
         width y
         finish.astigmatic.typed.sigma_y_nm
130 nms0: the narrowest the spot gets in y. at least 1 nm
         focus y
         finish.astigmatic.typed.focus_y_nm
-300 nmThe z where y is narrowest.
         depth y
         finish.astigmatic.typed.depth_y_nm
400 nmHow far from its focus the y width has grown by sqrt(2). at least 1 nm
         A x (more)
         finish.astigmatic.typed.a_x
0Huang's cubic term in x.
         B x (more)
         finish.astigmatic.typed.b_x
0Huang's quartic term in x.
         A y (more)
         finish.astigmatic.typed.a_y
0Huang's cubic term in y.
         B y (more)
         finish.astigmatic.typed.b_y
0Huang's quartic term in y.
         z range
         finish.astigmatic.typed.z_range_nm
800 nm+- this: where the curves are trusted. at least 10 nm
      z scale
      finish.astigmatic.z_scale
1True z per apparent z: about 0.7-0.8 for an oil objective imaging in water, 1 for none. at least 0.01
   4Pi z
   finish.fourpi_z
onZ from the interference phase of a 4Pi fit, unwrapped by its envelope z (Analysis/After fit/4Pi z).
4Pi phase
      calibration
      finish.fourpi.slope
as fittedThe 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
      model
      finish.fourpi.path
–A 4Pi model (.h5): this program's or uiPSF v1's.
      time window
      finish.fourpi.window_frames
1000 framesThe cavity's phase is measured over this many frames. at least 10 frames
      smoothing
      finish.fourpi.smoothing
1 windowsAverage each window with its neighbours, this many in all. at least 1 windows
      refine period
      finish.fourpi.refine_period
offFind the fringe period that the data agree with best.
      z scale (more)
      finish.fourpi.z_scale
1True z per apparent z: 1 when sample and immersion index match. at least 0.01
   overlay channels
   finish.overlay
offMove 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 from
      finish.overlay_channels.source
transformation fileA saved registration, beads already fitted as two channels, or bead movies to fit. Choices: transformation file; fitted beads; bead movies
      file
      finish.overlay_channels.path
–A _2ct.h5 (Calibrate transform, or this plugin's), or a dual-colour bead calibration.
      fitted beads
      finish.overlay_channels.beads_table
–Bead localizations fitted with channels > read: two channels.
      bead movies
      finish.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.
         cutoff
         finish.overlay_channels.bead_fit.cutoff
1.7The detection threshold, in units of the filtered frame's noise (the fitters' dynamic cutoff). at least 0.1
         at most
         finish.overlay_channels.bead_fit.max_frames
autoFrames 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.
         layout
         finish.overlay_channels.channels.layout
the microscope'sHow 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 channel
         finish.overlay_channels.channels.main_channel
the microscope'sThe 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
autoThe 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.
         transformation
         finish.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 pxThe 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 pxThe width of the difference-of-Gaussians filter the vote is scored with. at least 0.1 px
         coarse matching
         finish.overlay_channels.registration.coarse_tolerance_px
20 pxFirst pass; must cover the rotation between the channels – 3 degrees over 512 px is 27 px. at least 0.1 px
         fine matching
         finish.overlay_channels.registration.fine_tolerance_px
1 pxSecond 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
onWiden 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
20Fewer pairs than this and the registration refuses. at least 4
         pairs used in the fit (more)
         finish.overlay_channels.registration.max_pairs
20000At 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 pxThe 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 pxThe 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 registration
      finish.overlay_channels.save
onWrite it beside the beads as <name>_2ct.h5 and use it again while the beads and these settings are unchanged.
   drift correction
   finish.drift
noneEstimate 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 windows
      finish.rcc.n_timepoints
20How many windows the acquisition is cut into: more follow faster drift, fewer are less noisy. at least 2
      pixel size
      finish.rcc.pixelsize_nm
15 nmThe pixel of the images that are correlated; about the localization precision. at least 1 nm
      z bin (more)
      finish.rcc.z_pixelsize_nm
5 nmThe bin width of the z histograms. at least 0.1 nm
      max drift
      finish.rcc.max_drift_nm
500 nmThe largest drift between any two windows that can be found. at least 1 nm
      peak fit half-width (more)
      finish.rcc.fit_window
3 pxThe 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 pxA wider field of view is folded back onto itself, to keep the correlation fast. at least 64 px
      correct z
      finish.rcc.use_z
autoAuto: if the table has z.
      merge blinks
      finish.rcc.group
onMerge the localizations of one blink into one before measuring.
      within (more)
      finish.rcc.group_dx_nm
autoHow close localizations in consecutive frames must be to be one blink; auto: the session's merge settings.
      dark frames (more)
      finish.rcc.group_dt
autoHow many dark frames a blink may skip; auto: the session's merge settings.
      tile (more)
      finish.rcc.tile_nm
200 nmThe 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
autoAuto: square tiles. at least 1 nm
      max axial drift (more)
      finish.rcc.axial_max_drift_nm
200 nmHow far from zero the axial correlation peak is looked for. at least 1 nm
      skip zero shift (more)
      finish.rcc.exclude_zero_lag
onLeave the zero-shift sample out of the axial peak search.
      error bar
      finish.rcc.split_half
onEstimate 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 estimatedThe 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
framesWhat window size counts; time-window fit only. Choices: frames; localizations; windows
      window size
      finish.comet.segmentation_var
500Frames or localizations per time window, or the number of windows; time-window fit only. at least 1
      max drift
      finish.comet.max_drift_nm
300 nmThe largest drift expected; also the radius within which localizations are paired. at least 1 nm
      target sigma
      finish.comet.target_sigma_nm
30 nmThe finest width of the overlap Gaussian, where refinement stops. at least 0.1 nm
      initial sigma (more)
      finish.comet.initial_sigma_nm
autoThe width the refinement starts from; auto: a third of max drift.
      smoothing (more)
      finish.comet.boxcar_width
1 windowsRunning mean over this many windows between refinement steps; 1 is none; time-window fit only. 1 to 1000 windows
      interpolation (more)
      finish.comet.interpolation
cubicThe 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
autoA 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-07Relative change of the cost at which the optimizer stops.
      approximate kernel (more)
      finish.comet.approximate_kernel
onSkip pairs more than 6 sigma apart; the spline fit always does.
      ftol coarse (more)
      finish.comet.optimizer_ftol_coarse
autoFtol for the steps above the target sigma; auto: ftol; time-window fit only.
      quality control (more)
      finish.comet.quality_control
offDiscard time windows whose fit does not beat no correction; needs fit spline off.
      min lift (more)
      finish.comet.min_lift
0How much a window's fit must improve its overlap over no correction to be kept.
      merge blinks
      finish.comet.group
onMerge the localizations of one blink into one before estimating.
      within (more)
      finish.comet.group_dx_nm
autoHow close localizations in consecutive frames must be to be merged; auto: the session's merge settings.
      dark frames (more)
      finish.comet.group_dt
autoHow many dark frames a blink may skip; auto: the session's merge settings.
      two stage (more)
      finish.comet.two_stage
offA grouped pass, then an ungrouped one within fine radius.
      fine radius (more)
      finish.comet.two_stage_radius_nm
30 nmThe max drift of the second, ungrouped pass.
      RCC first (more)
      finish.comet.rcc_prepass
offCorrelate 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
10The time windows RCC correlates. at least 2
      RCC max drift (more)
      finish.comet.rcc_prepass_max_drift_nm
autoAuto: RCC's own default.
      fit spline
      finish.comet.spline
onFit the drift as a smooth curve in time rather than one value per time window.
      knot spacing
      finish.comet.spline_knot_frames
2000 framesFrames between the spline's coefficients. at least 10 frames
      spline penalty (more)
      finish.comet.spline_penalty
0Extra penalty on the curve's bending; 0 is none.
      transformation
      finish.comet.transformation
shiftWhat 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
autoFrames between the transformation's spline coefficients; auto: the knot spacing. at least 10 frames
      transformation penalty (more)
      finish.comet.transformation_penalty
0Pulls the transformation towards none where the data say little; 0 is none.
      correct z
      finish.comet.use_z
autoAuto: if the table has z.
      precision weights
      finish.comet.precision_weights
onWiden 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 lateralThe 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 bar
      finish.comet.split_half
onEstimate 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 estimatedThe frame the drift is zero at; first or last frame for consecutive files. Choices: as estimated; first frame; last frame
   assign colours
   finish.assign_colors
onSplit the localizations by their photon ratio and write channel (Analysis/After fit/Assign colours).
colour assignment
      method
      finish.colors.mode
split at the minimaA cut in r, or a posterior per localization. Choices: split at the minima; probabilistic
      colours
      finish.colors.colors
2How many species the histogram of r holds. 1 to 6
      exclusion dr
      finish.colors.exclusion
0.05Minima: leave this much of r on either side of a boundary unassigned.
      sigma
      finish.colors.tolerance
3Probabilistic: 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 tails
      finish.colors.keep_tails
offProbabilistic: 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 crosstalk
      finish.colors.crosstalk
0.05Probabilistic: 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 spread
      finish.colors.spread
0Probabilistic: 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 errors
      finish.colors.use_errors
onTake the photon errors from the fit where the table has them; otherwise sqrt(photons).
      use abundances (more)
      finish.colors.use_prior
onProbabilistic: weight each species by how much of the sample sits under its mode.
      minimum photons (more)
      finish.colors.min_photons
0Localizations with fewer photons in total are ignored and left unassigned.
      intensity LUT (more)
      finish.colors.cmap
viridisThe colour map of the intensity plot's 2D histogram. Choices: viridis; cividis; turbo; magma; inferno; Greys; Greys_r
      histogram bins (more)
      finish.colors.bins
200How many bins the histogram of r has over its whole range, -1 to 1. 10 to 2000
      smoothing (more)
      finish.colors.smoothing
2 binsThe 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
autoThe 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
autoAuto: photons_ch0, or the first pair of per-channel attributes in the table.
      channel 2 attribute (more)
      finish.colors.channel2
autoThe attribute r counts negative; name both attributes or neither.
   then chain
   finish.chain
–A saved chain run last, on the finished table; empty: none.

Output

The table has the columns of every fitter – frame, x_nm, y_nm, z_nm, photons, background, their uncertainties x_err_nm, y_err_nm, xy_err_nm, z_err_nm, photons_err, background_err – and prob, the network's probability that the localization is a molecule. The uncertainties are the network's own estimate of its error, not a CRLB from a likelihood: they are right on average for data like the training's, and less so for data unlike it. On DECODE's example movie, a molecule localized in two consecutive frames moved between them by what the two uncertainties say, within 10 to 30 % at every size of uncertainty – where Spline 3D's CRLB was up to 2.5 times too small for the bright spots.

A two-channel model writes photons_ch0 and photons_ch1, each channel's photons (colour; their sum is photons; biplane gives one count, photons, the molecule's total over both planes), and background_ch0 and background_ch1; background is the main channel's. With its checks it adds goodness and crlb_x_nm, crlb_y_nm, crlb_z_nm. The move used, typed or measured, is in the run's file, and a measured one is also in the run's text.

An optimised model also writes x_err_mix_pix, y_err_mix_pix (pixels) and z_err_mix_nm: the uncertainty its probability maps imply, kept beside the reported one for comparison. The reported x_err_nm and so on are the ones to use.

No logl or iterations is written: nothing is fitted. The file records the model, the device, the threshold, whether the frames were flipped and the model's own metadata.

References