From b6a7445e9a63ac0e834ca7c92c8b0ec1533a8573 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Wed, 26 Jul 2017 16:03:05 +0800 Subject: clusters/emission.py: Update arguments Signed-off-by: Aaron LI --- fg21sim/extragalactic/clusters/emission.py | 56 +++++++++++++++--------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'fg21sim/extragalactic/clusters') diff --git a/fg21sim/extragalactic/clusters/emission.py b/fg21sim/extragalactic/clusters/emission.py index 74e6ec8..82532ea 100644 --- a/fg21sim/extragalactic/clusters/emission.py +++ b/fg21sim/extragalactic/clusters/emission.py @@ -32,32 +32,31 @@ logger = logging.getLogger(__name__) class SynchrotronEmission: """ - Calculate the synchrotron emission spectrum from a given population + Calculate the synchrotron emission from a given population of electrons. Parameters ---------- + gamma : `~numpy.ndarray` + The Lorentz factors of electrons. + n_e : `~numpy.ndarray` + Electron number density spectrum. + Unit: [cm^-3] + z : float + Redshift of the cluster/halo been observed/simulated. B : float - The assumed uniform magnetic field of the galaxy cluster. + The assumed uniform magnetic field within the cluster ICM. Unit: [uG] - p : `~numpy.ndarray` - The momentum grid adopted when solving the Fokker-Planck equation. - Unit: [mec] - n_e : `~numpy.ndarray` - Electron spectrum by solving the Fokker-Planck equation. - Unit: [cm^-3 mec^-1] - radius, float - The radius of the galaxy cluster/halo, within which the uniform - magnetic field and electron distribution are assumed. + radius : float + The radius of the halo, within which the uniform magnetic field + and electron distribution are assumed. Unit: [kpc] - z : float - Redshift of the galaxy cluster/halo """ - def __init__(self, B, p, n_e, radius, z): - self.B = B # [uG] - self.p = p - self.n_e = n_e + def __init__(self, gamma, n_e, z, B, radius): + self.gamma = np.asarray(gamma) + self.n_e = np.asarray(n_e) self.z = z + self.B = B # [uG] self.radius = radius # [kpc] @property @@ -66,14 +65,14 @@ class SynchrotronEmission: Electron Larmor frequency: ν_L = e * B / (2*π * m0 * c) = e * B / (2*π * mec) - Unit: MHz + Unit: [MHz] """ coef = AC.e / (2*np.pi * AU.mec) # [Hz/G] - coef *= 1e-12 # [MHz/uG] + coef *= 1e-12 # [Hz/G] -> [MHz/uG] nu = coef * self.B # [MHz] return nu - def frequency_crit(self, p, theta=np.pi/2): + def frequency_crit(self, gamma, theta=np.pi/2): """ Synchrotron critical frequency. @@ -82,19 +81,20 @@ class SynchrotronEmission: Parameters ---------- - p : float - Electron momentum (unit: mec), i.e., Lorentz factor γ - theta : float, optional - The angle between the electron velocity and the magnetic field. - (unit: radian) + gamma : float, or `~numpy.ndarray` + Electron Lorentz factors γ + theta : float, or `~numpy.ndarray`, optional + The angles between the electron velocity and the magnetic field. + Unit: [rad] Returns ------- - nu : float - Critical frequency, unit: MHz + nu : float, or `~numpy.ndarray` + Critical frequencies + Unit: [MHz] """ nu_L = self.frequency_larmor - nu = (3/2) * p**2 * np.sin(theta) * nu_L + nu = (3/2) * gamma**2 * np.sin(theta) * nu_L return nu @staticmethod -- cgit v1.2.2