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
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,14 @@
"value": "",
"tooltip": "Rotate the gradient of the regularization to align with a provided structural orientation.\nThe data should be provided as a data group in the form of either strike & dip, dip direction & dip, or x/y/z components."
},
"reference_model_in_smooth": {
"group": "Regularization",
"label": "Reference model in smoothness",
"value": false,
"verbose": 3,
"visible": true,
"tooltip": "Whether to subtract the reference model before computing the smoothness terms (x, y and z). \nThis is useful for preserving sharp contrasts from a reference model"
},
"s_norm": {
"association": "Cell",
"dataType": [
Expand Down
8 changes: 8 additions & 0 deletions simpeg_drivers-assets/uijson/borehole_tdem_inversion.ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,14 @@
"tooltip": "Rotate the gradient of the regularization to align with a provided structural orientation.\nThe data should be provided as a data group in the form of either strike & dip, dip direction & dip, or x/y/z components.",
"enabled": false
},
"reference_model_in_smooth": {
"group": "Regularization",
"label": "Reference model in smoothness",
"value": false,
"verbose": 3,
"visible": true,
"tooltip": "Whether to subtract the reference model before computing the smoothness terms (x, y and z). \nThis is useful for preserving sharp contrasts from a reference model"
},
"s_norm": {
"association": "Cell",
"dataType": "Float",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,14 @@
"tooltip": "Rotate the gradient of the regularization to align with a provided structural orientation.\nThe data should be provided as a data group in the form of either strike & dip, dip direction & dip, or x/y/z components.",
"value": ""
},
"reference_model_in_smooth": {
"group": "Regularization",
"label": "Reference model in smoothness",
"value": false,
"verbose": 3,
"visible": true,
"tooltip": "Whether to subtract the reference model before computing the smoothness terms (x, y and z). \nThis is useful for preserving sharp contrasts from a reference model"
},
"s_norm": {
"association": "Cell",
"dataType": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,14 @@
"tooltip": "Rotate the gradient of the regularization to align with a provided structural orientation.\nThe data should be provided as a data group in the form of either strike & dip, dip direction & dip, or x/y/z components.",
"value": ""
},
"reference_model_in_smooth": {
"group": "Regularization",
"label": "Reference model in smoothness",
"value": false,
"verbose": 3,
"visible": true,
"tooltip": "Whether to subtract the reference model before computing the smoothness terms (x, y and z). \nThis is useful for preserving sharp contrasts from a reference model"
},
"s_norm": {
"association": "Cell",
"dataType": [
Expand Down
8 changes: 8 additions & 0 deletions simpeg_drivers-assets/uijson/fdem1d_inversion.ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,14 @@
"property": "",
"enabled": true
},
"reference_model_in_smooth": {
"group": "Regularization",
"label": "Reference model in smoothness",
"value": false,
"verbose": 3,
"visible": true,
"tooltip": "Whether to subtract the reference model before computing the smoothness terms (x, y and z). \nThis is useful for preserving sharp contrasts from a reference model"
},
"gradient_rotation": "",
"s_norm": {
"association": "Cell",
Expand Down
8 changes: 8 additions & 0 deletions simpeg_drivers-assets/uijson/fdem_inversion.ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,14 @@
"tooltip": "Rotate the gradient of the regularization to align with a provided structural orientation.\nThe data should be provided as a data group in the form of either strike & dip, dip direction & dip, or x/y/z components.",
"value": ""
},
"reference_model_in_smooth": {
"group": "Regularization",
"label": "Reference model in smoothness",
"value": false,
"verbose": 3,
"visible": true,
"tooltip": "Whether to subtract the reference model before computing the smoothness terms (x, y and z). \nThis is useful for preserving sharp contrasts from a reference model"
},
"s_norm": {
"association": "Cell",
"dataType": [
Expand Down
8 changes: 8 additions & 0 deletions simpeg_drivers-assets/uijson/gravity_inversion.ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,14 @@
"tooltip": "Rotate the gradient of the regularization to align with a provided structural orientation.\nThe data should be provided as a data group in the form of either strike & dip, dip direction & dip, or x/y/z components.",
"value": ""
},
"reference_model_in_smooth": {
"group": "Regularization",
"label": "Reference model in smoothness",
"value": false,
"verbose": 3,
"visible": true,
"tooltip": "Whether to subtract the reference model before computing the smoothness terms (x, y and z). \nThis is useful for preserving sharp contrasts from a reference model"
},
"s_norm": {
"association": "Cell",
"dataType": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,14 @@
"tooltip": "Rotate the gradient of the regularization to align with a provided structural orientation.\nThe data should be provided as a data group in the form of either strike & dip, dip direction & dip, or x/y/z components.",
"value": ""
},
"reference_model_in_smooth": {
"group": "Regularization",
"label": "Reference model in smoothness",
"value": false,
"verbose": 3,
"visible": true,
"tooltip": "Whether to subtract the reference model before computing the smoothness terms (x, y and z). \nThis is useful for preserving sharp contrasts from a reference model"
},
"s_norm": {
"association": "Cell",
"dataType": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,14 @@
"tooltip": "Rotate the gradient of the regularization to align with a provided structural orientation.\nThe data should be provided as a data group in the form of either strike & dip, dip direction & dip, or x/y/z components.",
"value": ""
},
"reference_model_in_smooth": {
"group": "Regularization",
"label": "Reference model in smoothness",
"value": false,
"verbose": 3,
"visible": true,
"tooltip": "Whether to subtract the reference model before computing the smoothness terms (x, y and z). \nThis is useful for preserving sharp contrasts from a reference model"
},
"s_norm": {
"association": "Cell",
"dataType": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,14 @@
"tooltip": "Rotate the gradient of the regularization to align with a provided structural orientation.\nThe data should be provided as a data group in the form of either strike & dip, dip direction & dip, or x/y/z components.",
"value": ""
},
"reference_model_in_smooth": {
"group": "Regularization",
"label": "Reference model in smoothness",
"value": false,
"verbose": 3,
"visible": true,
"tooltip": "Whether to subtract the reference model before computing the smoothness terms (x, y and z). \nThis is useful for preserving sharp contrasts from a reference model"
},
"s_norm": {
"min": 0.0,
"max": 2.0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,14 @@
"tooltip": "Rotate the gradient of the regularization to align with a provided structural orientation.\nThe data should be provided as a data group in the form of either strike & dip, dip direction & dip, or x/y/z components.",
"value": ""
},
"reference_model_in_smooth": {
"group": "Regularization",
"label": "Reference model in smoothness",
"value": false,
"verbose": 3,
"visible": true,
"tooltip": "Whether to subtract the reference model before computing the smoothness terms (x, y and z). \nThis is useful for preserving sharp contrasts from a reference model"
},
"s_norm": {
"min": 0.0,
"max": 2.0,
Expand Down
8 changes: 8 additions & 0 deletions simpeg_drivers-assets/uijson/joint_surveys_inversion.ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,14 @@
"tooltip": "Rotate the gradient of the regularization to align with a provided structural orientation.\nThe data should be provided as a data group in the form of either strike & dip, dip direction & dip, or x/y/z components.",
"value": ""
},
"reference_model_in_smooth": {
"group": "Regularization",
"label": "Reference model in smoothness",
"value": false,
"verbose": 3,
"visible": true,
"tooltip": "Whether to subtract the reference model before computing the smoothness terms (x, y and z). \nThis is useful for preserving sharp contrasts from a reference model"
},
"s_norm": {
"association": "Cell",
"dataType": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,14 @@
"tooltip": "Rotate the gradient of the regularization to align with a provided structural orientation.\nThe data should be provided as a data group in the form of either strike & dip, dip direction & dip, or x/y/z components.",
"value": ""
},
"reference_model_in_smooth": {
"group": "Regularization",
"label": "Reference model in smoothness",
"value": false,
"verbose": 3,
"visible": true,
"tooltip": "Whether to subtract the reference model before computing the smoothness terms (x, y and z). \nThis is useful for preserving sharp contrasts from a reference model"
},
"s_norm": {
"association": "Cell",
"dataType": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,14 @@
"parent": "mesh",
"value": ""
},
"reference_model_in_smooth": {
"group": "Regularization",
"label": "Reference model in smoothness",
"value": false,
"verbose": 3,
"visible": true,
"tooltip": "Whether to subtract the reference model before computing the smoothness terms (x, y and z). \nThis is useful for preserving sharp contrasts from a reference model"
},
"s_norm": {
"association": "Cell",
"dataType": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,14 @@
"tooltip": "Rotate the gradient of the regularization to align with a provided structural orientation.\nThe data should be provided as a data group in the form of either strike & dip, dip direction & dip, or x/y/z components.",
"value": ""
},
"reference_model_in_smooth": {
"group": "Regularization",
"label": "Reference model in smoothness",
"value": false,
"verbose": 3,
"visible": true,
"tooltip": "Whether to subtract the reference model before computing the smoothness terms (x, y and z). \nThis is useful for preserving sharp contrasts from a reference model"
},
"s_norm": {
"association": "Cell",
"dataType": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,14 @@
"tooltip": "Rotate the gradient of the regularization to align with a provided structural orientation.\nThe data should be provided as a data group in the form of either strike & dip, dip direction & dip, or x/y/z components.",
"value": ""
},
"reference_model_in_smooth": {
"group": "Regularization",
"label": "Reference model in smoothness",
"value": false,
"verbose": 3,
"visible": true,
"tooltip": "Whether to subtract the reference model before computing the smoothness terms (x, y and z). \nThis is useful for preserving sharp contrasts from a reference model"
},
"s_norm": {
"association": "Cell",
"dataType": [
Expand Down
8 changes: 8 additions & 0 deletions simpeg_drivers-assets/uijson/tdem1d_inversion.ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,14 @@
"property": "",
"enabled": true
},
"reference_model_in_smooth": {
"group": "Regularization",
"label": "Reference model in smoothness",
"value": false,
"verbose": 3,
"visible": true,
"tooltip": "Whether to subtract the reference model before computing the smoothness terms (x, y and z). \nThis is useful for preserving sharp contrasts from a reference model"
},
"gradient_rotation": "",
"s_norm": {
"association": "Cell",
Expand Down
8 changes: 8 additions & 0 deletions simpeg_drivers-assets/uijson/tdem_inversion.ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,14 @@
"tooltip": "Rotate the gradient of the regularization to align with a provided structural orientation.\nThe data should be provided as a data group in the form of either strike & dip, dip direction & dip, or x/y/z components.",
"enabled": false
},
"reference_model_in_smooth": {
"group": "Regularization",
"label": "Reference model in smoothness",
"value": false,
"verbose": 3,
"visible": true,
"tooltip": "Whether to subtract the reference model before computing the smoothness terms (x, y and z). \nThis is useful for preserving sharp contrasts from a reference model"
},
"s_norm": {
"association": "Cell",
"dataType": [
Expand Down
8 changes: 8 additions & 0 deletions simpeg_drivers-assets/uijson/tipper_inversion.ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,14 @@
"tooltip": "Rotate the gradient of the regularization to align with a provided structural orientation.\nThe data should be provided as a data group in the form of either strike & dip, dip direction & dip, or x/y/z components.",
"value": ""
},
"reference_model_in_smooth": {
"group": "Regularization",
"label": "Reference model in smoothness",
"value": false,
"verbose": 3,
"visible": true,
"tooltip": "Whether to subtract the reference model before computing the smoothness terms (x, y and z). \nThis is useful for preserving sharp contrasts from a reference model"
},
"s_norm": {
"association": "Cell",
"dataType": [
Expand Down
1 change: 1 addition & 0 deletions simpeg_drivers/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,7 @@ def get_regularization(self):
active_cells=self.models.active_cells if forward_mesh is None else None,
mapping=mapping,
reference_model=self.models.reference_model,
reference_model_in_smooth=self.params.reference_model_in_smooth,
)

functions = self.get_modified_regularization(
Expand Down
26 changes: 25 additions & 1 deletion simpeg_drivers/joint/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,23 @@ def n_values(self):

return self._n_values

@property
def params(self) -> BaseJointOptions:
"""Application parameters."""
return self._params

@params.setter
def params(
self,
val: BaseJointOptions,
):
if not isinstance(
val,
BaseJointOptions,
):
raise TypeError("Parameters must be of type 'BaseJointOptions'.")
self._params = val

def simpeg_run(self):
"""Run inversion from params"""
self.initialize()
Expand Down Expand Up @@ -559,7 +576,14 @@ def _overload_regularization(self, regularization: ComboObjectiveFunction):
for driver in self.drivers:
reg_block = []
for mapping in driver.mapping:
reg_block.append(reg_dict[self._mapping[driver, mapping]])
reg = reg_dict[self._mapping[driver, mapping]]
reference_model_in_smooth = driver.params.reference_model_in_smooth

if "reference_model_in_smooth" in self.params.model_fields_set:
reference_model_in_smooth = self.params.reference_model_in_smooth

reg.reference_model_in_smooth = reference_model_in_smooth
reg_block.append(reg)

driver.regularization = ComboObjectiveFunction(objfcts=reg_block)

Expand Down
5 changes: 5 additions & 0 deletions simpeg_drivers/joint/joint_cross_gradient/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ def get_regularization(self):
for mapping in driver.mapping:
self._mapping[driver, mapping] = mapping

if "reference_model_in_smooth" in self.params.model_fields_set:
driver.params.reference_model_in_smooth = (
self.params.reference_model_in_smooth
)
Comment thread
domfournier marked this conversation as resolved.

for multiplier, objfct in driver.regularization:
multipliers.append(multiplier)
reg_list.append(objfct)
Expand Down
2 changes: 2 additions & 0 deletions simpeg_drivers/joint/joint_surveys/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def get_regularization(self):
driver._inversion_mesh = self.inversion_mesh # pylint: disable=protected-access
driver._n_values = self.models.n_active # pylint: disable=protected-access
driver.mapping = self.mapping

driver.params.reference_model_in_smooth = self.params.reference_model_in_smooth
return driver.get_regularization()

def validate_create_models(self):
Expand Down
1 change: 1 addition & 0 deletions simpeg_drivers/joint/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class BaseJointOptions(CoreOptions):
group_c: SimPEGGroup | None = None
group_c_multiplier: float | None = None

reference_model_in_smooth: bool = False
irls: IRLSOptions = IRLSOptions()
directives: DirectiveOptions = DirectiveOptions()
cooling_schedule: CoolingSceduleOptions = CoolingSceduleOptions()
Expand Down
3 changes: 2 additions & 1 deletion simpeg_drivers/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ class BaseInversionOptions(CoreOptions):
:param conda_environment: Name of the conda environment used to run the program
:param data_object: Data object containing the survey data.
:param models: Model options for the inversion.
:param regularization: Options specific to the regularization function.
:param reference_model_in_smooth: Whether to include the reference model in the smoothness term of the regularization.
:param irls: Options specific to the IRLS (Iteratively Reweighted Least Squares) directive.
:param directives: Additional directives to be used in the inversion.
:param cooling_schedule: Options controlling the trade-off schedule between data misfit and model regularization.
Expand All @@ -580,6 +580,7 @@ class BaseInversionOptions(CoreOptions):

data_object: Points
models: ModelOptions
reference_model_in_smooth: bool = False
irls: IRLSOptions = IRLSOptions()
directives: DirectiveOptions = DirectiveOptions()
cooling_schedule: CoolingSceduleOptions = CoolingSceduleOptions()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def get_regularization(self):
active_cells=self.models.active_cells,
mapping=mapping,
reference_model=self.models.reference_model,
reference_model_in_smooth=self.params.reference_model_in_smooth,
Comment thread
domfournier marked this conversation as resolved.
)

functions = self.get_modified_regularization(
Expand Down
Loading
Loading