Camera noise calibration

Localize · version 1

measure each pixel's offset and read noise of an sCMOS from a dark movie, and keep it as the camera's noise map for fits with per-pixel noise

What it does

An sCMOS camera reads every pixel through its own amplifier. So every pixel has its own offset – the count it reports when no light falls on it – and its own read noise, the random scatter the electronics add to every reading. On a modern sCMOS most pixels read about 1 electron (e-) rms, but a percent or so are "hot" or random-telegraph pixels that jump between levels, with 5 to 30 e-. The fitters normally assume one offset and one read noise for the whole chip. A hot pixel next to a molecule then pulls the fit towards itself, and its Cramér-Rao bound (the precision a fit reports, xy_err_nm) claims more than the fit delivers.

This plugin measures each pixel's offset and read noise from a movie taken with the shutter closed, and keeps them as the camera's noise map. A fit with per-pixel noise on (in the fitter's fit part, under more) subtracts each pixel's own offset and weights each pixel by its own noise, as Huang et al. (2013) introduced for sCMOS cameras. The noisy pixels are then believed less, and the precision the fit reports is honest again.

What it needs: a dark movie. Close the shutter (or block the light path), and record 1000 to 2000 frames in the readout mode and binning of the data – the modes of an sCMOS (standard, ultra-quiet, the 12- and 16-bit ones) differ in noise as they do in offset. Record the whole chip, or at least every pixel the data will use: a map covers the camera ROI it was recorded with, and a file reaching outside it is refused. The exposure does not matter much: at tens of milliseconds the dark current is small beside the read noise. The map lasts as long as the camera does not change; record again after a firmware update or a change of the cooling.

When not to use it. An EMCCD amplifies before reading, so its read noise is a fraction of an electron and needs no map; the plugin refuses frames taken with EM gain. At bright backgrounds (tens of photons per pixel) the read noise is small beside the background's own noise and the map changes little. It matters most at low backgrounds – a dim TIRF sample, short exposures – and in samples with many molecules near hot pixels.

How it works

1. Each pixel's mean and variance. The dark frames are read in blocks, and for every pixel the plugin keeps a running mean and a running sum of squared deviations from it. The mean is the pixel's offset, in counts (ADU, the camera's analogue-to-digital units). The variance – the squared read noise – is that sum divided by the number of frames less one. One pass over the movie, however long, holding three images.

2. How well it is known. The variance of N frames is uncertain by a factor : 4.5 % at 1000 frames, 8 % at 300. That is plenty, because the variance only sets how much each pixel is trusted. Below 100 frames the plugin refuses, and below 1000 it warns.

The read noise of a simulated sCMOS measured from 1000 dark frames (filled) against the noise its pixels were simulated with (line): the bulk around 1 e- and the tail of hot pixels are both found.

3. The map, kept with the camera. The map is saved as a file, with where on the chip it was measured, and entered in the camera database as the noise map of the movie's camera and readout mode. It is kept in counts, not electrons, so that a conversion corrected later corrects the map too.

The measured offset (left) and read noise (right) over the simulated chip: the offsets scatter by a few counts, and the hot pixels stand out of an even field of read noise.

4. In the fit. With per-pixel noise on, a fit looks up the noise map of the file's camera and readout mode. It cuts out the part under the file's camera ROI and subtracts each pixel's own offset before detection. It then fits every spot with each pixel weighted by its own read noise. Off, nothing changes: the fit is the same as without a map.

Of the fits of isolated simulated spots (1000 photons, background 5 photons per pixel) with a pixel above 3 e- within two pixels, the fraction that lands farther than a distance from the truth: with the map (orange) fewer fits are pulled 10 to 25 nm off their spot.

In detail

The moments. Each block of frames gives every pixel a block mean and a sum of squared deviations . Two partial results of and frames combine exactly (Chan et al.'s pairwise form of Welford's algorithm), with :

in double precision, so no frame count loses digits to a sum of squares.

The likelihood. A pixel's count, in electrons, is a Poisson number of photoelectrons plus Gaussian read noise of variance . Huang et al.'s approximation adds to both the data and the model, and takes the sum as Poisson:

The variance is converted to the fit's units with the camera's conversion, for a read noise in counts and electrons per count. Without a map the fit uses the same form with one for the chip (the read noise of the camera), which the fitted background takes up; with a map the background stays the background, and is added pixel by pixel inside the fitter. Its information matrix, and so the Cramér-Rao bound, has in place of : a noisy pixel adds less, and the reported precision says so.

Where the map is cut. The map knows the chip pixels it covers, . A file is cut out at its camera ROI's corner. A file that records no ROI is taken to start where the map starts if it has the map's size, and at the chip's corner otherwise. A file reaching outside the map is refused with the pixels it covers, rather than read with another pixel's noise.

Left out on purpose. Gain per pixel: the gains of an sCMOS's pixels differ by 1 to 3 %, and measuring each to 1 % from a photon-transfer curve takes about 20 000 frames per intensity, so a quick calibration would add more error than it removes; the camera's one conversion is used. Dark current: small at the exposures of single-molecule imaging, so one dark movie stands for all of them. Detection: the offset map is subtracted before detection, but the candidates are not weighted by the noise, so a very hot pixel can still make a candidate; its fit is then weighted down.

Several channels. A split chip or a 4Pi camera is cut into its channels, each rectangle flipped where the optics mirror it, and the map is cut and flipped the same way, so that every channel's pixel keeps its own noise. A channel fitted on its own (two channels on Gaussian 2D or Spline 3D) reads its part of the map; a fit across channels (the 2C fitters, Spline 4Pi) weights each channel's pixels by their own noise inside the one fit. On a simulated split chip with 3 % hot pixels, the two-colour fit's median distance to the truth fell by about a sixth with the map.

Parameters

settingdefaultwhat it does
dark frames
path
–A movie with the shutter closed, in the readout mode and binning of the data: 1000 frames or more.

Record it in the readout mode and binning of the data, over at least the camera ROI the data will use; the whole chip serves every ROI.

first frame (more)
start
0Frames before this one are skipped.

For skipping the first frames of a camera that settles after it starts.

last frame (more)
stop
autoAuto: to the end.

Fewer frames make a less certain map: the variance is known to 4.5 % at 1000 frames and 8 % at 300.

at least 1
camera
camera
autoAuto: identified from the file's metadata.

Set it for a file whose metadata does not identify the camera. Its readout mode is still read from the file, and the map is entered for that mode.

enter in the camera database
enter
onThe map becomes this readout mode's noise map, which a fit with per-pixel noise reads.

Off, the map is only saved; give its file to the camera in the camera editor (noise map) to use it. On, the readout mode must already be in the camera database: add it in the camera editor first.

save as (more)
output
–Auto: the configuration folder's noise_maps, named by the camera, its readout mode and the day.

The default folder is the configuration folder's noise_maps; the date in the name keeps an older map, which older fits name, from being overwritten.

Output

The text gives the read noise's median, its root mean square and its 99th percentile, the worst pixel, the share of pixels above three times the median, and the offsets' median and spread – in electrons when the camera's conversion is known, else in counts. A good sCMOS reads a median of 0.7 to 1.5 e- and a percent or two above three times that. A median offset well above the camera's stated offset means the frames saw light, and the plugin warns.

The figures are the offset and read-noise maps and the read noise's histogram. A pattern in the offsets (columns, a gradient) is normal for an sCMOS; a pattern in the read noise beyond scattered hot pixels – a bright corner, stripes – means the frames were not dark or the camera was not settled.

The map is saved as an HDF5 file (offset_adu, variance_adu2, and the chip region, frame count, camera, readout mode and exposure as attributes). A fitted table records the map's file in its fit provenance (noise_map).

Differences from SMAP

Ported from SMAP's calibrateCMOS (Ries 2020), which computes the same mean and variance with Welford's algorithm, and its camera converter, which subtracts the offset map pixel by pixel and gives the variance map to the fitter. Two differences change what is fitted:

References