diff --git a/geoapps/base/application.py b/geoapps/base/application.py index aa378b002..0746d6e3c 100644 --- a/geoapps/base/application.py +++ b/geoapps/base/application.py @@ -516,6 +516,7 @@ def get_param_dict(self): except AttributeError: continue + return param_dict diff --git a/geoapps/edge_detection/application.py b/geoapps/edge_detection/application.py index f98a1d15a..1c7a6310d 100644 --- a/geoapps/edge_detection/application.py +++ b/geoapps/edge_detection/application.py @@ -195,7 +195,7 @@ def window_size(self): def trigger_click(self, _): param_dict = self.get_param_dict() - temp_geoh5 = f"{string_name(self.params.export_as)}_{time():.0f}.geoh5" + temp_geoh5 = f"{string_name(param_dict.get('export_as'))}_{time():.0f}.geoh5" ws, self.live_link.value = BaseApplication.get_output_workspace( self.live_link.value, self.export_directory.selected_path, temp_geoh5 ) @@ -228,16 +228,15 @@ def update_name(self, _): def compute_trigger(self, _): param_dict = self.get_param_dict() - param_dict["geoh5"] = self.params.geoh5 + param_dict["geoh5"] = self.workspace with fetch_active_workspace(self.params.geoh5): - self.params.update(param_dict) - + new_params = EdgeDetectionParams(**param_dict) self.refresh.value = False ( vertices, _, - ) = EdgeDetectionDriver.get_edges(*self.params.edge_args()) + ) = EdgeDetectionDriver.get_edges(*new_params.edge_args()) self.collections = [ collections.LineCollection( np.reshape(vertices[:, :2], (-1, 2, 2)), colors="k", linewidths=2 diff --git a/tests/run_tests/apps_run_test.py b/tests/run_tests/apps_run_test.py index 88349e865..62853cd32 100644 --- a/tests/run_tests/apps_run_test.py +++ b/tests/run_tests/apps_run_test.py @@ -418,13 +418,14 @@ def test_data_interpolation(tmp_path: Path): def test_edge_detection(tmp_path: Path): - temp_workspace = tmp_path / "contour.geoh5" + temp_workspace = tmp_path / "edge_detection.geoh5" with Workspace(temp_workspace) as workspace: for uid in [ "{538a7eb1-2218-4bec-98cc-0a759aa0ef4f}", ]: new_copy = GEOH5.get_entity(uuid.UUID(uid))[0].copy(parent=workspace) - new_data = new_copy.add_data( + grid = new_copy.copy(copy_children=False) + new_data = grid.add_data( { "copy_data": { "values": new_copy.children[0].values, @@ -436,11 +437,13 @@ def test_edge_detection(tmp_path: Path): app = EdgeDetectionApp(plot_result=False) app._file_browser.reset( path=tmp_path, - filename="contour.geoh5", + filename="edge_detection.geoh5", ) app._file_browser._apply_selection() app.file_browser_change(None) + app.objects.value = grid.uid app.data.value = new_data.uid + app.compute_trigger(None) app.trigger_click(None) with Workspace(get_output_workspace(tmp_path)) as workspace: