Skip to content

Commit

Permalink
fix: adding exception if fold frame hasn't
Browse files Browse the repository at this point in the history
computed before tying to use it
  • Loading branch information
Lachlan Grose committed Sep 21, 2021
1 parent a114a68 commit 59a9d66
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 6 additions & 2 deletions LoopStructural/modelling/fold/fold_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from . import FoldRotationAngle
import numpy as np

from LoopStructural.utils import getLogger
from LoopStructural.utils import getLogger, InterpolatorError
logger = getLogger(__name__)

def _calculate_average_intersection(feature_builder, fold_frame, fold,
Expand Down Expand Up @@ -45,6 +45,8 @@ def set_fold_axis(self):
l2 = self.fold.fold_frame.calculate_intersection_lineation(self)
self.fold.fold_axis = np.mean(l2, axis=0)
if self.fold.fold_axis is None:
if self.fold.foldframe[1].is_valid() == False:
raise InterpolatorError("Fold frame direction coordinate is not valid")
far, fad = self.fold.foldframe.calculate_fold_axis_rotation(
self)
fold_axis_rotation = FoldRotationAngle(far, fad,svario=self.svario)
Expand All @@ -69,6 +71,7 @@ def set_fold_limb_rotation(self):
# 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)
self.fold.fold_limb_rotation = fold_limb_rotation

Expand All @@ -85,7 +88,8 @@ def build(self, data_region=None, **kwargs):
# TODO folding norm constraint should be minimising the difference in norm
# not setting the norm
self.add_data_to_interpolator(constrained=True)

if self.fold.foldframe[0].is_valid() == False:
raise InterpolatorError("Fold frame main coordinate is not valid")
self.set_fold_axis()
self.set_fold_limb_rotation()
logger.info("Adding fold to {}".format(self.name))
Expand Down
1 change: 0 additions & 1 deletion LoopStructural/modelling/fold/svariogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ def calc_semivariogram(self, lag = None, nlag = None, lags = None):
# find number of steps to cover range in data
nstep = int(
np.ceil((np.nanmax(self.xdata) - np.nanmin(self.xdata)) / step))
print(nstep,step)
self.lags = np.arange(step / 2., nstep * step, step)
logger.info("Using average minimum nearest neighbour distance "
"as lag distance size {} and using {} lags".format(step,nstep))
Expand Down

0 comments on commit 59a9d66

Please sign in to comment.