Skip to content

fix(builder): rotate data vectors through the faults in restore order - #428

Merged
lachlangrose merged 1 commit into
masterfrom
fix/rotate-vectors-in-restore-order
Nov 26, 2026
Merged

lachlangrose merged 1 commit into
masterfrom
fix/rotate-vectors-in-restore-order

Conversation

@lachlangrose

@lachlangrose lachlangrose commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Problem

Before a feature is interpolated, its builder rotates each data vector (normal, gradient, tangent) through its faults with FaultSegment.apply_to_vectors, which restores a small tetrahedron around each data point. It did this for every fault at the present-day position and without restored_through. A fault frame displaced by younger faults then restored the tetrahedron through its whole chain of cutting faults at each of its steps, so building a fault deep in a cutting chain cost about (chain length)² × steps fault applications.

Profile of building the deepest fault of a 5-deep chain: 9.6 s, of which 8.85 s in apply_to_vectors, 1661 fault calls (the youngest fault applied 664 times). In a 94-fault model the deeper faults took 12 s, 88 s, 418 s, 920 s each to build.

Fix

Rotate each vector by each fault at its position restored so far, youngest fault first (the order restore_through moves the points), and tell each fault which faults are already restored. The frame is then read at the restored position, without restoring it again.

  • Same build: 1.0 s, 12–14 fault calls per fault whatever its depth (linear in chain depth).
  • With one fault, the rotation is unchanged (same positions, no restored_through).
  • With several faults, a vector is rotated by an older fault where the younger faults have moved its point, which is more consistent with how the points are restored. On solved test models (2 and 4 faults, a cut pair) no unit id changes and the largest value change is 4.5e-4 on value ranges of several hundred.

Tests

  • tests/unit/modelling/test_fault_vector_rotation.py: building a frame in a 3-fault chain does not nest fault applications (depth 1; 2 before the fix); with one fault the builder passes the data positions and no restored_through (unchanged behaviour).
  • Full pytest tests: 2917 passed, 31 skipped. Ruff: no new findings.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XADRvHhG72666JkYNHtzUx

lachlangrose added a commit that referenced this pull request Nov 26, 2026
…nto feat/003-fault-evaluation-performance

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XADRvHhG72666JkYNHtzUx
Base automatically changed from fix/restore-cutting-faults-first to master November 26, 2026 22:23
The builder rotated each data vector (normal, gradient, tangent) by every
fault at its present-day position, with no restored_through. A fault frame
displaced by younger faults then restored the vector's tetrahedron through
its whole chain of cutting faults at each step, so building a fault deep in
a chain cost about (chain length)^2 x steps fault applications: the
deepest fault of a 5-deep chain made 1661 fault calls and took 9.6 s, and
deeper faults of a 94-fault model took up to 920 s each.

Each vector is now rotated by each fault at its position restored so far,
youngest fault first (the order restore_through uses), and each fault is
told which faults are already restored. The same build takes 1.0 s with
12-14 fault calls per fault. With one fault, or faults that do not move
each other's data, the rotation is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XADRvHhG72666JkYNHtzUx
@lachlangrose
lachlangrose force-pushed the fix/rotate-vectors-in-restore-order branch from 362d3f1 to 915adaf Compare November 26, 2026 22:28
@lachlangrose
lachlangrose merged commit e2ddab7 into master Nov 26, 2026
37 checks passed
@lachlangrose
lachlangrose deleted the fix/rotate-vectors-in-restore-order branch November 26, 2026 23:04
lachlangrose added a commit that referenced this pull request Nov 26, 2026
…o feat/003-fault-evaluation-performance

The branch already had the same fixes as merges of their PR branches.
Two conflicts: _fault_segment.py keeps the branch's placement of the #425
fallback (after the frame gradient of _evaluate_frame), and
test_cut_fault_step_direction.py keeps the branch's version that turns
the shared frame lookup off for the NaN-rule test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XADRvHhG72666JkYNHtzUx
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