diff options
author | Aaron LI <aly@aaronly.me> | 2017-07-29 23:52:29 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2017-07-29 23:52:29 +0800 |
commit | a2b61f982ed52465a9c76fd17a8f288c3d1253a7 (patch) | |
tree | 75d7f3e983629394116373e817ee9a029a710d57 /fg21sim/extragalactic | |
parent | 632c2857d1607150f482293df3391e874b53a823 (diff) | |
download | fg21sim-a2b61f982ed52465a9c76fd17a8f288c3d1253a7.tar.bz2 |
clusters/halo.py: Add method "calc_emissivity()"
This method invokes ``SynchrotronEmission`` to calculate the synchrotron
emissivity at specified frequencies for the derived electron spectrum.
Signed-off-by: Aaron LI <aly@aaronly.me>
Diffstat (limited to 'fg21sim/extragalactic')
-rw-r--r-- | fg21sim/extragalactic/clusters/halo.py | 43 |
1 files changed, 37 insertions, 6 deletions
diff --git a/fg21sim/extragalactic/clusters/halo.py b/fg21sim/extragalactic/clusters/halo.py index d7b3ec4..2cc391f 100644 --- a/fg21sim/extragalactic/clusters/halo.py +++ b/fg21sim/extragalactic/clusters/halo.py @@ -44,11 +44,11 @@ import numpy as np from . import helper from .solver import FokkerPlanckSolver +from .emission import SynchrotronEmission from ...configs import CONFIGS from ...utils import COSMO from ...utils.units import (Units as AU, - UnitConversions as AUC, - Constants as AC) + UnitConversions as AUC) logger = logging.getLogger(__name__) @@ -72,10 +72,6 @@ class RadioHalo: 4. Determine the initial electron density TODO... - after that, calculate the electron acceleration and time evolution - by solving the Fokker-Planck equation; and finally derive the radio - emission from the electron spectra. - Parameters ---------- M_obs : float @@ -223,6 +219,41 @@ class RadioHalo: tstop=tstop) return self.electron_spec + def calc_emissivity(self, frequencies, n_e=None, gamma=None): + """ + Calculate the synchrotron emissivity for the derived electron + spectrum. + + Parameters + ---------- + frequencies : float, or 1D `~numpy.ndarray` + The frequencies where to calculate the synchrotron emissivity. + Unit: [MHz] + n_e : 1D `~numpy.ndarray`, optional + The electron spectrum (w.r.t. Lorentz factors γ). + If not provided, then used the cached ``self.electron_spec`` + solved above. + Unit: [cm^-3] + gamma : 1D `~numpy.ndarray`, optional + The Lorentz factors γ of the electron spectrum. + If not provided, then used ``self.gamma``. + + Returns + ------- + emissivity : float, or 1D `~numpy.ndarray` + The calculated synchrotron emissivity at each specified + frequency. + Unit: [erg/s/cm^3/Hz] + """ + if n_e is None: + n_e = self.electron_spec + if gamma is None: + gamma = self.gamma + syncem = SynchrotronEmission(gamma=gamma, n_e=n_e, + B=self.magnetic_field) + emissivity = syncem.emissivity(frequencies) + return emissivity + def fp_injection(self, gamma, t=None): """ Electron injection (rate) term for the Fokker-Planck equation. |