# E04 · Coherence and what a camera averages

Connect interference, source bandwidth, source size, and speckle through one measurement: the time-averaged squared field.

<!-- course-motivation:start -->
## Why learn this?

**Why do fringes disappear when the optics stay put?**

An interference pattern can fade after a change in illumination or exposure even when neither path moves. A rough surface can also produce stable speckle. Interpreting these observations requires knowing which relationships between fields survive the camera's averaging.

**What you gain:** Diagnose changes in fringe visibility, distinguish a static random pattern from lost coherence, and decide when your imaging model should add fields, intensities, or coherent modes.
<!-- course-motivation:end -->

<!-- course-preparation:start -->
## Before this lesson

Use these focused refreshers if an idea is unfamiliar; you do not need to complete each linked course.

- **Complex amplitudes and phase:** Expand |u₁ + u₂|² and recognize complex-conjugate cross terms. Used here: The camera averages these interference terms during an exposure. [Review: MIT OCW · Complex Arithmetic and Exponentials](https://ocw.mit.edu/courses/18-03sc-differential-equations-fall-2011/pages/unit-i-first-order-differential-equations/complex-arithmetic-and-exponentials/). Read the notes on Euler's formula, polar form, multiplication, and complex conjugation. The differential-equation applications can wait.
- **Averages, variance, and correlation:** Distinguish averaging a product from multiplying averages, and independent from repeated samples. Used here: These distinctions govern fringe visibility and speckle contrast. [Review: MIT OCW · Probability readings, Classes 4, 6, and 7](https://ocw.mit.edu/courses/18-05-introduction-to-probability-and-statistics-spring-2022/pages/classes-reading-and-in-class-materials/). Read Class 4b on expectation, Class 6a on expectation and variance, and Class 7b on covariance and correlation. R exercises are not needed.

For the coherent-mode section and notebook extension, review eigenvectors and Hermitian matrices.
- [MIT OCW · Eigenvalues and Eigenvectors](https://ocw.mit.edu/courses/18-06sc-linear-algebra-fall-2011/pages/least-squares-determinants-and-eigenvalues/eigenvalues-and-eigenvectors/) — Start with the lecture summary and one 2 × 2 worked problem. Focus on Av = λv and what changes when a matrix is applied repeatedly.
- [MIT OCW · Lecture 26: Complex matrices; fast Fourier transform](https://ocw.mit.edu/courses/18-06-linear-algebra-spring-2010/resources/lecture-26-complex-matrices-fast-fourier-transform/) — Focus on complex vectors, conjugate transpose, Hermitian matrices, and unitary matrices. The FFT algorithm at the end is optional here.

**Python preparation:** Average arrays over a realization axis and compare standard deviation with mean intensity.
- [NumPy · The absolute basics for beginners](https://numpy.org/doc/stable/user/absolute_beginners.html) — Use the sections on array shape, indexing and slicing, basic operations, and broadcasting. Practice changing one parameter and rerunning a cell.

**Developed here:** Connect detector averaging to temporal coherence, spatial coherence, and speckle; then represent correlations with coherent modes.

[All prerequisites and learning resources](https://vandermode.github.io/optics-in-5-minutes-course/preparation/)
<!-- course-preparation:end -->

## Learning outcomes

- Explain intensity addition as a consequence of averaged cross terms.
- Distinguish temporal coherence, spatial coherence, and fixed spatial randomness.
- Use mutual intensity and coherent modes to propagate partially coherent light.

## Use the lesson

Watch the [E04 film](https://www.youtube.com/watch?v=8rnnqnpCpsg) (5:02), embedded near the top of the lesson.

Serve the complete teaching/ directory over HTTP. The lesson uses shared local assets and native JavaScript modules. Open this episode's folder in the browser. Its standalone notebook also works directly in Colab or Jupyter; it does not import repository code or require a GPU.

The notebook's core takes about 25–30 minutes to work through, with a separate optional extension. The first code cell installs numerical packages only when missing. Saved outputs, figures/, and figures.zip provide static figure access if a notebook frontend blocks rich output.

## Model and normalization

Stationary scalar, same-polarization fields; small-angle uniform angular source; Gaussian frequency spectrum. The product of temporal, spatial, and jitter correlations assumes separable independent effects. Speckle uses circular complex Gaussian fields filtered by a finite pupil.

Computed quantities are generated by model.js in the browser and the explicitly written NumPy/SciPy models in lab.py. Model-specific assertions and independent references are in the lab and the course checks. The browser and notebook use documented but not necessarily identical grid sizes. Synthetic randomness is seeded.

## Rebuild

From the repository root, run: python teaching/tools/build_course.py, then python teaching/tools/validate_notebooks.py. The authored page content and controls are in teaching/tools/curriculum.py; opening motivations are in teaching/tools/motivation.py; preparation is in teaching/tools/preparation.py; notebook source is this folder's percent-format lab.py. Building preserves saved outputs when code cells are unchanged. Run npm test --prefix teaching for numerical browser-model tests.

## References

- [MIT OpenCourseWare · Coherent and incoherent imaging](https://ocw.mit.edu/courses/2-71-optics-spring-2009/resources/lecture-22-coherent-and-incoherent-imaging/)
- [Singer & Vartanyants · Coherent-mode propagation](https://arxiv.org/abs/1108.6008)
- [Goodman · Statistical properties of laser speckle](https://opg.optica.org/josa/abstract.cfm?uri=josa-66-11-1145)
