Skip to content

Commit bc0004a

Browse files
committed
fix: intrusion builder uses basebuilder
1 parent 02a4d70 commit bc0004a

File tree

1 file changed

+5
-56
lines changed

1 file changed

+5
-56
lines changed

LoopStructural/modelling/intrusions/intrusion_builder.py

Lines changed: 5 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@
1010
from ...modelling.intrusions.intrusion_support_functions import (
1111
grid_from_array,
1212
)
13+
from .builders import BaseBuilder
1314

1415
from .geometric_scaling_functions import *
1516

1617
logger = getLogger(__name__)
1718

1819

19-
class IntrusionBuilder:
20+
class IntrusionBuilder(BaseBuilder):
2021
def __init__(
2122
self, frame, model=None, name="intrusion builder", interpolator=None, **kwargs
2223
):
@@ -30,9 +31,8 @@ def __init__(
3031
3132
"""
3233

33-
# BaseBuilder.__init__(self, name = name)
34+
BaseBuilder.__init__(self, name=name)
3435

35-
self.name = name
3636
self.intrusion_frame = frame
3737
self._up_to_date = False
3838
self.model = model
@@ -73,32 +73,6 @@ def __init__(
7373

7474
self.marginal_faults = self._feature.intrusion_frame.builder.marginal_faults
7575

76-
@property
77-
def feature(self):
78-
return self._feature
79-
80-
@property
81-
def build_arguments(self):
82-
return self._build_arguments
83-
84-
@build_arguments.setter
85-
def build_arguments(self, arguments):
86-
"""Set the build arguments and flag that
87-
up to date is False
88-
89-
Parameters
90-
----------
91-
arguments : dictionary
92-
dictionary containing keys for variogram arguments
93-
"""
94-
if type(arguments) == dict:
95-
self._up_to_date = False
96-
self._build_arguments = arguments
97-
else:
98-
logger.error(
99-
f"Cannot update build arguments with {type(arguments)}, must be a dictionary"
100-
)
101-
10276
def create_grid_for_evaluation(self, spacing=None):
10377
"""
10478
Create the grid points in which to simulate vertical and lateral
@@ -132,6 +106,7 @@ def create_grid_for_evaluation(self, spacing=None):
132106

133107
def set_data_for_extent_calculation(self, intrusion_data):
134108
"""Set data for lateral extent (distances in c2 axis) and vertical extent (distances in c0 axis) simulation.
109+
creates a copy of the data
135110
136111
Parameters
137112
----------
@@ -752,7 +727,7 @@ def build(
752727
# if self.intrusion_extent_calculation == 'SGS':
753728

754729
# lateral_extent_sgs_parameters = parameters_for_extent_sgs.get('lateral_extent_sgs_parameters', {})
755-
# vertical_extent_sgs_parameters = parameters_for_extent_sgs.get('vertical_extent_sgs_parameters', {})
730+
# vertical_extent_sgs_parameters = parameters_for_extent_sgs.get('vertical_extent_sgs_parameters', {})
756731
# self.set_l_sgs_GSLIBparameters(lateral_extent_sgs_parameters)
757732
# self.set_g_sgs_GSLIBparameters(vertical_extent_sgs_parameters)
758733
# self.make_l_sgs_variogram()
@@ -763,29 +738,3 @@ def build(
763738
# elif self.intrusion_extent_calculation == 'interpolated':
764739
self.set_data_for_lateral_thresholds()
765740
self.set_data_for_vertical_thresholds()
766-
def update(self):
767-
self.build(**self.build_arguments)
768-
self._up_to_date = True
769-
770-
def up_to_date(self, callback=None):
771-
"""
772-
check if the feature is uptodate
773-
if its not update.
774-
775-
Parameters
776-
----------
777-
callback : function
778-
a function that is called when the feature is updated
779-
780-
"""
781-
782-
# for f in self.ts:
783-
# f.builder.up_to_date(callback=callback)
784-
# has anything changed in the builder since we built the feature? if so update
785-
if self._up_to_date == False:
786-
self.update()
787-
if callable(callback):
788-
callback(1)
789-
return
790-
if callable(callback):
791-
callback(1)

0 commit comments

Comments
 (0)