Skip to content

Problem in Image.rebin method

I'm using version 2.1 of mpdaf and I get the following error when I try to use the rebin method (obsvel is a mpdaf image):

obsvel.rebin(factor=(12,12))
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-30-6a5209008b92> in <module>()
----> 1 obsvel.rebin(factor=(12,12))

/Users/vera/anaconda/lib/python2.7/site-packages/mpdaf/obj/image.pyc in rebin(self, factor, margin, inplace)
   2723 
   2724         # Delegate the rebinning to the generic DataArray function.
-> 2725         res = self._rebin(factor, margin, inplace)
   2726 
   2727         # If the spatial frequency band-limits of the image have been

/Users/vera/anaconda/lib/python2.7/site-packages/mpdaf/obj/data.pyc in _rebin(self, factor, margin, inplace)
   1376         # At this point the dimensions are integer multiples of
   1377         # the reduction factors. What is the shape of the output image?
-> 1378         newshape = res.shape // factor
   1379 
   1380         # Create a list of array dimensions that are composed of each

TypeError: unsupported operand type(s) for //: 'tuple' and 'tuple'

I think changing res.shape to np.asarray(res.shape) solves the issue, but better check!

Vera