NMR and MRI physics · Intermediate

Spin echo: dephasing and rephasing

Written by SignalsLab

Early edition: these lessons are being reviewed.

Content

Summary

After a 90-degree pulse, spins in slightly different magnetic fields precess at different rates and lose phase coherence, so the signal decays with T2*. A 180-degree pulse at time TE/2 flips the phases so that static field inhomogeneity effects reverse, and the spins refocus into an echo at time TE. The echo amplitude is reduced only by true T2 decay, which is irreversible.

Intuition

Picture runners on a circular track, each running at a slightly different constant speed. At the starting gun (the 90-degree pulse) they are together. They spread out, and the group's average position, the net signal, shrinks. Now at time tau a whistle makes everyone turn around and run back at the same speed as before. The fast runners are furthest ahead, but they now have the furthest to return, so all arrive back at the start at time 2tau together. This is the echo. Fixed differences in speed, caused by static field inhomogeneity or susceptibility, are undone. Random changes in speed, caused by molecular motion and spin-spin interactions, are not undone, so the echo is smaller than the original signal by exp(-TE/T2).

Key equations

ϕi(t)=Δωit
(1)

Phase accumulated by spin i with frequency offset Delta omega_i after the 90-degree pulse.

ϕi(τ+)=−Δωiτ
(2)

The 180-degree pulse at t = tau inverts the phase sign.

ϕi(t)=Δωi(t−2τ)
(3)

Phase after the refocusing pulse; it is zero for every spin at t = 2 tau = TE.

S(TE)=S0e−TE/T2
(4)

Echo amplitude depends only on irreversible T2 decay.

1T2∗=1T2+γΔB0
(5)

The free decay rate combines true T2 relaxation with the dephasing from static field inhomogeneity.

Derivation

  1. Right after the 90-degree pulse all spins lie along one transverse direction, with phase zero.
  2. During 0 to tau, spin i gains phase Delta omega_i times t, where Delta omega_i is its offset from the reference frequency.
  3. At t = tau, a 180-degree pulse about an axis in the transverse plane reverses the sign of each phase: phi becomes minus Delta omega_i tau.
  4. After the pulse, spin i keeps precessing at the same Delta omega_i, so phi(t) = -Delta omega_i tau + Delta omega_i (t - tau).
  5. This simplifies to Delta omega_i (t - 2 tau), which is zero for all spins at t = 2 tau, independent of Delta omega_i.
  6. At that moment the spins are in phase and the signal peaks. Only random, time-varying field fluctuations remain uncorrected, giving the exp(-TE/T2) envelope.

Worked example

Problem

A tissue has T2 = 80 ms and T2* = 20 ms. A spin echo sequence uses TE = 60 ms. Compare the fraction of initial transverse signal remaining at TE for a spin echo and for a free induction decay.

  1. Spin echo: S/S0=exp⁡(−TE/T2)=exp⁡(−60/80)=exp⁡(−0.75).
  2. exp(-0.75) is about 0.47.
  3. Free decay at 60 ms: S/S0=exp⁡(−60/20)=exp⁡(−3).
  4. exp(-3) is about 0.05.
  5. Ratio: 0.47 / 0.05 is about 9.5.

Answer The spin echo retains about 47 percent of the signal, versus about 5 percent for free decay, roughly nine to ten times more.

Common mistakes

  • Thinking the 180-degree pulse reverses the direction of precession; it flips the phases, and spins keep precessing the same way.
  • Believing the echo recovers all signal; T2 losses from random fluctuations are not refocused.
  • Confusing the echo time TE with the pulse spacing; the 180 pulse is at TE/2.
  • Mixing up T2 and T2*; T2* is always shorter and includes static inhomogeneity.
  • Assuming the refocusing works for spins that diffuse through varying fields; those lose phase irreversibly.

Animation

Animation coming soon

The animated version of this lesson is being prepared for the web. In the Signals AI app, lessons are drawn step by step.

Code

scene.py(94 lines)
import sys
import numpy as np
from manim import *
from blocks import *

# Simulation: isochromats with fixed off-resonance frequencies.
# Phase = w*t before the 180 pulse at TE/2; after it phase -> -phase, then grows again.
N = 7
TE = 2.0
DT = 0.02
FREQS = np.linspace(-1.0, 1.0, N) * 2.0 * np.pi * 0.75  # rad/s, fixed


