aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim/extragalactic/clusters/solver.py
diff options
context:
space:
mode:
Diffstat (limited to 'fg21sim/extragalactic/clusters/solver.py')
-rw-r--r--fg21sim/extragalactic/clusters/solver.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/fg21sim/extragalactic/clusters/solver.py b/fg21sim/extragalactic/clusters/solver.py
index 5078c5e..f7c96ea 100644
--- a/fg21sim/extragalactic/clusters/solver.py
+++ b/fg21sim/extragalactic/clusters/solver.py
@@ -165,9 +165,11 @@ class FokkerPlanckSolver:
@staticmethod
def W(w):
# References: Ref.[1],Eqs.(27,35)
- w = np.abs(w)
+ with np.errstate(invalid="ignore"):
+ # Ignore NaN's
+ w = np.abs(w)
+ mask = (w < 0.1) # Comparison on NaN gives False, as expected
W = np.zeros(w.shape) * np.nan
- mask = (w < 0.1)
W[mask] = 1.0 / (1 + w[mask]**2/24 + w[mask]**4/1920)
W[~mask] = (w[~mask] * np.exp(-w[~mask]/2) /
(1 - np.exp(-w[~mask])))