diff --git a/simpeg_drivers-assets/uijson/induced_polarization_2d_forward.ui.json b/simpeg_drivers-assets/uijson/induced_polarization_2d_forward.ui.json index 35fdbf76..1d3b32df 100644 --- a/simpeg_drivers-assets/uijson/induced_polarization_2d_forward.ui.json +++ b/simpeg_drivers-assets/uijson/induced_polarization_2d_forward.ui.json @@ -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 }, diff --git a/simpeg_drivers-assets/uijson/induced_polarization_2d_inversion.ui.json b/simpeg_drivers-assets/uijson/induced_polarization_2d_inversion.ui.json index 291d0523..665942b4 100644 --- a/simpeg_drivers-assets/uijson/induced_polarization_2d_inversion.ui.json +++ b/simpeg_drivers-assets/uijson/induced_polarization_2d_inversion.ui.json @@ -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 }, diff --git a/simpeg_drivers-assets/uijson/induced_polarization_3d_forward.ui.json b/simpeg_drivers-assets/uijson/induced_polarization_3d_forward.ui.json index f3e0843d..ad74bf9e 100644 --- a/simpeg_drivers-assets/uijson/induced_polarization_3d_forward.ui.json +++ b/simpeg_drivers-assets/uijson/induced_polarization_3d_forward.ui.json @@ -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 }, diff --git a/simpeg_drivers-assets/uijson/induced_polarization_3d_inversion.ui.json b/simpeg_drivers-assets/uijson/induced_polarization_3d_inversion.ui.json index c8c91d7d..18243153 100644 --- a/simpeg_drivers-assets/uijson/induced_polarization_3d_inversion.ui.json +++ b/simpeg_drivers-assets/uijson/induced_polarization_3d_inversion.ui.json @@ -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 }, diff --git a/simpeg_drivers-assets/uijson/induced_polarization_batch2d_forward.ui.json b/simpeg_drivers-assets/uijson/induced_polarization_batch2d_forward.ui.json index 74805881..827d957a 100644 --- a/simpeg_drivers-assets/uijson/induced_polarization_batch2d_forward.ui.json +++ b/simpeg_drivers-assets/uijson/induced_polarization_batch2d_forward.ui.json @@ -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 }, diff --git a/simpeg_drivers-assets/uijson/induced_polarization_batch2d_inversion.ui.json b/simpeg_drivers-assets/uijson/induced_polarization_batch2d_inversion.ui.json index 5a75df75..7863b81c 100644 --- a/simpeg_drivers-assets/uijson/induced_polarization_batch2d_inversion.ui.json +++ b/simpeg_drivers-assets/uijson/induced_polarization_batch2d_inversion.ui.json @@ -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 }, diff --git a/simpeg_drivers/components/models.py b/simpeg_drivers/components/models.py index 413e997f..3153e21d 100644 --- a/simpeg_drivers/components/models.py +++ b/simpeg_drivers/components/models.py @@ -185,7 +185,10 @@ def reference(self) -> np.ndarray | None: @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 @@ -213,7 +216,10 @@ def lower_bound(self) -> np.ndarray | None: @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 @@ -238,15 +244,17 @@ def conductivity(self) -> np.ndarray | None: 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) - return mstart + return background_sigma @property def alpha_s(self) -> np.ndarray | None: diff --git a/simpeg_drivers/driver.py b/simpeg_drivers/driver.py index 326dc7eb..1d2cb02f 100644 --- a/simpeg_drivers/driver.py +++ b/simpeg_drivers/driver.py @@ -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 ) diff --git a/tests/run_tests/driver_ip_2d_test.py b/tests/run_tests/driver_ip_2d_test.py index 0190bed6..d4d2e86f 100644 --- a/tests/run_tests/driver_ip_2d_test.py +++ b/tests/run_tests/driver_ip_2d_test.py @@ -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, diff --git a/tests/run_tests/driver_ip_test.py b/tests/run_tests/driver_ip_test.py index a768c53c..167b365d 100644 --- a/tests/run_tests/driver_ip_test.py +++ b/tests/run_tests/driver_ip_test.py @@ -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,