From 19b76033f361ed886156f861eafdbb5495149a0c Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Sun, 27 Jan 2019 15:20:18 +0800 Subject: clusters/helper: Add simple density_number_electron() --- fg21sim/extragalactic/clusters/helper.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'fg21sim') 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, -- cgit v1.2.2