Skip to content

Read a scan's pattern center back from its strain - #34

Merged
CSSFrancis merged 1 commit into
docs/live-indexingfrom
feat/center-from-strain
Nov 13, 2026
Merged

CSSFrancis merged 1 commit into
docs/live-indexingfrom
feat/center-from-strain

Conversation

@CSSFrancis

Copy link
Copy Markdown
Member

Stacked on #33 (its Live strain docs section is extended here).

A pattern fitted at a center d too far shows the strain J d. J is the symmetric, trace-free part of the derivative of center_maps, worked out from the geometry with no pattern fitted; on the twin it matched finite differences of real fits to within 1%.

  • LiveIndexer.strain_per_center() / calibration.strain_per_center: J, (3, 3, 3).
  • calibration.centers_from_strain(strain, positions, fitted_at, response, *, use=None, drift=None, robust=True) → CenterPlane(center, drift, points, weights): each point's center from its strain, and a plane through them over the beam positions. Robust by default (Tukey's biweight from a least-median start, so a strained corner can't tilt it); use restricts it to a known unstrained region; drift fixes the drift from the geometry and fits only the offset.

Twin (duplex steel + indent, 480 µm, 16×16, indexed 0.010/−0.008/0.006 off): center at the middle within 3e-4, worst over the field 7e-4; re-indexed there the strain is within 6e-4 rms of each point at its true center (74e-4 at the wrong center). Subtracting a plane from the strain instead also took out the indent.

Tests: test_a_center_error_shows_as_the_strain_strain_per_center_predicts, test_a_scans_center_plane_is_read_back_from_its_strain. Ran ruff check, ruff format --check, tests/index/test_live.py and test_pattern_center.py (fused CUDA tests skipped: no CuPy in this env).

https://claude.ai/code/session_01DzXsKCmqfzn1vmniNccgXh

@CSSFrancis
CSSFrancis added this pull request to stack #36 November 13, 2026 16:41
A pattern fitted at a center d too far shows the strain J d, with J the
symmetric, trace-free part of the center maps' derivative (worked out from
the geometry). strain_per_center gives J; centers_from_strain reads each
point's center from its strain and fits a robust plane through them over
the beam positions, leaving out local real strain. Optionally the drift is
given from the geometry and only the offset fitted.

Claude-Session: https://claude.ai/code/session_01DzXsKCmqfzn1vmniNccgXh
@CSSFrancis
CSSFrancis force-pushed the feat/center-from-strain branch from ae16127 to 0dc74ed Compare November 13, 2026 16:43
@CSSFrancis
CSSFrancis merged commit c4722b6 into main Nov 13, 2026
3 checks passed
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