Repository navigation
fix(features): fold rotation angles, fault gradients near faults, fault_pitch, faultfunction setter - #421
Open
lachlangrose wants to merge 8 commits into
Open
fix(features): fold rotation angles, fault gradients near faults, fault_pitch, faultfunction setter#421lachlangrose wants to merge 8 commits into
lachlangrose wants to merge 8 commits into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…er 10 halvings A point that stays on the fault gets a NaN gradient. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rccos, document fault_pitch A point on a younger fault now has a NaN gradient of that fault. An older fault's apply_to_points added that NaN to the point, so the restored point became NaN. Do not move points with a non-finite gradient. Clip the cosine of the fold axis rotation angle to [-1, 1], so rounding does not give NaN. Say in the fault_pitch docstring that pitch is measured from strike and that 90 is the down-dip slip vector. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
test_zero_gradient_protection_remains_effective pins that a NaN gradient gives a NaN point. The model-level block evaluation already handles points on a younger fault, so keep that contract. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes five fold and fault problems found in a repo audit. Each has a regression test that fails without the fix.
arccoswithout being normalised. A true angle of 30° came out as 20.7° with a 45° limb, and 9.85° with a 70° limb. It is now normalised, as the limb function already was, and the cosine is clipped to [-1, 1] so rounding cannot give NaN.logical_orwhere it neededlogical_and.curve_fitraised, the error was swallowed, and the profile kept its initial guess.LinAlgError(or looped forever when gx was exactly 0). Now only the tetrahedra that straddle a fault shrink, with at most 10 halvings. Points still straddling after that get a NaN gradient, because the field jumps there. On a 52k-point faulted model this is faster (4.8 s against 6.3 s), and more accurate away from the fault, because before, one near-fault point shrank every tetrahedron.apply_to_points: points on a younger fault are not moved, instead of becoming NaN. On master, the same call hung.fault_pitchalways crashed. The code rotated the normal about itself. Pitch is now the angle in the fault plane from strike, so 90 is the down-dip slip vector (a reverse fault with positive displacement). The docstring says this. A horizontal fault plane with a pitch raises a clearValueError.faultfunctionsetter rejected plain functions and accepted any object. It is now oneif/elifchain: named profiles, any callable, otherwiseValueError.Overlap with #391: #391 changes the line just after the refinement loop in
_geological_feature.py(_apply_faultsto_restore_points). Expect a small text conflict there: keep this loop and use #391's call. The logic does not conflict.Behaviour change: points within about step/10/1024 of a fault get a NaN gradient. The fold rotation-angle and constraint callers already drop NaN rows.
Tests: 43 passed in the fold/fault unit tests (including the new file and test_fault_block_fields). 75 passed in tests/integration/test_fold_models.py, tests/unit/validation/test_fold_frame_coordinate1.py and test_fault_frame_analytic.py. The review also ran 534 passing fold/fault tests. Reviewed by a second agent: no regressions. Its medium finding and two nits are fixed in the last commit.
Not changed (already on master):
TrigoFoldRotationAngleProfile.fitalways fails, with a missing-argument error.🤖 Generated with Claude Code