aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-08-13 23:52:41 +0800
committerAaron LI <aly@aaronly.me>2017-08-13 23:52:41 +0800
commit9bde3eea7ba531c7d1f96a7430f7d8ef0d9acbc0 (patch)
treeb6ce91822c56f96d4fbb1ccb494cbfe8f2204227 /fg21sim
parentd1cc715fc64a9d47d65e39a7bd851dee88b748d8 (diff)
downloadfg21sim-9bde3eea7ba531c7d1f96a7430f7d8ef0d9acbc0.tar.bz2
Fix several bugs
* Brought back "clobber" property * Delete the wrong "self.halos=[]" * Fix the wrong assignment of "cimax0" * Assign default values for {c,r}i{min,max}1 Signed-off-by: Aaron LI <aly@aaronly.me>
Diffstat (limited to 'fg21sim')
-rw-r--r--fg21sim/extragalactic/clusters/main.py14
-rw-r--r--fg21sim/sky.py5
2 files changed, 7 insertions, 12 deletions
diff --git a/fg21sim/extragalactic/clusters/main.py b/fg21sim/extragalactic/clusters/main.py
index 610e60b..cb2d7b8 100644
--- a/fg21sim/extragalactic/clusters/main.py
+++ b/fg21sim/extragalactic/clusters/main.py
@@ -84,16 +84,9 @@ class GalaxyClusters:
self.merger_mass_min = self.configs.getn(comp+"/merger_mass_min")
self.ratio_major = self.configs.getn(comp+"/ratio_major")
self.tau_merger = self.configs.getn(comp+"/tau_merger")
-
self.frequencies = self.configs.frequencies
self.filename_pattern = self.configs.getn("output/filename_pattern")
-
- # Sky and resolution
- if self.sky.type_ == "patch":
- self.resolution = self.sky.pixelsize # [arcsec]
- else:
- raise NotImplementedError("TODO: full-sky simulations")
-
+ self.clobber = self.configs.getn("output/clobber")
logger.info("Loaded and set up configurations")
def _simulate_catalog(self):
@@ -309,11 +302,10 @@ class GalaxyClusters:
"""
num = len(self.halos)
logger.info("Draw template images for %d halos ..." % num)
- self.halos = []
i = 0
for hdict in self.halos:
i += 1
- if i % 50 == 0:
+ if i % 100 == 0:
logger.info("[%d/%d] %.1f%% ..." % (i, num, 100*i/num))
theta_e = hdict["angular_radius"] / self.sky.pixelsize
rprofile = helper.halo_rprofile(re=theta_e)
@@ -392,7 +384,7 @@ class GalaxyClusters:
center = (hdict["lon"], hdict["lat"])
template = hdict["template"] # normalized to have mean of 1
Npix = template.size
- flux = hdict["flux[%d]" % freqidx] # [Jy]
+ flux = hdict["flux"][freqidx] # [Jy]
Tmean = (flux/Npix) * JyPP2K # [K]
Timg = Tmean * template # [K]
sky.add(Timg, center=center)
diff --git a/fg21sim/sky.py b/fg21sim/sky.py
index e0d4a4a..ab7f42b 100644
--- a/fg21sim/sky.py
+++ b/fg21sim/sky.py
@@ -427,7 +427,10 @@ class SkyPatch(SkyBase):
# Index ranges (inclusive at both ends) for the supplied object
# image on the sky array
rimin0, rimax0 = ric - nrow//2, ric + (nrow-1)//2
- cimin0, cimax0 = cic - ncol//2, ric + (ncol-1)//2
+ cimin0, cimax0 = cic - ncol//2, cic + (ncol-1)//2
+ # Index ranges for the supplied object image
+ rimin1, rimax1 = 0, nrow-1
+ cimin1, cimax1 = 0, ncol-1
# Check the object boundaries
if ((rimin0 >= self.ysize) or (rimax0 < 0) or