From c15cb0c93eb931deb0c98d351367a7218b9465ea Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Mon, 23 Oct 2017 23:49:45 +0800 Subject: clusters/halos: Fix halo radius calculation Also change the parameter "nr" default to 2.0 for draw_halo() function. --- fg21sim/extragalactic/clusters/helper.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'fg21sim') diff --git a/fg21sim/extragalactic/clusters/helper.py b/fg21sim/extragalactic/clusters/helper.py index 7aed6dd..26b3ab3 100644 --- a/fg21sim/extragalactic/clusters/helper.py +++ b/fg21sim/extragalactic/clusters/helper.py @@ -351,7 +351,7 @@ def time_crossing(M_main, M_sub, z=0.0): return time -def draw_halo(radius, nr=1.5, felong=None, rotation=None): +def draw_halo(radius, nr=2.0, felong=None, rotation=None): """ Draw the template image of one halo, which is used to simulate the image at requested frequencies by adjusting the brightness @@ -372,7 +372,7 @@ def draw_halo(radius, nr=1.5, felong=None, rotation=None): nr : float, optional The times of ``radius`` to determine the size of the template image. - Default: 1.5 (corresponding to 3*1.5=4.5 re) + Default: 2.0 (corresponding to 3*2=6 re) felong : float, optional The elongated fraction of the elliptical halo, which is defined as the ratio of semi-minor axis to the semi-major axis. @@ -390,7 +390,9 @@ def draw_halo(radius, nr=1.5, felong=None, rotation=None): """ # Make halo radial brightness profile re = radius / 3.0 # e-folding radius - rmax = round(re * nr) + # NOTE: Use ``ceil()`` here to make sure ``rprofile`` has length >= 2, + # therefore the interpolation in ``circle()`` runs well. + rmax = int(np.ceil(radius*nr)) r = np.arange(rmax+1) rprofile = np.exp(-r/re) -- cgit v1.2.2