From 5cc817d0d32b9096b9015c9c1a870ee93a75ba12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Sierro?= Date: Fri, 27 Jan 2023 09:18:06 +0100 Subject: [PATCH] dedicated over-ionization error --- src/scgenerator/physics/plasma.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/scgenerator/physics/plasma.py b/src/scgenerator/physics/plasma.py index 3d01b8f..b50ac53 100644 --- a/src/scgenerator/physics/plasma.py +++ b/src/scgenerator/physics/plasma.py @@ -9,6 +9,10 @@ from scgenerator.math import cumulative_simpson, expm1_int from scgenerator.physics.units import e, hbar, me +class PlasmaOutOfBoundsError(RuntimeError): + ... + + class PlasmaInfo(NamedTuple): polarization: np.ndarray electron_density: np.ndarray @@ -47,7 +51,7 @@ def cache_ion_rate( def compute(field_abs: np.ndarray) -> np.ndarray: if field_abs.max() > E_max or field_abs.min() < -E_max: - raise ValueError("E field is out of bounds") + raise PlasmaOutOfBoundsError("E field is out of bounds") return interp(field_abs) return compute