Skip to content

Commit

Permalink
fix: gradient norm used for folds when fold
Browse files Browse the repository at this point in the history
normalisation is 0
  • Loading branch information
Lachlan Grose committed Dec 3, 2021
1 parent 61842f0 commit 36f9cff
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion LoopStructural/modelling/fold/fold_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def set_fold_limb_rotation(self):
fold_limb_rotation.fit_fourier_series(wl=l_wl, **kwargs)
self.fold.fold_limb_rotation = fold_limb_rotation

def build(self, data_region=None, constrained=True, **kwargs):
def build(self, data_region=None, constrained=None, **kwargs):
"""[summary]
Parameters
Expand All @@ -88,6 +88,14 @@ def build(self, data_region=None, constrained=True, **kwargs):
# 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

# Use norm constraints if the fold normalisation weight is 0.
if constrained is None:
if "fold_normalisation" in kwargs:
if kwargs["fold_normalisation"] == 0.0:
constrained = False
else:
constrained = True
self.add_data_to_interpolator(constrained=constrained)
if self.fold.foldframe[0].is_valid() == False:
raise InterpolatorError("Fold frame main coordinate is not valid")
Expand Down

0 comments on commit 36f9cff

Please sign in to comment.