NMR and MRI physics · Intermediate

Spin echo sequence: 90-180 pulses and isochromat rephasing

Written by SignalsLab

Early edition: these lessons are being reviewed.

Content

Summary

A spin echo sequence uses a 90-degree excitation pulse followed by a 180-degree refocusing pulse to cancel dephasing caused by static field inhomogeneities. Isochromats that fan out after the 90 pulse are flipped by the 180 pulse and reconverge to form an echo at time TE. The echo amplitude decays with true T2 rather than T2*.

Intuition

After excitation, the spins in a voxel precess at slightly different frequencies because of static field variations, chemical shift and susceptibility. Each group of spins with the same frequency is an isochromat. They fan out in the transverse plane, and the signal disappears quickly (T2* decay). The phase each isochromat gains is fixed by its frequency, so it is reversible. The 180 pulse at TE/2 reflects every phase across an axis, so the fastest spin, which was furthest ahead, is now furthest behind. Because it still precesses faster, it catches up with the others, and at TE all the isochromats align. Think of runners with different speeds who turn around at the same moment and run back to the start line: they arrive together. Random, time-varying fluctuations from molecular interactions (true T2 processes) are not reversed, so the echo is smaller than the initial signal by exp(-TE/T2).

Key equations

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

Phase accumulated by isochromat i with off-resonance frequency Δω_i after the 90 pulse.

ϕi(TE)=ΔωiTE2−ΔωiTE2=0
(2)

The 180 pulse at TE/2 inverts the phase, so the net phase at TE is zero for every isochromat.

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

Echo amplitude depends on irreversible T2 decay only.

S=M0(1−e−TR/T1)e−TE/T2
(4)

Spin echo signal weighting by TR (T1 recovery) and TE (T2 decay).

Derivation

  1. Start with magnetization M0 along z. A 90∘ pulse about x tips it onto the y axis in the rotating frame.
  2. Isochromat i has offset Δω_i, so in the rotating frame its phase at time t is Δω_i t. The vector sum of many different phases shrinks, giving T2* decay.
  3. At t = TE/2, a 180 pulse about x maps phase φ to −φ for each isochromat.
  4. After the pulse each isochromat continues to gain phase at the same rate Δω_i, so at time t > TE/2 the phase is −Δω_i TE/2 + Δω_i (t − TE/2).
  5. At t = TE this equals zero for all i, independent of Δω_i, so the vectors realign and the echo forms.
  6. Irreversible random dephasing during 0 to TE is not inverted, so the echo magnitude is M0exp⁡(−TE/T2).

Worked example

Problem

Tissue has T2 = 80 ms and T2* = 30 ms. A spin echo uses TE = 60 ms. Compare the transverse signal at TE with and without the 180 pulse, as a fraction of the initial value, ignoring T1.

  1. Without refocusing, the signal decays with T2*: exp(−60/30) = exp(−2) = 0.135.
  2. With the 180 pulse at 30 ms, the echo at 60 ms decays with T2: exp(−60/80) = exp(−0.75) = 0.472.
  3. Ratio: 0.472 / 0.135 ≈ 3.5.

Answer The echo retains about 47% of the signal, versus about 14% without refocusing, roughly 3.5 times more.

Common mistakes

  • Thinking the 180 pulse reverses the precession direction; it flips the phases, while spins keep precessing the same way.
  • Believing spin echo removes all dephasing; true T2 losses from random fluctuations are not recovered.
  • Placing the 180 pulse at TE instead of TE/2, which puts the echo at 2TE rather than TE.
  • Confusing T2* with T2: T2* includes reversible field inhomogeneity, T2 does not.
  • Assuming diffusion through gradients is refocused; moving spins experience changing fields and lose signal.

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(96 lines)
from manim import *
import numpy as np
import sys
from blocks import *
from mri_blocks import *

# ---------- simulation (seconds, Hz) ----------
TE = 0.040          # echo time (s)
T_END = 0.050       # simulated window (s)
DT = 0.002          # fixed time step (s)
T1, T2 = 1.0, 0.100 # relaxation times (s)
N_ISO = 12
# deterministic stratified Lorentzian offsets (HWHM 10 Hz)
DFS = isochromat_offsets(N_ISO, 10.0, dist="lorentzian", seed=0)


