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 @@ -105,7 +105,7 @@
"model_type": {
"choiceList": [
"Conductivity (S/m)",
"Resistivity (ohm-m)"
"Resistivity (Ohm-m)"
],
"main": true,
"group": "Mesh and models",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
"model_type": {
"choiceList": [
"Conductivity (S/m)",
"Resistivity (ohm-m)"
"Resistivity (Ohm-m)"
],
"main": true,
"group": "Mesh and models",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"model_type": {
"choiceList": [
"Conductivity (S/m)",
"Resistivity (ohm-m)"
"Resistivity (Ohm-m)"
],
"main": true,
"group": "Mesh and models",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"model_type": {
"choiceList": [
"Conductivity (S/m)",
"Resistivity (ohm-m)"
"Resistivity (Ohm-m)"
],
"main": true,
"group": "Mesh and models",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"model_type": {
"choiceList": [
"Conductivity (S/m)",
"Resistivity (ohm-m)"
"Resistivity (Ohm-m)"
],
"main": true,
"group": "Mesh and models",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
"model_type": {
"choiceList": [
"Conductivity (S/m)",
"Resistivity (ohm-m)"
"Resistivity (Ohm-m)"
],
"main": true,
"group": "Mesh and models",
Expand Down
2 changes: 1 addition & 1 deletion simpeg_drivers-assets/uijson/fdem1d_forward.ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"model_type": {
"choiceList": [
"Conductivity (S/m)",
"Resistivity (ohm-m)"
"Resistivity (Ohm-m)"
],
"main": true,
"group": "Mesh and models",
Expand Down
2 changes: 1 addition & 1 deletion simpeg_drivers-assets/uijson/fdem1d_inversion.ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
"model_type": {
"choiceList": [
"Conductivity (S/m)",
"Resistivity (ohm-m)"
"Resistivity (Ohm-m)"
],
"main": true,
"group": "Mesh and models",
Expand Down
2 changes: 1 addition & 1 deletion simpeg_drivers-assets/uijson/fdem_forward.ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"model_type": {
"choiceList": [
"Conductivity (S/m)",
"Resistivity (ohm-m)"
"Resistivity (Ohm-m)"
],
"main": true,
"group": "Mesh and models",
Expand Down
2 changes: 1 addition & 1 deletion simpeg_drivers-assets/uijson/fdem_inversion.ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"model_type": {
"choiceList": [
"Conductivity (S/m)",
"Resistivity (ohm-m)"
"Resistivity (Ohm-m)"
],
"main": true,
"group": "Mesh and models",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
"model_type": {
"choiceList": [
"Conductivity (S/m)",
"Resistivity (ohm-m)"
"Resistivity (Ohm-m)"
],
"main": true,
"group": "Mesh and models",
Expand All @@ -121,7 +121,7 @@
"isValue": true,
"parent": "mesh",
"label": "Background",
"tooltip": "Background model in the 'Model units' (S/m or ohm-m).",
"tooltip": "Background model in the 'Model units' (S/m or Ohm-m).",
"property": "",
"value": 0.001
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
"model_type": {
"choiceList": [
"Conductivity (S/m)",
"Resistivity (ohm-m)"
"Resistivity (Ohm-m)"
],
"main": true,
"group": "Mesh and models",
Expand All @@ -140,7 +140,7 @@
"isValue": true,
"parent": "mesh",
"label": "Background",
"tooltip": "Background model in the 'Model units' (S/m or ohm-m).",
"tooltip": "Background model in the 'Model units' (S/m or Ohm-m).",
"property": "",
"value": 0.001
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"model_type": {
"choiceList": [
"Conductivity (S/m)",
"Resistivity (ohm-m)"
"Resistivity (Ohm-m)"
],
"main": true,
"group": "Mesh and models",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"model_type": {
"choiceList": [
"Conductivity (S/m)",
"Resistivity (ohm-m)"
"Resistivity (Ohm-m)"
],
"main": true,
"group": "Mesh and models",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"model_type": {
"choiceList": [
"Conductivity (S/m)",
"Resistivity (ohm-m)"
"Resistivity (Ohm-m)"
],
"main": true,
"group": "Mesh and models",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
"model_type": {
"choiceList": [
"Conductivity (S/m)",
"Resistivity (ohm-m)"
"Resistivity (Ohm-m)"
],
"main": true,
"group": "Mesh and models",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"model_type": {
"choiceList": [
"Conductivity (S/m)",
"Resistivity (ohm-m)"
"Resistivity (Ohm-m)"
],
"main": true,
"group": "Mesh and models",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"model_type": {
"choiceList": [
"Conductivity (S/m)",
"Resistivity (ohm-m)"
"Resistivity (Ohm-m)"
],
"main": true,
"group": "Mesh and models",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@
"model_type": {
"choiceList": [
"Conductivity (S/m)",
"Resistivity (ohm-m)"
"Resistivity (Ohm-m)"
],
"main": true,
"group": "Mesh and models",
Expand Down
2 changes: 1 addition & 1 deletion simpeg_drivers-assets/uijson/tdem1d_forward.ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"model_type": {
"choiceList": [
"Conductivity (S/m)",
"Resistivity (ohm-m)"
"Resistivity (Ohm-m)"
],
"main": true,
"group": "Mesh and models",
Expand Down
2 changes: 1 addition & 1 deletion simpeg_drivers-assets/uijson/tdem1d_inversion.ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
"model_type": {
"choiceList": [
"Conductivity (S/m)",
"Resistivity (ohm-m)"
"Resistivity (Ohm-m)"
],
"main": true,
"group": "Mesh and models",
Expand Down
2 changes: 1 addition & 1 deletion simpeg_drivers-assets/uijson/tdem_forward.ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"model_type": {
"choiceList": [
"Conductivity (S/m)",
"Resistivity (ohm-m)"
"Resistivity (Ohm-m)"
],
"main": true,
"group": "Mesh and models",
Expand Down
2 changes: 1 addition & 1 deletion simpeg_drivers-assets/uijson/tdem_inversion.ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
"model_type": {
"choiceList": [
"Conductivity (S/m)",
"Resistivity (ohm-m)"
"Resistivity (Ohm-m)"
],
"main": true,
"group": "Mesh and models",
Expand Down
2 changes: 1 addition & 1 deletion simpeg_drivers-assets/uijson/tipper_forward.ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"model_type": {
"choiceList": [
"Conductivity (S/m)",
"Resistivity (ohm-m)"
"Resistivity (Ohm-m)"
],
"main": true,
"group": "Mesh and models",
Expand Down
2 changes: 1 addition & 1 deletion simpeg_drivers-assets/uijson/tipper_inversion.ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
"model_type": {
"choiceList": [
"Conductivity (S/m)",
"Resistivity (ohm-m)"
"Resistivity (Ohm-m)"
],
"main": true,
"group": "Mesh and models",
Expand Down
4 changes: 2 additions & 2 deletions simpeg_drivers/components/factories/directives_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from simpeg.utils.mat_utils import cartesian2amplitude_dip_azimuth

from simpeg_drivers.components.factories.simpeg_factory import SimPEGFactory
from simpeg_drivers.options import BaseInversionOptions
from simpeg_drivers.options import BaseInversionOptions, ModelTypeEnum


if TYPE_CHECKING:
Expand Down Expand Up @@ -418,7 +418,7 @@ def assemble_keyword_arguments(
inversion_object.permutation.T,
]

if self.params.models.model_type.lower() == "resistivity (ohm-m)":
if self.params.models.model_type == ModelTypeEnum.resistivity:
kwargs["transforms"].append(lambda x: 1 / x)

if "1d" in self.factory_type:
Expand Down
6 changes: 5 additions & 1 deletion simpeg_drivers/components/factories/source_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from geoh5py.objects import LargeLoopGroundTEMReceivers

from simpeg_drivers.components.factories.simpeg_factory import SimPEGFactory
from simpeg_drivers.options import ModelTypeEnum


if TYPE_CHECKING:
Expand Down Expand Up @@ -138,7 +139,10 @@ def assemble_keyword_arguments( # pylint: disable=arguments-differ
if self.factory_type in ["magnetotellurics", "tipper"]:
background = deepcopy(self.params.models.conductivity_model)

if getattr(self.params.models, "model_type", None) == "Resistivity (ohm-m)":
if (
getattr(self.params.models, "model_type", None)
== ModelTypeEnum.resistivity
):
background **= -1.0

kwargs["sigma_primary"] = [background]
Expand Down
28 changes: 14 additions & 14 deletions simpeg_drivers/components/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
mkvc,
)

from simpeg_drivers.options import ModelTypeEnum


if TYPE_CHECKING:
from simpeg_drivers.driver import InversionDriver
Expand Down Expand Up @@ -165,7 +167,7 @@ def starting_model(self) -> np.ndarray | None:
mstart = self._starting_model.model.copy()

if mstart is not None and self.is_sigma:
if self.driver.params.models.model_type.lower() == "resistivity (ohm-m)":
if self.driver.params.models.model_type == ModelTypeEnum.resistivity:
mstart = 1 / mstart

mstart = np.log(mstart)
Expand Down Expand Up @@ -221,7 +223,7 @@ def reference_model(self) -> np.ndarray | None:
ref_model = mref.copy()

if self.is_sigma:
if self.driver.params.models.model_type.lower() == "resistivity (ohm-m)":
if self.driver.params.models.model_type == ModelTypeEnum.resistivity:
ref_model = 1 / ref_model

ref_model = np.log(ref_model)
Expand Down Expand Up @@ -263,7 +265,7 @@ def reference_declination(self) -> np.ndarray | None:
def lower_bound(self) -> np.ndarray | None:
if (
self.is_sigma
and self.driver.params.models.model_type.lower() == "resistivity (ohm-m)"
and self.driver.params.models.model_type == ModelTypeEnum.resistivity
):
bound_model = self._upper_bound.model
else:
Expand All @@ -283,7 +285,7 @@ def lower_bound(self) -> np.ndarray | None:
if self.is_sigma:
is_finite = np.isfinite(lbound)

if self.driver.params.models.model_type.lower() == "resistivity (ohm-m)":
if self.driver.params.models.model_type == ModelTypeEnum.resistivity:
lbound[is_finite] = 1 / lbound[is_finite]

lbound[is_finite] = np.log(lbound[is_finite])
Expand All @@ -297,7 +299,7 @@ def lower_bound(self) -> np.ndarray | None:
def upper_bound(self) -> np.ndarray | None:
if (
self.is_sigma
and self.driver.params.models.model_type.lower() == "resistivity (ohm-m)"
and self.driver.params.models.model_type == ModelTypeEnum.resistivity
):
bound_model = self._lower_bound.model
else:
Expand All @@ -311,7 +313,7 @@ def upper_bound(self) -> np.ndarray | None:
if self.is_sigma:
is_finite = np.isfinite(ubound)

if self.driver.params.models.model_type.lower() == "resistivity (ohm-m)":
if self.driver.params.models.model_type == ModelTypeEnum.resistivity:
ubound[is_finite] = 1 / ubound[is_finite]

ubound[is_finite] = np.log(ubound[is_finite])
Expand All @@ -329,7 +331,7 @@ def conductivity_model(self) -> np.ndarray | None:
background_sigma = self._conductivity_model.model.copy()

if background_sigma is not None:
if self.driver.params.models.model_type.lower() == "resistivity (ohm-m)":
if self.driver.params.models.model_type == ModelTypeEnum.resistivity:
background_sigma = 1 / background_sigma

# Don't apply log if IP inversion
Expand Down Expand Up @@ -568,9 +570,8 @@ def save_model(self):

model_type = self.model_type
if (
model_type
and model_type.lower() == "conductivity_model"
and self.driver.params.models.model_type.lower() == "resistivity (ohm-m)"
model_type == "conductivity_model"
and self.driver.params.models.model_type == ModelTypeEnum.resistivity
):
model_type = "resistivity_model"

Expand All @@ -589,12 +590,11 @@ def save_model(self):

def edit_ndv_model(self, model):
"""Change values to NDV on models and save to workspace."""

model_type = self.model_type
if (
model_type
and model_type.lower() == "conductivity_model"
and getattr(self.driver.params.models, "model_type", None)
== "Resistivity (ohm-m)"
getattr(self.driver.params.models, "model_type", None)
== ModelTypeEnum.resistivity
):
model_type = "resistivity_model"

Expand Down
Loading