-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: creating specific builder for folded foliations
This moves the fold constraint assembly and the splots from the geological model to a builder class that inherts from the GeologicalFeatureInterpolator The folding specific stuff can be removed from the base class FoldedFoliationBuilder has its own build, which does foldy stuff then runs base.build()
- Loading branch information
Lachlan Grose
committed
Sep 15, 2021
1 parent
a6b61fb
commit b40ba9a
Showing
4 changed files
with
96 additions
and
52 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
from ..features import GeologicalFeatureInterpolator | ||
|
||
class FoldedFeatureBuilder(GeologicalFeatureInterpolator): | ||
|
||
def __init__(self,interpolator,fold,fold_weights={},name='Feature',region=None,**kwargs): | ||
GeologicalFeatureInterpolator.__init__(self,interpolator,name=name,region=region,**kwargs) | ||
self.fold = fold | ||
self.fold_weights = fold_weights | ||
self.kwargs = kwargs | ||
|
||
|
||
def set_fold_axis(self): | ||
kwargs = self.kwargs | ||
fold_axis = kwargs.get('fold_axis',None) | ||
if fold_axis is not None: | ||
fold_axis = np.array(fold_axis) | ||
if len(fold_axis.shape) == 1: | ||
self.fold.fold_axis = fold_axis | ||
|
||
if "av_fold_axis" in kwargs: | ||
_calculate_average_intersection(series_builder, fold_frame, fold) | ||
if self.fold.fold_axis is None: | ||
far, fad = self.fold.fold_frame.calculate_fold_axis_rotation( | ||
self) | ||
fold_axis_rotation = FoldRotationAngle(far, fad,svario=svario) | ||
a_wl = kwargs.get("axis_wl", None) | ||
if 'axis_function' in kwargs: | ||
# allow predefined function to be used | ||
fold_axis_rotation.set_function(kwargs['axis_function']) | ||
else: | ||
fold_axis_rotation.fit_fourier_series(wl=a_wl) | ||
self.fold.fold_axis_rotation = fold_axis_rotation | ||
|
||
def set_fold_limb_rotation(self): | ||
kwargs = self.kwargs | ||
# give option of passing own fold limb rotation function | ||
flr, fld = self.fold.fold_frame.calculate_fold_limb_rotation( | ||
self, self.fold.get_fold_axis_orientation) | ||
fold_limb_rotation = FoldRotationAngle(flr, fld,svario=svario) | ||
l_wl = kwargs.get("limb_wl", None) | ||
if 'limb_function' in kwargs: | ||
# allow for predefined functions to be used | ||
fold_limb_rotation.set_function(kwargs['limb_function']) | ||
else: | ||
fold_limb_rotation.fit_fourier_series(wl=l_wl,**kwargs) | ||
fold.fold_limb_rotation = fold_limb_rotation | ||
|
||
def build(self, data_region=None, **kwargs): | ||
"""[summary] | ||
Parameters | ||
---------- | ||
data_region : [type], optional | ||
[description], by default None | ||
""" | ||
# add the data to the interpolator and force constraints to be | ||
# gradient not norm, to prevent issues with fold norm constraint | ||
# TODO folding norm constraint should be minimising the difference in norm | ||
# not setting the norm | ||
self.add_data_to_interpolator(constrained=True) | ||
self.set_fold_axis() | ||
self.set_fold_limb_rotation() | ||
logger.info("Adding fold to {}".format(self.name)) | ||
self.interpolator.fold = self.fold | ||
# if we have fold weights use those, otherwise just use default | ||
self.interpolator.add_fold_constraints(**self.fold_weights) | ||
if 'cgw' not in kwargs: | ||
# try adding very small cg | ||
kwargs['cgw'] = 0.0 | ||
# now the fold is set up run the standard interpolation | ||
GeologicalFeatureInterpolator.build(self,data_region=data_region,**kwargs) |