def build_events():
    """90x - wait TE/2 - 180x - wait until T_END."""
    ev = [{"type": "rf", "flip": np.pi / 2}]
    ev += [{"type": "wait", "dt": DT}] * int(round(TE / 2 / DT))
    ev += [{"type": "rf", "flip": np.pi}]
    ev += [{"type": "wait", "dt": DT}] * int(round((T_END - TE / 2) / DT))
    return ev


def run_sim():
    """Return times (s), history (n,steps,3) and net transverse signal |<Mxy>|."""
    times, hist = bloch_simulate(build_events(), [0, 0, 1.0], T1, T2, DFS)
    mxy = hist[:, :, 0] + 1j * hist[:, :, 1]
    sig = np.abs(mxy.mean(axis=0))
    return times, hist, sig


TIMES, HIST, SIG = run_sim()


class Main(Scene):
    def construct(self):
        TitleCard(self, "Spin echo sequence", "90° - TE/2 - 180° - echo at TE")

        # --- timing diagram (ms units, t_max = 50 ms) ---
        psd = PulseSequenceDiagram(rows=("RF", "ADC"), t_max=50, width=11, height=2.3)
        psd.move_to([0, 1.65, 0])
        p90 = psd.add_rf(0, 3, kind="hard", amp=0.8, label="90°")
        p180 = psd.add_rf(18.5, 21.5, kind="hard", amp=1.0, label="180°", color=C_BAD)
        adc = psd.add_adc(32, 48)
        te = psd.add_marker(TE * 1000, "TE")
        cursor = psd.time_cursor()
        self.play(FadeIn(psd), run_time=0.8)
        self.play(FadeIn(p90), FadeIn(p180), FadeIn(adc), FadeIn(te), run_time=0.8)
        self.add(cursor)

        # --- isochromat fan (left) and signal plot (right) ---
        fan = IsochromatFan(n=N_ISO, radius=1.2).move_to([-3.6, -1.75, 0])
        plot = SignalPlot(x_range=(0, 50, 10), y_range=(0, 1, 0.5), x_label="t (ms)",
                          y_label="|Mxy|", width=5.5, height=2.1).move_to([2.8, -1.7, 0])
        self.play(FadeIn(fan), FadeIn(plot), run_time=0.8)
        StepCaption(self, "90° tips spins into the transverse plane")

        prev = None
        for k in range(1, len(TIMES)):
            t_ms = TIMES[k] * 1000
            M = HIST[:, k, :]
            ph = np.arctan2(M[:, 1], M[:, 0])
            ln = np.hypot(M[:, 0], M[:, 1])
            anims = fan.set_phases(ph, ln) + [psd.cursor_to(t_ms)]
            pt = plot.axes.c2p(t_ms, SIG[k])
            if prev is not None and TIMES[k] > TIMES[k - 1]:
                anims.append(Create(Line(prev, pt, color=C_ACCENT, stroke_width=3)))
            prev = pt
            self.play(*anims, run_time=0.28, rate_func=linear)
            if k == 1 + int(round(TE / 2 / DT)):
                StepCaption(self, "Off-resonance spins dephase; 180° mirrors their phases")
            if np.isclose(TIMES[k], TE) and TIMES[k] > TIMES[k - 1]:
                StepCaption(self, "Phases realign at TE: the echo")
                self.add(plot.dot_at(t_ms, SIG[k]))

        StepCaption(self, "Spin echo refocuses static dephasing; echo height decays only with T2")
        self.wait(1.2)


if __name__ == "__main__" and "--selftest" in sys.argv:
    i_te = int(np.where(np.isclose(TIMES, TE))[0][-1])
    i_half = int(np.where(np.isclose(TIMES, TE / 2))[0][0])
    # right after 90 pulse: full transverse signal
    assert np.isclose(SIG[1], 1.0, atol=1e-9)
    # dephased before the 180
    assert SIG[i_half] < 0.7 * np.exp(-TE / 2 / T2)
    # echo amplitude equals T2 decay exp(-TE/T2)
    assert np.isclose(SIG[i_te], np.exp(-TE / T2), atol=1e-6), SIG[i_te]
    # after removing T2 decay, echo is the maximum of the post-180 signal
    norm = SIG / np.exp(-TIMES / T2)
    post = norm[i_half + 1:]
    assert norm[i_te] >= post.max() - 1e-9
    assert norm[i_te] > norm[i_te - 1] and norm[i_te] > norm[i_te + 1]
    print("selftest 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.