From e350d6e0d42ada22b6a0a0453a228dabc54f813e Mon Sep 17 00:00:00 2001 From: Theo Brown <7982453+theo-brown@users.noreply.github.com> Date: Mon, 18 Aug 2025 13:00:04 +0100 Subject: [PATCH] Remove bare try/except block that was suppressing useful exceptions --- freegsnke/GSstaticsolver.py | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/freegsnke/GSstaticsolver.py b/freegsnke/GSstaticsolver.py index 61210cd..4bebae9 100644 --- a/freegsnke/GSstaticsolver.py +++ b/freegsnke/GSstaticsolver.py @@ -15,9 +15,9 @@ it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + You should have received a copy of the GNU Lesser General Public License -along with FreeGSNKE. If not, see . +along with FreeGSNKE. If not, see . """ import warnings @@ -937,23 +937,20 @@ def inverse_solve( constrain.prepare_for_solve(eq) check_equilibrium = False - try: - GS_residual = self.F_function( - tokamak_psi=self.tokamak_psi.reshape(-1), - plasma_psi=eq.plasma_psi.reshape(-1), - profiles=profiles, - ) - if verbose: - print("Initial guess for plasma_psi successful, residual found.") - rel_change_full, del_psi = self.relative_del_residual( - GS_residual, eq.plasma_psi - ) - if rel_change_full < threshold_val: - check_equilibrium = True - if profiles.diverted_core_mask is not None: - check_core_mask = True - except: - pass + GS_residual = self.F_function( + tokamak_psi=self.tokamak_psi.reshape(-1), + plasma_psi=eq.plasma_psi.reshape(-1), + profiles=profiles, + ) + if verbose: + print("Initial guess for plasma_psi successful, residual found.") + rel_change_full, del_psi = self.relative_del_residual( + GS_residual, eq.plasma_psi + ) + if rel_change_full < threshold_val: + check_equilibrium = True + if profiles.diverted_core_mask is not None: + check_core_mask = True if verbose: print(f"Initial relative error = {rel_change_full:.2e}")