diff options
author | Aaron LI <aly@aaronly.me> | 2018-01-02 19:28:37 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2018-01-02 19:28:37 +0800 |
commit | 13bae823e5417ae378c34b2e3d7b59792f2ab831 (patch) | |
tree | 6058fa9d41ead474555545c24f5d71dd7942a9d1 /fg21sim/extragalactic/clusters/halo.py | |
parent | 7f752fb4a5cfeb6fdcdc48844a0773f96d12ce69 (diff) | |
download | fg21sim-13bae823e5417ae378c34b2e3d7b59792f2ab831.tar.bz2 |
clusters: simplify _set_configs()
Diffstat (limited to 'fg21sim/extragalactic/clusters/halo.py')
-rw-r--r-- | fg21sim/extragalactic/clusters/halo.py | 38 |
1 files changed, 21 insertions, 17 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( |