aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2017-01-07 16:27:46 +0800
committerAaron LI <aly@aaronly.me>2017-06-01 16:33:38 +0800
commit1a9bb3aadda76fc20f6aec49e37d13b44cd600cf (patch)
tree5e5338bd4206331ade1beca612415157b07d07ba /fg21sim
parent3929198a352715855ed7b51b0d4511fa1591e77b (diff)
downloadfg21sim-1a9bb3aadda76fc20f6aec49e37d13b44cd600cf.tar.bz2
clusters/solver.py: Disable a RuntimeWarning
Diffstat (limited to 'fg21sim')
-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])))