From 20f46d149989e0824fb78f96271b1b9cf35219f6 Mon Sep 17 00:00:00 2001 From: KasukabeDefenceForce Date: Thu, 10 Oct 2024 10:07:57 +0530 Subject: [PATCH] replace extra condition with mask --- tardis/plasma/properties/atomic.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tardis/plasma/properties/atomic.py b/tardis/plasma/properties/atomic.py index 73fe6a0e50f..f4f1cce371f 100644 --- a/tardis/plasma/properties/atomic.py +++ b/tardis/plasma/properties/atomic.py @@ -788,9 +788,9 @@ def exp1_times_exp(x): Output array. """ x = np.asarray(x) - f = exp1(x) * np.exp(x, where=x <= 500) - # Use Laurent series for large values to avoid infinite exponential mask = x > 500 + f = exp1(x) * np.exp(x * (~mask)) + # Use Laurent series for large values to avoid infinite exponential f[mask] = (x**-1 - x**-2 + 2 * x**-3 - 6 * x**-4)[mask] return f