vaft/process/magnetics.py offers two ways to get a toroidal mode number, and they disagree on its sign.
toroidal_mode_analysis divides the measured cross-spectral phase by the sensor separation with no sign:
n_raw = phase / float(phase_geometry)
toroidal_phase_fit_at_time, through _fit_wrapped_toroidal_n, fits a model that carries a minus:
fitted = _wrap_phase_radians(intercept - float(n_value) * toroidal_angle)
So for the same physical mode the two routines report n of opposite sign. Neither docstring stated a convention, so nothing flagged the disagreement, and a caller comparing a result from one against the other, or against a soft X-ray mode number from rank_toroidal_mode_numbers, silently compares a mode with its mirror image.
Decide which sense is canonical -- the natural choice is the one matching the machine's own toroidal angle direction and the rest of VAFT's sign chain -- make both agree, and state it. #418 documents the behaviour as it stands and points here.
Found while documenting the magnetics processing modules under the process documentation contract (#418). Filed rather than fixed, per that umbrella's rule that a convention applied inconsistently is a correctness bug with its own review.
🤖 Generated with Claude Code
vaft/process/magnetics.pyoffers two ways to get a toroidal mode number, and they disagree on its sign.toroidal_mode_analysisdivides the measured cross-spectral phase by the sensor separation with no sign:toroidal_phase_fit_at_time, through_fit_wrapped_toroidal_n, fits a model that carries a minus:So for the same physical mode the two routines report
nof opposite sign. Neither docstring stated a convention, so nothing flagged the disagreement, and a caller comparing a result from one against the other, or against a soft X-ray mode number fromrank_toroidal_mode_numbers, silently compares a mode with its mirror image.Decide which sense is canonical -- the natural choice is the one matching the machine's own toroidal angle direction and the rest of VAFT's sign chain -- make both agree, and state it. #418 documents the behaviour as it stands and points here.
Found while documenting the magnetics processing modules under the process documentation contract (#418). Filed rather than fixed, per that umbrella's rule that a convention applied inconsistently is a correctness bug with its own review.
🤖 Generated with Claude Code