From c3113255b8d07a8709852be450b5da794888b323 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Sat, 29 Jul 2017 23:19:22 +0800 Subject: clusters/emission.py: Add property "B_gauss" Signed-off-by: Aaron LI --- fg21sim/extragalactic/clusters/emission.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'fg21sim') 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 @@ -65,6 +65,13 @@ class SynchrotronEmission: self.B = B # [uG] 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): """ @@ -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 -- cgit v1.2.2