Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions SimPEG/directives/directives.py
Original file line number Diff line number Diff line change
Expand Up @@ -1401,9 +1401,8 @@ def angleScale(self):

for reg, var in zip(self.reg.objfcts[1:], max_s):
for obj in reg.objfcts:
obj.add_set_weights(
{"angle_scale": np.ones(obj.shape[0]) * max_p / var}
)
# TODO Need to make weights_shapes a public method
obj.set_weights(angle_scale=np.ones(obj._weights_shapes[0]) * max_p / var)

def validate(self, directiveList):
# check if a linear preconditioner is in the list, if not warn else
Expand Down Expand Up @@ -1587,7 +1586,7 @@ def update(self):
for reg in self.reg.objfcts:
if not isinstance(reg, BaseSimilarityMeasure):
for sub_reg in reg.objfcts:
sub_reg.add_set_weights({"sensitivity": sub_reg.mapping * wr})
sub_reg.set_weights(sensitivity=sub_reg.mapping * wr)

def validate(self, directiveList):
# check if a beta estimator is in the list after setting the weights
Expand Down
6 changes: 1 addition & 5 deletions SimPEG/objective_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,6 @@ def __len__(self):
def __getitem__(self, key):
return self.multipliers[key], self.objfcts[key]

@property
def __len__(self):
return self.objfcts.__len__

@property
def multipliers(self):
return self._multipliers
Expand All @@ -312,7 +308,7 @@ def multipliers(self, value):

assert len(value) == len(self.objfcts), (
"the length of multipliers should be the same as the number of"
" objective functions ({}), not {}".format(len(self.objfcts, len(value)))
" objective functions ({}), not {}".format(len(self.objfcts), len(value))
)

self._multipliers = value
Expand Down
26 changes: 22 additions & 4 deletions SimPEG/regularization/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,36 @@ def __init__(self, mesh=None, **kwargs):

@deprecate_class(removal_version="0.x.0", future_warn=True)
class Simple(LeastSquaresRegularization):
def __init__(self, mesh=None, **kwargs):
super().__init__(mesh=mesh, **kwargs)
def __init__(self, mesh=None, alpha_x=1.0, alpha_y=1.0, alpha_z=1.0, **kwargs):
# These alphas are now refered to as length_scalse in the
# new LeastSquaresRegularization
super().__init__(
mesh=mesh,
length_scale_x=alpha_x,
length_scale_y=alpha_y,
length_scale_z=alpha_z,
**kwargs
)


@deprecate_class(removal_version="0.x.0", future_warn=True)
class Tikhonov(LeastSquaresRegularization):
pass
def __init__(
self, mesh=None, alpha_s=1e-6, alpha_x=1.0, alpha_y=1.0, alpha_z=1.0, **kwargs
):
super().__init__(
mesh=mesh,
alpha_s=alpha_s,
alpha_x=alpha_x,
alpha_y=alpha_y,
alpha_z=alpha_z,
**kwargs
)


@deprecate_class(removal_version="0.x.0", future_warn=True)
class PGIwithNonlinearRelationshipsSmallness(PGIsmallness):
def __init__(self, gmm):
def __init__(self, gmm, **kwargs):
super().__init__(gmm, non_linear_relationships=True, **kwargs)


Expand Down
Loading