← back to the tutorial

Fitting in 2D

The words of this tutorial, step by step. The text lives in src/smappy/tutorial/topics/; the directions it follows are in src/smappy/tutorial/STYLE.md.

The pipeline

1. card: Fitting in 2D

What each part of a fitter does, and what to check.

The acquisition is simulated.

spoken: This tutorial goes through fitting step by step, in 2D. 3D has a tutorial of its own.

2. card: What a fitter does

It converts the camera's counts to photons, finds candidate spots, fits a model of the PSF to each, and writes a table of localizations.

spoken: A fitter converts the camera's counts to photons, finds the spots, fits each one, and writes the table.

The microscope

3. The acquisition goes into source. A Micro-Manager or NDTiff file also tells SMAPpy which microscope and camera took it.

4. The microscope section starts folded: its title says which microscope and camera, and the pixel size.

5. Open, it lists the microscope, the camera and the numbers the fit uses. A tooltip says where each number comes from.

6. The numbers are locked: the lock opens them for typing, so that overriding the file is a decision.

7. This file has no camera information, so the values are typed in. A typed value is marked, and kept with the fitter's settings.

8. A wrong conversion still fits well but gives wrong photon counts, so check it once per camera.

Finding the spots

9. Detection smooths each frame and keeps the peaks above a cutoff. The dynamic cutoff is in units of the noise, so it follows the background.

10. Too low a cutoff, and noise is taken for molecules.

11. At the default, the molecules are found and the noise is left alone. Preview is the place to decide this, before a long fit.

The model

12. Gaussian 2D fits the position, photons, background and the width of each spot. Elliptical fits a width in x and one in y.

13. The fit box is the square fitted around each spot: large enough for the spot, small enough not to catch a neighbour.

Fit and check

14. Run.

15. Fit quality is how well the model fits. A spot that is not a single molecule fits badly, and the default filter drops the worst.

16. PSF is the fitted width. Two molecules fitted as one come out too wide; for a 2D fit, the default filter drops them too.

After fitting

17. Before measuring, correct the drift: after the fit, at the foot of the fitter, runs RCC or COMET when the fit ends. Run these now does it later. Filtering and merging blinks are in the rendering tutorial.

Next

18. card: What to remember

- Camera: check its numbers once.
- Detection: set the cutoff with Preview.
- Model: Gaussian 2D; for 3D, Spline 3D with a bead calibration.
- After the fit: the default filters drop the bad localizations; correct the drift before measuring.

spoken: That is fitting in 2D. Next: fitting in 3D, with a measured PSF.