Skip to content

The two toroidal mode-number entry points use opposite sign conventions for n #638

Description

@HongSik-Yun-Fusion

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions