aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim
diff options
context:
space:
mode:
Diffstat (limited to 'fg21sim')
-rw-r--r--fg21sim/extragalactic/clusters/halo.py38
-rw-r--r--fg21sim/extragalactic/clusters/main.py35
2 files changed, 38 insertions, 35 deletions
diff --git a/fg21sim/extragalactic/clusters/halo.py b/fg21sim/extragalactic/clusters/halo.py
index 5b600c1..4e5f30f 100644
--- a/fg21sim/extragalactic/clusters/halo.py
+++ b/fg21sim/extragalactic/clusters/halo.py
@@ -132,6 +132,10 @@ class RadioHalo:
``self.calc_electron_spectrum()`` or ``self.set_electron_spectrum()``.
Unit: [cm^-3]
"""
+ # Component name
+ compID = "extragalactic/halos"
+ name = "giant radio halos"
+
def __init__(self, M_obs, z_obs, M_main, M_sub, z_merger,
configs=CONFIGS):
self.M_obs = M_obs
@@ -140,27 +144,27 @@ class RadioHalo:
self.M_sub = M_sub
self.z_merger = z_merger
- self.configs = configs
- self._set_configs()
+ self._set_configs(configs)
self._set_solver()
- def _set_configs(self):
- comp = "extragalactic/halos"
- self.f_acc = self.configs.getn(comp+"/f_acc")
- self.f_lturb = self.configs.getn(comp+"/f_lturb")
- self.zeta_ins = self.configs.getn(comp+"/zeta_ins")
- self.eta_turb = self.configs.getn(comp+"/eta_turb")
- self.eta_e = self.configs.getn(comp+"/eta_e")
- self.x_cr = self.configs.getn(comp+"/x_cr")
- self.gamma_min = self.configs.getn(comp+"/gamma_min")
- self.gamma_max = self.configs.getn(comp+"/gamma_max")
- self.gamma_np = self.configs.getn(comp+"/gamma_np")
- self.buffer_np = self.configs.getn(comp+"/buffer_np")
+ def _set_configs(self, configs):
+ comp = self.compID
+ self.configs = configs
+ self.f_acc = configs.getn(comp+"/f_acc")
+ self.f_lturb = configs.getn(comp+"/f_lturb")
+ self.zeta_ins = configs.getn(comp+"/zeta_ins")
+ self.eta_turb = configs.getn(comp+"/eta_turb")
+ self.eta_e = configs.getn(comp+"/eta_e")
+ self.x_cr = configs.getn(comp+"/x_cr")
+ self.gamma_min = configs.getn(comp+"/gamma_min")
+ self.gamma_max = configs.getn(comp+"/gamma_max")
+ self.gamma_np = configs.getn(comp+"/gamma_np")
+ self.buffer_np = configs.getn(comp+"/buffer_np")
if self.buffer_np == 0:
self.buffer_np = None
- self.time_step = self.configs.getn(comp+"/time_step")
- self.time_init = self.configs.getn(comp+"/time_init")
- self.injection_index = self.configs.getn(comp+"/injection_index")
+ self.time_step = configs.getn(comp+"/time_step")
+ self.time_init = configs.getn(comp+"/time_init")
+ self.injection_index = configs.getn(comp+"/injection_index")
def _set_solver(self):
self.fpsolver = FokkerPlanckSolver(
diff --git a/fg21sim/extragalactic/clusters/main.py b/fg21sim/extragalactic/clusters/main.py
index bc5326c..000f1e2 100644
--- a/fg21sim/extragalactic/clusters/main.py
+++ b/fg21sim/extragalactic/clusters/main.py
@@ -59,37 +59,36 @@ class GalaxyClusters:
name = "galaxy clusters (halos)"
def __init__(self, configs=CONFIGS):
- self.configs = configs
- self._set_configs()
-
+ self._set_configs(configs)
self.sky = get_sky(configs)
self.sky.add_header("CompID", self.compID, "Emission component ID")
self.sky.add_header("CompName", self.name, "Emission component")
self.sky.add_header("BUNIT", "K", "[Kelvin] Data unit")
self.sky.creator = __name__
- def _set_configs(self):
+ def _set_configs(self, configs):
"""
Load the configs and set the corresponding class attributes.
"""
comp = self.compID
- self.catalog_outfile = self.configs.get_path(comp+"/catalog_outfile")
- self.dump_catalog_data = self.configs.getn(comp+"/dump_catalog_data")
- self.use_dump_catalog_data = self.configs.getn(
+ self.configs = configs
+ self.catalog_outfile = configs.get_path(comp+"/catalog_outfile")
+ self.dump_catalog_data = configs.getn(comp+"/dump_catalog_data")
+ self.use_dump_catalog_data = configs.getn(
comp+"/use_dump_catalog_data")
- self.halos_catalog_outfile = self.configs.get_path(
+ self.halos_catalog_outfile = configs.get_path(
comp+"/halos_catalog_outfile")
- self.dump_halos_data = self.configs.getn(comp+"/dump_halos_data")
- self.use_dump_halos_data = self.configs.getn(
+ self.dump_halos_data = configs.getn(comp+"/dump_halos_data")
+ self.use_dump_halos_data = configs.getn(
comp+"/use_dump_halos_data")
- self.halo_dropout = self.configs.getn(comp+"/halo_dropout")
- self.prefix = self.configs.getn(comp+"/prefix")
- self.output_dir = self.configs.get_path(comp+"/output_dir")
- self.merger_mass_min = self.configs.getn(comp+"/merger_mass_min")
- self.time_traceback = self.configs.getn(comp+"/time_traceback")
- self.frequencies = self.configs.frequencies
- self.filename_pattern = self.configs.getn("output/filename_pattern")
- self.clobber = self.configs.getn("output/clobber")
+ self.halo_dropout = configs.getn(comp+"/halo_dropout")
+ self.prefix = configs.getn(comp+"/prefix")
+ self.output_dir = configs.get_path(comp+"/output_dir")
+ self.merger_mass_min = configs.getn(comp+"/merger_mass_min")
+ self.time_traceback = configs.getn(comp+"/time_traceback")
+ self.frequencies = configs.frequencies
+ self.filename_pattern = configs.getn("output/filename_pattern")
+ self.clobber = configs.getn("output/clobber")
logger.info("Loaded and set up configurations")
if self.use_dump_halos_data and (not self.use_dump_catalog_data):