aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim/utils
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-08-12 22:04:02 +0800
committerAaron LI <aly@aaronly.me>2017-08-12 22:04:02 +0800
commit973dda47633d99c844ff08f354f17a2b75a7f448 (patch)
tree02d13d3ea62457daff1171ae21b4776a548e73ae /fg21sim/utils
parent33ff42254e4da928f0cac38eb3f10f976e9c8d83 (diff)
downloadfg21sim-973dda47633d99c844ff08f354f17a2b75a7f448.tar.bz2
utils/transform.py: Update comment and minor cleanups
Signed-off-by: Aaron LI <aly@aaronly.me>
Diffstat (limited to 'fg21sim/utils')
-rw-r--r--fg21sim/utils/transform.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/fg21sim/utils/transform.py b/fg21sim/utils/transform.py
index 63fad94..3fc64ca 100644
--- a/fg21sim/utils/transform.py
+++ b/fg21sim/utils/transform.py
@@ -156,7 +156,7 @@ def circle2ellipse(imgcirc, bfraction, rotation=0.0):
Input image grid containing a circle at the center
bfraction : float
The fraction of the semi-minor axis w.r.t. the semi-major axis
- (assumed to be the width of the input image), to determine the
+ (i.e., the half width of the input image), to determine the
shrunk size (height) of the output image.
Should be a fraction within [0, 1]
rotation : float, optional
@@ -175,9 +175,7 @@ def circle2ellipse(imgcirc, bfraction, rotation=0.0):
# Pad the shrunk image to have the same size as input
imgout = np.zeros(shape=(nrow, ncol))
r1 = int((nrow - nrow2) / 2)
- r2 = r1 + nrow2
- imgout[r1:r2, :] = img2
+ imgout[r1:(r1+nrow2), :] = img2
# Rotate the ellipse
- imgout = ndimage.rotate(imgout, angle=rotation, reshape=False,
- order=1)
+ imgout = ndimage.rotate(imgout, angle=rotation, reshape=False, order=1)
return imgout