From 1a9bb3aadda76fc20f6aec49e37d13b44cd600cf Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Sat, 7 Jan 2017 16:27:46 +0800 Subject: clusters/solver.py: Disable a RuntimeWarning --- fg21sim/extragalactic/clusters/solver.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'fg21sim') 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]))) -- cgit v1.2.2