aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim/extragalactic
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-07-29 23:19:22 +0800
committerAaron LI <aly@aaronly.me>2017-07-29 23:19:22 +0800
commitc3113255b8d07a8709852be450b5da794888b323 (patch)
tree7e8aee37f715a3d0390ef003dac25b8a6fa01abd /fg21sim/extragalactic
parent462fc4f5c524ab49bd71c852bd4b530f181f0b52 (diff)
downloadfg21sim-c3113255b8d07a8709852be450b5da794888b323.tar.bz2
clusters/emission.py: Add property "B_gauss"
Signed-off-by: Aaron LI <aly@aaronly.me>
Diffstat (limited to 'fg21sim/extragalactic')
-rw-r--r--fg21sim/extragalactic/clusters/emission.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/fg21sim/extragalactic/clusters/emission.py b/fg21sim/extragalactic/clusters/emission.py
index b54d113..bca0ecf 100644
--- a/fg21sim/extragalactic/clusters/emission.py
+++ b/fg21sim/extragalactic/clusters/emission.py
@@ -38,7 +38,7 @@ logger = logging.getLogger(__name__)
class SynchrotronEmission:
"""
- Calculate the synchrotron emission from a given population
+ Calculate the synchrotron emissivity from a given population
of electrons.
Parameters
@@ -66,6 +66,13 @@ class SynchrotronEmission:
self.radius = radius # [kpc]
@property
+ def B_gauss(self):
+ """
+ Magnetic field in unit of [G] (i.e., gauss)
+ """
+ return self.B * 1e-6 # [uG] -> [G]
+
+ @property
def frequency_larmor(self):
"""
Electron Larmor frequency (a.k.a. gyro frequency):
@@ -74,10 +81,8 @@ class SynchrotronEmission:
Unit: [MHz]
"""
- coef = AC.e / (2*np.pi * AU.mec) # [Hz/G]
- coef *= 1e-12 # [Hz/G] -> [MHz/uG]
- nu = coef * self.B # [MHz]
- return nu
+ nu_larmor = AC.e * self.B_gauss / (2*np.pi * AU.mec) # [Hz]
+ return nu_larmor * 1e-6 # [Hz] -> [MHz]
def frequency_crit(self, gamma, theta=np.pi/2):
"""
@@ -185,8 +190,7 @@ class SynchrotronEmission:
# Integrate over energy ``gamma`` in logarithmic grid
j_nu = integrate.simps(s1d*self.gamma, np.log(self.gamma))
- B_gauss = self.B * 1e-6 # [uG] -> [G]
- coef = np.sqrt(3) * AC.e**3 * B_gauss / AU.mec2
+ coef = np.sqrt(3) * AC.e**3 * self.B_gauss / AU.mec2
j_nu *= coef
return j_nu