From bba218a017f3409cd271b6359c0d854cee2ebb8d Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Mon, 28 Sep 2026 15:03:00 +0100 Subject: [PATCH 1/2] Skip plasma current models which cannot run in output reporting --- process/models/physics/plasma_current.py | 41 ++++++++++++++---------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/process/models/physics/plasma_current.py b/process/models/physics/plasma_current.py index ed11a60ef3..f0c690950b 100644 --- a/process/models/physics/plasma_current.py +++ b/process/models/physics/plasma_current.py @@ -457,26 +457,33 @@ def calculate_all_plasma_current_models( Returns ------- dict[PlasmaCurrentModel, float] - Dictionary containing the plasma current for each model. + Dictionary containing the plasma current for each model that runs + successfully. """ results = {} for model in PlasmaCurrentModel: - results[model] = self.calculate_plasma_current( - alphaj=alphaj, - alphap=alphap, - b_plasma_toroidal_on_axis=b_plasma_toroidal_on_axis, - eps=eps, - i_plasma_current=model.value, - kappa=kappa, - kappa95=kappa95, - pres_plasma_on_axis=pres_plasma_on_axis, - len_plasma_poloidal=len_plasma_poloidal, - q95=q95, - rmajor=rmajor, - rminor=rminor, - triang=triang, - triang95=triang95, - ) + try: + results[model] = self.calculate_plasma_current( + alphaj=alphaj, + alphap=alphap, + b_plasma_toroidal_on_axis=b_plasma_toroidal_on_axis, + eps=eps, + i_plasma_current=model.value, + kappa=kappa, + kappa95=kappa95, + pres_plasma_on_axis=pres_plasma_on_axis, + len_plasma_poloidal=len_plasma_poloidal, + q95=q95, + rmajor=rmajor, + rminor=rminor, + triang=triang, + triang95=triang95, + ) + except ProcessValueError: # noqa: PERF203 + # Since this method is only used for output reporting, if a + # Ip model cannot run (e.g. most models don't support negative triang) + # then assign it NaN. + results[model] = np.nan return results def output_plasma_current_models(self) -> None: From 66866836bc0561df196740a1067e9bec18b8df1c Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Tue, 29 Sep 2026 09:13:56 +0100 Subject: [PATCH 2/2] Correct docstring --- process/models/physics/plasma_current.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/process/models/physics/plasma_current.py b/process/models/physics/plasma_current.py index f0c690950b..f946920491 100644 --- a/process/models/physics/plasma_current.py +++ b/process/models/physics/plasma_current.py @@ -457,8 +457,8 @@ def calculate_all_plasma_current_models( Returns ------- dict[PlasmaCurrentModel, float] - Dictionary containing the plasma current for each model that runs - successfully. + Dictionary containing the plasma current for each model. + Models which do not run successfully will map to a NaN. """ results = {} for model in PlasmaCurrentModel: