From 06cac7c5edf199ef537b86d9c07fc760854f7f16 Mon Sep 17 00:00:00 2001 From: Tom Body
Date: Wed, 14 Dec 2022 14:43:55 -0500 Subject: [PATCH] Warn instead of failing if coil area is zero --- freegs/coil.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/freegs/coil.py b/freegs/coil.py index ed5eae0..963dcb1 100644 --- a/freegs/coil.py +++ b/freegs/coil.py @@ -28,6 +28,7 @@ import numpy as np import numbers from shapely.geometry import Point +import warnings class AreaCurrentLimit: @@ -253,11 +254,13 @@ def area(self): The cross-section area of the coil in m^2 """ if isinstance(self._area, numbers.Number): - assert self._area > 0 + if not self._area > 0: + warnings.warn(f"Coil area {self._area:3.2f} <= 0") return self._area # Calculate using functor area = self._area(self) - assert area > 0 + if not area > 0: + warnings.warn(f"Coil area {area:3.2f} <= 0") return area @area.setter