Skip to main content

unwrap_near

Function unwrap_near 

Source
fn unwrap_near(ang: f64, prev: f64) -> f64
Expand description

Put ang on the 2π-branch nearest prev.

Every phase here reaches us through atan2, which folds onto (−π, π]. That fold is not harmless: a compartment accumulates (2/3)·χ·γ·B0·TE radians, so at |χ_total| > π / ((2/3)·γ·B0·TE_max) — 0.09 ppm at 7 T with a 28 ms last echo, i.e. inside the globus pallidus — the late echoes fold back and the alternating fit chases the fold into a degenerate fixed point (χ− pinned at its bound, R2*₀ and the amplitudes driven to zero, χ+ stuck at 0). Walking the echoes in order and keeping each phase on the branch nearest its predecessor restores the monotone ramp the model assumes.

The first echo is left on its principal branch: it anchors the series, and at any sane TE₁ its phase is well inside (−π, π] for |χ| ≤ chi_bound.