diff options
Diffstat (limited to 'fg21sim')
-rw-r--r-- | fg21sim/sky.py | 3 | ||||
-rw-r--r-- | fg21sim/utils/transform.py | 5 |
2 files changed, 6 insertions, 2 deletions
diff --git a/fg21sim/sky.py b/fg21sim/sky.py index ab7f42b..ede9c1d 100644 --- a/fg21sim/sky.py +++ b/fg21sim/sky.py @@ -504,7 +504,8 @@ class SkyPatch(SkyBase): if (self.xsize_in != self.xsize) or (self.ysize_in != self.ysize): logger.warning("Scale input sky patch to size %dx%d" % (self.xsize, self.ysize)) - zoom = (self.ysize/self.ysize_in, self.xsize/self.xsize_in) + zoom = ((self.ysize+0.1)/self.ysize_in, + (self.xsize+0.1)/self.xsize_in) self.data = ndimage.zoom(self.data, zoom=zoom, order=1) def write(self, outfile, clobber=None): diff --git a/fg21sim/utils/transform.py b/fg21sim/utils/transform.py index 3fc64ca..c897f70 100644 --- a/fg21sim/utils/transform.py +++ b/fg21sim/utils/transform.py @@ -171,7 +171,10 @@ def circle2ellipse(imgcirc, bfraction, rotation=0.0): # Shrink the circle to be elliptical nrow2 = nrow * bfraction nrow2 = int(nrow2 / 2) * 2 + 1 # be odd - img2 = ndimage.zoom(imgcirc, zoom=(nrow2/nrow, 1.0), order=1) + # NOTE: zoom() calculate the output shape with round() instead of int(); + # fix the warning about they may be different. + zoom = ((nrow2+0.1)/nrow, 1) + img2 = ndimage.zoom(imgcirc, zoom=zoom, order=1) # Pad the shrunk image to have the same size as input imgout = np.zeros(shape=(nrow, ncol)) r1 = int((nrow - nrow2) / 2) |