From c98b015079f981fbb912659720f50bd8fc850817 Mon Sep 17 00:00:00 2001 From: lachlangrose Date: Wed, 5 Aug 2026 16:22:26 +0930 Subject: [PATCH 1/2] fix: Updating intrusions code - Added a new method `_validate_intrusion_inputs` in `GeologicalModel` to validate inputs for intrusions, ensuring necessary data is present before processing. - Updated `_build_intrusion` to call the new validation method, improving error handling for missing data. - Refactored `IntrusionBuilder.create_geometry_using_geometric_scaling` to clarify that geometric scaling is not currently implemented, raising a `NotImplementedError` immediately. - Simplified threshold handling in `IntrusionFeature` by removing redundant checks for marginal faults. - Removed the unused `intrusion_support_functions.py` file to clean up the codebase. - Updated tests in `test_intrusions.py` to cover new validation logic, ensuring clear error messages for missing data and parameters. - Added regression tests for previously silent errors related to weight handling and geometric scaling. (cherry picked from commit 8cb80c17eb9e0cfdccb0f4719c81579effde6d4b) From 0370ed21415c1c53add43cf4c4e179a67cb3fd04 Mon Sep 17 00:00:00 2001 From: lachlangrose Date: Thu, 13 Aug 2026 14:43:58 +0930 Subject: [PATCH 2/2] fix: correct fault-proximity gradient retry loop and stop set_stratigraphic_column from wiping state evaluate_gradient's tetrahedron-refinement loop set resolved=True unconditionally after one pass, so it never actually retried after shrinking the tetrahedron near a fault. set_stratigraphic_column cleared the model's stratigraphic column before unconditionally raising DeprecationWarning, destroying existing state on every call. (cherry picked from commit 647fe5dffa8ce68246047b8a886af6ab57a88683) --- LoopStructural/modelling/core/geological_model.py | 9 ++++++--- LoopStructural/modelling/features/_geological_feature.py | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/LoopStructural/modelling/core/geological_model.py b/LoopStructural/modelling/core/geological_model.py index b9d4450e..74a9458f 100644 --- a/LoopStructural/modelling/core/geological_model.py +++ b/LoopStructural/modelling/core/geological_model.py @@ -5,6 +5,7 @@ import json import pathlib +import warnings import numpy as np import pandas as pd @@ -830,13 +831,15 @@ def set_stratigraphic_column(self, stratigraphic_column, cmap="tab20"): } """ + warnings.warn( + "set_stratigraphic_column is deprecated, use model.stratigraphic_column.add_units instead", + DeprecationWarning, + stacklevel=2, + ) self.stratigraphic_column.clear(basement=False) # if the colour for a unit hasn't been specified we can just sample from # a colour map e.g. tab20 logger.info("Adding stratigraphic column to model") - raise DeprecationWarning( - "set_stratigraphic_column is deprecated, use model.stratigraphic_column.add_units instead" - ) for i, g in enumerate(stratigraphic_column.keys()): if g == 'faults': logger.info('Not adding faults to stratigraphic column') diff --git a/LoopStructural/modelling/features/_geological_feature.py b/LoopStructural/modelling/features/_geological_feature.py index 7c47ac0c..4660591b 100644 --- a/LoopStructural/modelling/features/_geological_feature.py +++ b/LoopStructural/modelling/features/_geological_feature.py @@ -202,6 +202,7 @@ def evaluate_gradient( tetrahedron = regular_tetraherdron_for_points(pos, element_scale_parameter) while not resolved: + resolved = True for f in self.faults: v = ( f[0] @@ -215,8 +216,7 @@ def evaluate_gradient( ) element_scale_parameter *= 0.5 tetrahedron = regular_tetraherdron_for_points(pos, element_scale_parameter) - - resolved = True + resolved = False tetrahedron_faulted = self._apply_faults(np.array(tetrahedron.reshape(-1, 3))).reshape( tetrahedron.shape