---
title: "Guided-wave lab: resonator modes, fibers, etalons and gratings"
heading: Listing a curved-mirror resonator's longitudinal and transverse mode frequencies, characterizing step-index fibers, measuring a Fabry–Pérot resonator's finesse from its transmission, and computing a Bragg grating's reflectance layer by layer with transfer matrices
eyebrow: S13 · Lesson 20 · Guided-wave lab
xp: 60
---

::: hook
Lessons 16 to 19 rested on formulas derived under approximations, like coupled-mode theory's $\tanh^2\kappa L$, and on mode spectra that are easier to list than to picture. In this lab you'll list a resonator's mode frequencies, transverse modes included, characterize fibers from their geometry, measure a resonator's finesse the way an experimenter would, and build a Bragg grating as thousands of thin layers, then check that the transfer-matrix result agrees with coupled-mode theory.
:::

::: play
- The curves are the two sides of the even-mode condition for a symmetric slab, $\tan u$ and $\sqrt{V^2 - u^2}/u$, against u, for the V on the slider; each crossing is a guided even TE mode.
- At V = 4.915 (lesson 16's 10 µm slab at 1550 nm) there are two even crossings, at u = 1.303 and 3.822.
- Below V = π/2 only one mode exists in total: the single-mode condition.
:::

```sim plot
view: graph
x: u = 0.01..6
y: f = 0..8
slider: V = 1..6 = 4.915
plot: tan(u)*step(tan(u)) | label: tan u
plot: sqrt(abs(V^2 - u^2))/u*step(V - u) | dashed | label: √(V² − u²)/u
```

::: predict
## A Bragg grating is modeled as 1000 periods of alternating layers whose indices differ by 2δ = 7.85 × 10⁻⁵ around 1.447. Coupled-mode theory with κ = 4δ/λ predicts a peak reflectance of 0.294%. What does an exact layer-by-layer calculation give?

- [ ] About ten times more
- [x] The same, to many digits
- [ ] Half as much
- [ ] Zero, since such a weak grating reflects nothing

::: reveal
The transfer-matrix product of 2000 layers gives 0.29403%, matching $\tanh^2(2N\delta/n)$ to about one part in a billion: for weak gratings coupled-mode theory is essentially exact. The 4δ/λ comes from a square wave of amplitude δ, whose fundamental Fourier component has amplitude 4δ/π.
:::
:::

::: nameit
## What the lab computes

- **Resonator modes**: a cavity of length d between mirrors with $g_i = 1 - d/R_i$ has modes at $\nu_{qmn} = q\nu_F + (m + n + 1)\frac{\nu_F}{\pi}\cos^{-1}(\pm\sqrt{g_1g_2})$, $\nu_F = c/2d$, with the sign of the g's.
- **Fibers**: $V = (2\pi/\lambda)a\,\text{NA}$, cutoff $\lambda_c = 2\pi a\,\text{NA}/2.405$, and Marcuse's mode field fit.
- **Fabry–Pérot**: $T = 1/(1 + (2\mathcal F/\pi)^2\sin^2(\pi\nu/\nu_F))$; the exact half-maximum points give a finesse $\pi/(2\sin^{-1}[(1 - R)/(2\sqrt R)])$, close to $\pi\sqrt R/(1 - R)$ for high R.
- **Transfer matrices**: a layer of index n and thickness d has the characteristic matrix $\begin{bmatrix}\cos\delta & j\sin\delta/n \\ jn\sin\delta & \cos\delta\end{bmatrix}$ with δ = 2πnd/λ. Multiplying all of them and terminating with the exit medium gives the reflection coefficient exactly, for any stack.
:::

::: check
kind: python

## Write `mode_frequencies(d, R1, R2, fmin, fmax, maxorder)`: a sorted list of (frequency, q, m + n) for all modes of a two-mirror resonator (length d, mirror radii R1 and R2, concave positive) with m + n from 0 to maxorder and frequencies in [fmin, fmax].

```python starter
def mode_frequencies(d, R1, R2, fmin, fmax, maxorder):
    return []
```

```python solution
import math

C = 299792458.0

def mode_frequencies(d, R1, R2, fmin, fmax, maxorder):
    nuF = C / (2 * d)
    g1, g2 = 1 - d / R1, 1 - d / R2
    root = math.sqrt(g1 * g2)
    shift = math.acos(root if g1 >= 0 else -root) / math.pi
    out = []
    q = max(0, int(fmin / nuF) - maxorder - 2)
    while q * nuF <= fmax:
        for s in range(maxorder + 1):
            f = nuF * (q + (s + 1) * shift)
            if fmin <= f <= fmax:
                out.append((f, q, s))
        q += 1
    return sorted(out)
```

```python tests
modes = mode_frequencies(0.1, 0.2, 0.2, 473.0e12, 473.01e12, 3)
gaps = sorted({round(b[0] - a[0]) for a, b in zip(modes, modes[1:])} - {0})
assert abs(gaps[0] - 1498962290 / 3) < 1, "g = 0.5 mirrors: transverse modes ν_F/3 = 500 MHz apart."
assert len(modes) > len({round(m[0]) for m in modes}), "Some higher transverse modes land exactly on other longitudinal modes."
conf = mode_frequencies(0.1, 0.1, 0.1, 473.0e12, 473.01e12, 3)
assert all(abs(((f / 749481145) + 1e-9) % 1) < 1e-6 or abs(((f / 749481145) + 1e-9) % 1 - 1) < 1e-6 for f, _, _ in conf), "Confocal: every mode lands on a grid of ν_F/2."
```

::: right
Right. Degenerate spectra like the confocal one are why mode-matching a beam into a cavity matters: otherwise several transverse modes resonate together.
:::
:::

::: check
kind: python

## Write `fiber(a_um, NA, lam_um)` returning (V, cutoff wavelength in µm, mode field diameter in µm by Marcuse's fit, or None if the fiber is multimode).

```python starter
def fiber(a_um, NA, lam_um):
    return 0.0, 0.0, None
```

```python solution
import math

def fiber(a_um, NA, lam_um):
    V = 2 * math.pi / lam_um * a_um * NA
    lc = 2 * math.pi * a_um * NA / 2.405
    if V >= 2.405:
        return V, lc, None
    w = a_um * (0.65 + 1.619 / V ** 1.5 + 2.879 / V ** 6)
    return V, lc, 2 * w
```

```python tests
V, lc, mfd = fiber(4.1, 0.12, 1.55)
assert abs(V - 1.994) < 0.001 and abs(mfd - 10.42) < 0.02, "Standard fiber at 1550 nm: V 1.99, 10.4 µm."
assert abs(lc - 1.2854) < 0.001, "Cutoff at 1285 nm."
assert fiber(4.1, 0.12, 0.85)[2] is None, "At 850 nm it's multimode."
```

::: right
Right. The mode spreads further into the cladding as V falls, which is why the mode field grows at longer wavelengths.
:::
:::

::: check
kind: python

## Write `fp_transmission(R, x)` for a lossless Fabry–Pérot with mirror reflectance R at normalized frequency x = ν/ν_F, and `measured_finesse(R)`: find the full width at half maximum of the resonance at x = 0 by bisection, and return 1 over it.

```python starter
def fp_transmission(R, x):
    return 1.0

def measured_finesse(R):
    return 1.0
```

```python solution
import math

def fp_transmission(R, x):
    F = math.pi * math.sqrt(R) / (1 - R)
    return 1 / (1 + (2 * F / math.pi) ** 2 * math.sin(math.pi * x) ** 2)

def measured_finesse(R):
    lo, hi = 0.0, 0.5
    for _ in range(100):
        m = (lo + hi) / 2
        if fp_transmission(R, m) > 0.5:
            lo = m
        else:
            hi = m
    return 1 / (2 * (lo + hi) / 2)
```

```python tests
import math
f = measured_finesse(0.99)
assert abs(f - math.pi / (2 * math.asin(0.01 / (2 * math.sqrt(0.99))))) < 1e-6, "Exactly π/(2 asin((1 − R)/2√R))."
assert abs(f - 312.6) < 0.1, "Close to π√R/(1 − R) = 312.6 at R = 0.99."
assert measured_finesse(0.5) < math.pi * math.sqrt(0.5) / 0.5, "At low R the simple formula overestimates."
```

::: right
Right. The simple finesse formula assumes narrow resonances; at low reflectance the exact width is larger.
:::
:::

::: check
kind: python

## Write `stack_reflectance(layers, lam, n0, ns)` by characteristic matrices for a list of (index, thickness) layers between an entrance medium n0 and exit medium ns, and `bragg_grating(n, delta, N, lam)`: the reflectance at λ of N periods, each two half-period layers of n + δ and n − δ, with period λ/(2n), embedded in index n.

```python starter
def stack_reflectance(layers, lam, n0, ns):
    return 0.0

def bragg_grating(n, delta, N, lam):
    return 0.0
```

```python solution
import math

def stack_reflectance(layers, lam, n0, ns):
    m = [[1, 0], [0, 1]]
    for n, d in layers:
        dl = 2 * math.pi * n * d / lam
        a = [[math.cos(dl), 1j * math.sin(dl) / n], [1j * n * math.sin(dl), math.cos(dl)]]
        m = [[m[0][0] * a[0][0] + m[0][1] * a[1][0], m[0][0] * a[0][1] + m[0][1] * a[1][1]],
             [m[1][0] * a[0][0] + m[1][1] * a[1][0], m[1][0] * a[0][1] + m[1][1] * a[1][1]]]
    B = m[0][0] + m[0][1] * ns
    C = m[1][0] + m[1][1] * ns
    r = (n0 * B - C) / (n0 * B + C)
    return abs(r) ** 2

def bragg_grating(n, delta, N, lam):
    L = lam / (2 * n)
    layers = []
    for _ in range(N):
        layers.append((n + delta, L / 2))
        layers.append((n - delta, L / 2))
    return stack_reflectance(layers, lam, n, n)
```

```python tests
import math
R = bragg_grating(1.447, 0.5e-4 * math.pi / 4, 1000, 1550e-9)
assert abs(R - math.tanh(2 * 1000 * 0.5e-4 * math.pi / 4 / 1.447) ** 2) < 1e-9, "Coupled-mode theory: tanh²(2Nδ/n)."
R2 = stack_reflectance([(2.35, 1064e-9 / (4 * 2.35)), (1.46, 1064e-9 / (4 * 1.46))] * 4, 1064e-9, 1.0, 1.52)
assert abs(R2 - 0.943) < 0.001, "Lesson 21's four-pair TiO₂/SiO₂ mirror: 94.3%."
```

::: right
Right. The same matrix product handles antireflection coatings, mirrors, filters and gratings alike.
:::
:::

::: explain
## Why do a fiber Bragg grating and a dielectric mirror obey essentially the same mathematics?

::: model
Both are periodic variations of refractive index along the direction of propagation, and both reflect strongly at the wavelength where reflections from successive periods add in phase: twice the optical thickness of one period. A mirror uses a large index contrast and a few dozen layers, so each interface reflects strongly and the band is wide; a fiber grating uses a contrast thousands of times smaller and thousands of periods, so each reflects faintly but they add over millimeters, giving a narrow band. The transfer-matrix product describes both exactly, and coupled-mode theory is its approximation for small contrast.
:::
:::
