[Numpy-discussion] weird interaction: pickle, numpy, matplotlib.hist

Andrew Jaffe a.h.jaffe at gmail.com
Wed Apr 5 08:18:03 CDT 2006

Hi All,

I've encountered a strange problem: I've been running some python code 
on both a linux box and OS X, both with python 2.4.1 and the latest 
numpy and matplotlib from svn.

I have found that when I transfer pickled numpy arrays from one machine 
to the other (in either direction), the resulting data *looks* all right 
(i.e., it is a numpy array of the correct type with the correct values 
at the correct indices), but it seems to produce the wrong result in (at 
least) one circumstance: matplotlib.hist() gives the completely wrong 
picture (and set of bins).

This can be ameliorated by running the array through
    arr=numpy.asarray(arr, dtype=numpy.float64)
but this seems like a complete kludge (and is only needed when you do 
the transfer between machines).

I've attached a minimal code that exhibits the problem: try
on one machine, transfer the output file to another machine, and run
on another, and you should see a very strange result (and it should be 
fixed if you set asarray=True).

Any ideas?

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test_pickle_hist.py
Url: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20060405/ca428697/attachment.pl 

More information about the Numpy-discussion mailing list