Source of the error between computers (version, architecture, etc)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Source of the error between computers (version, architecture, etc)

Sergi Pons Freixes-3
Hi all,

I have some code that runs perfectly on:

Linux Toshiba-00 2.6.32-33-generic #72-Ubuntu SMP Fri Jul 29 21:08:37
UTC 2011 i686 GNU/Linux
Python 2.6.5
Numpy 1.3.0

But on this machine:

Linux mirto 3.0-ARCH #1 SMP PREEMPT Tue Aug 30 08:53:25 CEST 2011
x86_64 Intel(R) Core(TM) i5-2500 CPU @ 3.30GHz GenuineIntel GNU/Linux
Python 2.7.2
Numpy 1.6.1

I'm getting this error:

$ python main.py
Traceback (most recent call last):
 File "main.py", line 32, in <module>
   data = aldp.merge_max_irta(data, irta)
 File "/home/sergi/Dropbox/doctorat/alfacs/codi/aldp.py", line 378,
in merge_max_irta
   data = np.hstack((maxd, irta))
 File "/usr/lib/python2.7/site-packages/numpy/core/shape_base.py",
line 270, in hstack
   return _nx.concatenate(map(atleast_1d,tup),1)
TypeError: invalid type promotion

Google hasn't helped much when searching about "TypeError: invalid
type promotion" and similar queries. To reduce the uncertainty, I
would like to know if the cause could be the difference in versions of
the software, a different architecture (32 bits vs 64), or whatever.
Any clue?

Regards,
Sergi
_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: Source of the error between computers (version, architecture, etc)

Jerome Kieffer
On Tue, 11 Oct 2011 12:19:30 +0200
Sergi Pons Freixes <[hidden email]> wrote:

> Hi all,
>
> I have some code that runs perfectly on:
>
> Linux Toshiba-00 2.6.32-33-generic #72-Ubuntu SMP Fri Jul 29 21:08:37
> UTC 2011 i686 GNU/Linux
> Python 2.6.5
> Numpy 1.3.0
>
> But on this machine:
>
> Linux mirto 3.0-ARCH #1 SMP PREEMPT Tue Aug 30 08:53:25 CEST 2011
> x86_64 Intel(R) Core(TM) i5-2500 CPU @ 3.30GHz GenuineIntel GNU/Linux
> Python 2.7.2
> Numpy 1.6.1
>
> I'm getting this error:

In python 2.6, many operation are done in the native type (uint8 for example) what can lead to "odd" behavour. You should use dtype="float" in sum or mean methods of ndarray.

In python 2.7 the default type is switched to float, what changes some result and can break tests but the results are usually "better".

Hop this helps
--
Jerome Kieffer <[hidden email]>
Online Data Analysis / SoftGroup

_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user