@@ -76,15 +76,17 @@ def test_dc_2d_fwr_run(
7676 ),
7777 ),
7878 )
79+
7980 with get_workspace (tmp_path / "inversion_test.ui.geoh5" ) as geoh5 :
8081 components = SyntheticsComponents (geoh5 = geoh5 , options = opts )
82+ line_ids = components .survey .get_data ("line_ids" )[0 ]
8183 params = DC2DForwardOptions .build (
8284 geoh5 = geoh5 ,
8385 mesh = components .mesh ,
8486 topography_object = components .topography ,
8587 data_object = components .survey ,
8688 starting_model = components .model ,
87- line_selection = LineSelectionOptions (),
89+ line_selection = LineSelectionOptions (property = line_ids , value = [ 1 , 101 , 201 ] ),
8890 )
8991 fwr_driver = DC2DForwardDriver (params )
9092 fwr_driver .run ()
@@ -119,9 +121,6 @@ def test_dc_2d_run(
119121 data_object = potential .parent ,
120122 potential_channel = potential ,
121123 potential_uncertainty = uncertainties ,
122- line_selection = LineSelectionOptions (
123- line_object = potential .parent .get_entity ("Line IDs" )[0 ]
124- ),
125124 starting_model = 1e-3 ,
126125 reference_model = 1e-3 ,
127126 s_norm = 0.0 ,
@@ -134,10 +133,11 @@ def test_dc_2d_run(
134133 upper_bound = 10 ,
135134 cooling_rate = 1 ,
136135 )
137- params .write_ui_json (path = tmp_path / "Inv_run.ui.json" )
138-
139- driver = DC2DInversionDriver .start (str (tmp_path / "Inv_run.ui.json" ))
136+ # TODO Fix the write for MultiSelect of Reference data
137+ # params.write_ui_json(path=tmp_path / "Inv_run.ui.json")
140138
139+ driver = DC2DInversionDriver (params )
140+ driver .run ()
141141 output = get_inversion_output (
142142 driver .params .geoh5 .h5file , driver .params .out_group .uid
143143 )
@@ -168,6 +168,9 @@ def test_dc_single_run(
168168 }
169169 }
170170 )
171+
172+ line_ids = survey .get_data ("line_ids" )[0 ]
173+
171174 # Run the inverse
172175 params = DC2DInversionOptions .build (
173176 geoh5 = geoh5 ,
@@ -177,9 +180,7 @@ def test_dc_single_run(
177180 data_object = potential .parent ,
178181 potential_channel = potential ,
179182 potential_uncertainty = uncertainties ,
180- line_selection = LineSelectionOptions (
181- line_object = potential .parent .get_entity ("Line IDs" )[0 ], line_id = 2
182- ),
183+ line_selection = LineSelectionOptions (property = line_ids , value = [101 ]),
183184 starting_model = 1e-3 ,
184185 reference_model = 1e-3 ,
185186 s_norm = 0.0 ,
@@ -194,16 +195,17 @@ def test_dc_single_run(
194195 )
195196 params .write_ui_json (path = tmp_path / "Inv_run.ui.json" )
196197
197- DC2DInversionDriver .start (str (tmp_path / "Inv_run.ui.json" ))
198+ driver = DC2DInversionDriver (params )
199+ driver .run ()
198200
199201 with Workspace (workpath ) as geoh5 :
200202 inv_group = geoh5 .get_entity ("Direct Current Single 2D Inversion" )[0 ]
201203 mesh = inv_group .get_entity ("mesh" )[0 ]
202204 model = mesh .get_entity ("Iteration_1_model" )[0 ]
203205
204206 # Check that model values for lines 1 and 3 are close to the starting model (1e-3) and that line 2 has been updated.
205- np .testing .assert_almost_equal (np .nanmin (model .values [:2369 ]), 1e-3 , decimal = 3 )
206- np .testing .assert_almost_equal (np .nanmin (model .values [- 2368 :]), 1e-3 , decimal = 3 )
207+ np .testing .assert_almost_equal (np .nanmax (model .values [:2369 ]), 1e-3 , decimal = 3 )
208+ np .testing .assert_almost_equal (np .nanmax (model .values [- 2368 :]), 1e-3 , decimal = 3 )
207209 assert np .nanmax (model .values [2368 :- 2368 ]) > 1e-3
208210
209211
0 commit comments