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 @@ -121,7 +121,8 @@
"main": true,
"isValue": true,
"parent": "mesh",
"label": "Conductivity (S/m)",
"label": "Background",
"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 @@ -140,7 +140,8 @@
"main": true,
"isValue": true,
"parent": "mesh",
"label": "Conductivity (S/m)",
"label": "Background",
"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 @@ -50,7 +50,8 @@
"main": true,
"isValue": true,
"parent": "mesh",
"label": "Conductivity (S/m)",
"label": "Background",
"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 @@ -75,7 +75,8 @@
"main": true,
"isValue": true,
"parent": "mesh",
"label": "Conductivity (S/m)",
"label": "Background",
"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 @@ -104,7 +104,8 @@
"main": true,
"isValue": true,
"parent": "mesh",
"label": "Conductivity (S/m)",
"label": "Background",
"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 @@ -123,7 +123,8 @@
"main": true,
"isValue": true,
"parent": "mesh",
"label": "Conductivity (S/m)",
"label": "Background",
"tooltip": "Background model in the 'Model units' (S/m or Ohm-m).",
"property": "",
"value": 0.001
},
Expand Down
22 changes: 15 additions & 7 deletions simpeg_drivers/components/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,10 @@

@property
def lower_bound(self) -> np.ndarray | None:
if getattr(self.driver.params, "model_type", None) == "Resistivity (Ohm-m)":
if (
getattr(self.driver.params, "model_type", None) == "Resistivity (Ohm-m)"
and self.is_sigma
):
bound_model = self._upper_bound.model
else:
bound_model = self._lower_bound.model
Expand Down Expand Up @@ -213,7 +216,10 @@

@property
def upper_bound(self) -> np.ndarray | None:
if getattr(self.driver.params, "model_type", None) == "Resistivity (Ohm-m)":
if (
getattr(self.driver.params, "model_type", None) == "Resistivity (Ohm-m)"
and self.is_sigma
):
bound_model = self._lower_bound.model
else:
bound_model = self._upper_bound.model
Expand All @@ -238,15 +244,17 @@
if self._conductivity.model is None:
return None

mstart = self._conductivity.model.copy()
background_sigma = self._conductivity.model.copy()

if mstart is not None and self.is_sigma:
if background_sigma is not None:
if getattr(self.driver.params, "model_type", None) == "Resistivity (Ohm-m)":
mstart = 1 / mstart
background_sigma = 1 / background_sigma

mstart = np.log(mstart)
# Don't apply log if IP inversion
if self.is_sigma:
background_sigma = np.log(background_sigma)

Check warning on line 255 in simpeg_drivers/components/models.py

View check run for this annotation

Codecov / codecov/patch

simpeg_drivers/components/models.py#L255

Added line #L255 was not covered by tests

return mstart
return background_sigma

@property
def alpha_s(self) -> np.ndarray | None:
Expand Down
2 changes: 1 addition & 1 deletion simpeg_drivers/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ def get_path(self, filepath: str | Path) -> str:

cluster = (
LocalCluster(processes=True, n_workers=n_workers, threads_per_worker=n_threads)
if (n_workers is None or n_workers > 1 or n_threads is not None)
if ((n_workers is not None and n_workers > 1) or n_threads is not None)
else None
)

Expand Down
3 changes: 2 additions & 1 deletion tests/run_tests/driver_ip_2d_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ def test_ip_2d_fwr_run(
mesh=model.parent,
active_cells=ActiveCellsOptions(topography_object=topography),
starting_model=model,
conductivity_model=1e-2,
conductivity_model=1e2,
model_type="Resistivity (Ohm-m)",
line_selection=LineSelectionOptions(
line_object=geoh5.get_entity("line_ids")[0],
line_id=101,
Expand Down
3 changes: 2 additions & 1 deletion tests/run_tests/driver_ip_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ def test_ip_3d_run(
mesh=mesh,
active_cells=ActiveCellsOptions(topography_object=topography),
data_object=potential.parent,
conductivity_model=1e-2,
conductivity_model=1e2,
model_type="Resistivity (Ohm-m)",
reference_model=1e-6,
starting_model=1e-6,
s_norm=0.0,
Expand Down