def simulate():
    """Return times, phases (steps x N), and net magnitude |mean(e^{i phi})|."""
    ts = np.arange(0, TE + DT / 2, DT)
    phi = np.zeros(N)
    phases, mags = [], []
    flipped = False
    for t in ts:
        if (not flipped) and t >= TE / 2 - 1e-9:
            phi = -phi  # 180 degree pulse inverts phases
            flipped = True
        phases.append(phi.copy())
        mags.append(abs(np.mean(np.exp(1j * phi))))
        phi = phi + FREQS * DT
    return ts, np.array(phases), np.array(mags)


TS, PH, MAG = simulate()


class Main(Scene):
    def construct(self):
        TitleCard(self, "Spin echo", "dephasing and rephasing")
        # circle with isochromat arrows (left)
        center = LEFT * 3.8 + DOWN * 0.1
        R = 1.8
        ring = Circle(radius=R, color=C_DIM).move_to(center)
        idx = [0, 20, 40, 50, 60, 80, 100]  # sampled frames
        idx = list(range(0, len(TS), 5))
        cols = color_gradient([C_BAD, C_ACCENT, C_GOOD, C_MAIN], N)

        def arrows(k):
            g = VGroup()
            for i in range(N):
                a = PH[k, i]
                v = R * np.array([np.cos(a), np.sin(a), 0])
                g.add(Arrow(center, center + v, buff=0, color=cols[i],
                            stroke_width=4, max_tip_length_to_length_ratio=0.2))
            return g

        # signal plot (right)
        plot_axes = Axes(x_range=[0, TE, 0.5], y_range=[0, 1.1, 0.5],
                         x_length=5.5, y_length=3.2,
                         axis_config={"color": C_DIM, "include_tip": False})
        plot_axes.move_to(RIGHT * 3.3 + DOWN * 0.1)
        xl = Text("time", font_size=24).next_to(plot_axes, DOWN, buff=0.15)
        yl = Text("|M|", font_size=24).next_to(plot_axes, UP, buff=0.1).shift(LEFT * 2)
        self.play(Create(ring), Create(plot_axes), FadeIn(xl), FadeIn(yl))

        cur = arrows(0)
        self.add(cur)
        StepCaption(self, "Spins fan out: dephasing")
        half = len(TS) // 2
        pts = [plot_axes.c2p(TS[0], MAG[0])]
        trace = VMobject(color=C_ACCENT)
        self.add(trace)
        pulse_shown = False
        for k in idx[1:]:
            pts_k = [plot_axes.c2p(TS[j], MAG[j]) for j in range(0, k + 1, 1)]
            new_trace = VMobject(color=C_ACCENT, stroke_width=4).set_points_as_corners(pts_k)
            new_arrows = arrows(k)
            self.play(Transform(cur, new_arrows), Transform(trace, new_trace),
                      run_time=0.12, rate_func=linear)
            if (not pulse_shown) and k >= half - 2:
                pulse_shown = True
                lab = Text("180° pulse", font_size=26, color=C_BAD).next_to(ring, UP, buff=0.2)
                self.play(FadeIn(lab), run_time=0.4)
                StepCaption(self, "180° pulse flips phases; spins refocus")
        echo = Text("Echo at TE", font_size=26, color=C_GOOD).next_to(plot_axes, UP, buff=0.5).shift(RIGHT * 1.2)
        self.play(FadeIn(echo))
        StepCaption(self, "Static field errors cancel: the signal echoes at TE")
        self.wait(1)


if __name__ == "__main__" and "--selftest" in sys.argv:
    assert abs(MAG[0] - 1.0) < 1e-9
    mid = int(round((TE / 2) / DT))
    assert MAG[mid - 1] < 0.6
    assert MAG[-1] > 0.99, MAG[-1]
    assert MAG[mid] < 0.6
    assert np.all(np.abs(PH[-1]) < 0.2)
    print("ok")

The Manim scene code that draws this lesson's animation in the Signals AI app (Python, Manim Community).

ccBYNC© 2026 SignalsLab. Lesson text shared as is under CC BY-NC 4.0.