Skip to content

srvf_mv_equalize_scale() runs after the Procrustes loop, never inside it #264

@fabian-s

Description

@fabian-s

Follow-up to #242. While investigating the SRVF warp rescaling, two reviewers independently confirmed: srvf_mv_equalize_scale() is called after the template-refinement loop concludes (R/register-mv.R:206-218, called from around :502). It then refreshes only best_template from the renormalized betan and returns.

Consequence: every intermediate template the loop converges against is built from un-equalized curves. For max_iter > 1 with scale = TRUE, the refinement is converging on the wrongly-scaled quantity; the post-loop equalize is essentially cosmetic for the returned object.

Possible fixes

  1. Equalize inside the loop, before each template update. Mathematically cleanest.
  2. Equalize in q-space rather than via mean arc length (the SRVF scale quotient normalizes q-norms, not curve arc length — the current heuristic is itself an approximation).
  3. If neither is practical, document precisely which fdasrvf version exhibits the bug, file the upstream issue, and reference both in the code comment.

Also: tf_scales() currently reports qmean_norm / len_q, which no longer describes the transformation actually applied to tf_aligned() after equalize-and-rescale — the object's components are mutually inconsistent.

Found during the June-2026 ground-up review and re-confirmed by two reviewers during the PR for #242. Listed as out-of-scope in that PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions