Numpy and cPickle

M

Martin Manns

Hi

If I cPickle a numpy array under Linux and un-cPickle it under Solaris
10, my arrays seem to be transposed. Is there any way to get the same
behavior on both platforms without testing which platform the python
script runs on and then transposing the array?

I am using python 2.4.2 and numpy 0.9.6 on both machines.

Thanks in advance

Martin
 
R

Robert Kern

Martin said:
Hi

If I cPickle a numpy array under Linux and un-cPickle it under Solaris
10, my arrays seem to be transposed. Is there any way to get the same
behavior on both platforms without testing which platform the python
script runs on and then transposing the array?

I am using python 2.4.2 and numpy 0.9.6 on both machines.

Transposed? That's odd. There was a byteorder issue with pickles going across
differently-endianed platforms that was fixed in the past few days. Could you
come up with a small bit of code that shows the problem and post it and the
incorrect output to the bug tracker?

http://projects.scipy.org/scipy/numpy/newticket

Thank you!

--
Robert Kern
(e-mail address removed)

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
 
M

Martin Manns

Robert said:
Martin Manns wrote:
Transposed? That's odd. There was a byteorder issue with pickles going across
differently-endianed platforms that was fixed in the past few days. Could you
come up with a small bit of code that shows the problem and post it and the
incorrect output to the bug tracker?

Sorry, I my ad-hoc small example does not reproduce the error even
though the files generated on both platforms differ. I will try to set
up the code tomorrow.

Thank you though for the fast response

Martin
 
M

Mr. M

Martin said:
Sorry, I my ad-hoc small example does not reproduce the error even
though the files generated on both platforms differ. I will try to set
up the code tomorrow.

Somehow, the bug does not show up any more. I believe it was due to the
numpy version that is fetched by cPickle. Is there any way to control
(or even determine), which library version cPickle grabs for unpickling
a numpy array (numpy, scipy, etc)?
 
R

Robert Kern

Mr. M said:
Somehow, the bug does not show up any more. I believe it was due to the
numpy version that is fetched by cPickle. Is there any way to control
(or even determine), which library version cPickle grabs for unpickling
a numpy array (numpy, scipy, etc)?

You can import the appropriate module first. Then it will be in sys.modules and
be picked up during unpickling. You may have to do some sys.path manipulation if
you have more than one version lieing about on your filesystem.

--
Robert Kern
(e-mail address removed)

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,293
Messages
2,571,501
Members
48,189
Latest member
StaciLgf76

Latest Threads

Top