aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-10-19 11:02:27 +0800
committerAaron LI <aly@aaronly.me>2017-10-19 11:02:27 +0800
commit4626382c83f7364f8c6321df1abe2581dfda79d5 (patch)
treeccc5a6c1ce65a92288e8176e33fd27422602d722 /fg21sim
parentad293e34d1ae1bf8d8d652ee89464e9b52825b95 (diff)
downloadfg21sim-4626382c83f7364f8c6321df1abe2581dfda79d5.tar.bz2
clusters/halo: Add set_electron_spectrum() method; update doc a bit
Diffstat (limited to 'fg21sim')
-rw-r--r--fg21sim/extragalactic/clusters/halo.py27
1 files changed, 26 insertions, 1 deletions
diff --git a/fg21sim/extragalactic/clusters/halo.py b/fg21sim/extragalactic/clusters/halo.py
index 3ce3ed7..0f8752a 100644
--- a/fg21sim/extragalactic/clusters/halo.py
+++ b/fg21sim/extragalactic/clusters/halo.py
@@ -99,8 +99,16 @@ class RadioHalo:
fpsolver : `~FokkerPlanckSolver`
The solver instance to calculate the electron spectrum evolution.
radius : float
- The halo radius (scales with the virial radius)
+ The halo radius
Unit: [kpc]
+ gamma : 1D float `~numpy.ndarray`
+ The Lorentz factors of the adopted logarithmic grid to solve the
+ equation.
+ electron_spec : 1D float `~numpy.ndarray`
+ The derived electron (number density) distribution/spectrum at
+ the final time (``zend``), which is set by the methods
+ ``self.calc_electron_spectrum()`` or ``self.set_electron_spectrum()``.
+ Unit: [cm^-3]
"""
def __init__(self, M_obs, z_obs, M_main, M_sub, z_merger,
configs=CONFIGS):
@@ -304,6 +312,23 @@ class RadioHalo:
tstop=tstop)
return self.electron_spec
+ def set_electron_spectrum(self, n_e):
+ """
+ Check the given electron spectrum and set it to the
+ ``self.electron_spec``.
+
+ Parameters
+ ----------
+ n_e : float 1D `~numpy.ndarray`
+ The solved electron spectrum at ``zend``.
+ Unit: [cm^-3]
+ """
+ n_e = np.array(n_e) # make a copy
+ if n_e.shape == self.gamma.shape:
+ self.electron_spec = n_e
+ else:
+ raise ValueError("given electron spectrum has wrong shape!")
+
def calc_emissivity(self, frequencies, n_e=None, gamma=None):
"""
Calculate the synchrotron emissivity for the derived electron