[SciPy-User] wrong output shape calculation in scipy.ndimage.interpolation.zoom

Matthieu Rigal rigal@rapideye...
Mon Aug 1 12:47:30 CDT 2011

Hi guys,

I just detected a problem with the output shape calculation when running a 
zoom function.
Sometimes it returns an odd value, here is an example :
>>> import numpy
>>> from scipy.ndimage.interpolation import zoom
>>> aT = numpy.ones((5000,5000))
>>> aT2 = numpy.ones((556,463))
>>> aT3 = zoom(aT2, (float(aT.shape[0])/aT2.shape[0], 
>>> aT3.shape
(4999, 5000)

Whereas adding a very little incrementation factor produces it right :
>>> aT3 = zoom(aT2, (1.00001*float(aT.shape[0])/aT2.shape[0], 
>>> aT3.shape
(5000, 5000)

There must be somewhere a problem with the roundings... should I file a ticket 


RapidEye AG
Molkenmarkt 30
14776 Brandenburg an der Havel
Follow us on Twitter! www.twitter.com/rapideye_ag
Head Office/Sitz der Gesellschaft: Brandenburg an der Havel
Management Board/Vorstand: Wolfgang G. Biedermann,
                           Frederik Jung-Rothenhaeusler
Chairman of Supervisory Board/Vorsitzender des Aufsichtsrates: 
Juergen Breitkopf 
Commercial Register/Handelsregister Potsdam HRB 17 796
Tax Number/Steuernummer: 048/100/00053
VAT-Ident-Number/Ust.-ID: DE 199331235
DIN EN ISO 9001 certified
Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte
Informationen. Wenn Sie nicht der richtige Adressat sind oder diese
E-Mail irrtuemlich erhalten haben, informieren Sie bitte sofort den
Absender und vernichten Sie diese E-Mail. Das unerlaubte Kopieren sowie
die unbefugte Weitergabe dieser E-Mail ist nicht gestattet.
The information in this e-mail is intended for the named recipients
only. It may contain privileged and confidential information. If you
have received this communication in error, any use, copying or
dissemination of its contents is strictly prohibited. Please erase all
copies of the message along with any included attachments and notify
RapidEye AG or the sender immediately by telephone at the number
indicated on this page.

More information about the SciPy-User mailing list