aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2019-01-27 15:20:18 +0800
committerAaron LI <aly@aaronly.me>2019-01-27 15:20:18 +0800
commit19b76033f361ed886156f861eafdbb5495149a0c (patch)
tree50c364ecb512f0def59c888b49c0ec80460e1910 /fg21sim
parent44e98825af60e9312ee82864a887a8b3751147e0 (diff)
downloadfg21sim-19b76033f361ed886156f861eafdbb5495149a0c.tar.bz2
clusters/helper: Add simple density_number_electron()
Diffstat (limited to 'fg21sim')
-rw-r--r--fg21sim/extragalactic/clusters/helper.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/fg21sim/extragalactic/clusters/helper.py b/fg21sim/extragalactic/clusters/helper.py
index c4fdecc..001ced5 100644
--- a/fg21sim/extragalactic/clusters/helper.py
+++ b/fg21sim/extragalactic/clusters/helper.py
@@ -354,6 +354,14 @@ def density_energy_electron(n_e, gamma):
return integrate.simps(e_spec * gamma, np.log(gamma)) # in log grid
+def density_number_electron(n_e, gamma):
+ """
+ Calculate the electron number density of the given spectrum.
+ Unit: [cm^-3]
+ """
+ return integrate.simps(n_e * gamma, np.log(gamma)) # in log grid
+
+
def magnetic_field(
mass,
z=0.0,