Skip to content

Rework series, Tier B-04, convert our changes to transform2d as opt-in and keeping upstream version as default - #36

Open
Yashvi-Sharma wants to merge 3 commits into
mainfrom
rework/tb-04-transform2d-normalize
Open

Yashvi-Sharma wants to merge 3 commits into
mainfrom
rework/tb-04-transform2d-normalize

Conversation

@Yashvi-Sharma

Copy link
Copy Markdown
Collaborator

No description provided.

Yashvi-Sharma and others added 3 commits November 9, 2026 15:53
Transform2D.fit rescaled its inputs to [-1, 1] unconditionally. That changes
what .matrix means, so it cannot be the default for a fork that intends to
upstream it. It is now off by default and selected per trace via
fit_normalize, alongside the existing fit_degree, which is already the
established way to vary the fit for one instrument.

Measured, the rescaling is a safeguard for poorly scaled inputs rather than a
general improvement. On coordinates running 0..2048 it cuts the worst residual
by a factor of ~650 (5.8e-11 to 8.9e-14). On the centred focal-plane mm that
ScopeSim actually fits, both routes reach machine precision and the
unnormalized fit is if anything slightly better, so enabling it does not move
an existing trace.

Two existing tests were named for normalization but passed with or without it,
so they were not testing it. Both now state their mode explicitly, and new
tests cover the case where rescaling genuinely matters, the case where it is
immaterial, and that the chain-rule factor keeps gradients in input units.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant