MemoryError when running Numpy Meshgrid

Posted by joaoc on Stack Overflow See other posts from Stack Overflow or by joaoc
Published on 2010-03-17T08:02:13Z Indexed on 2010/03/17 8:21 UTC
Read the original article Hit count: 180

Filed under:
|
|

I have 8823 data points with x,y coordinates. I'm trying to follow the answer on how to get a scatter dataset to be represented as a heatmap but when I go through the

X, Y = np.meshgrid(x, y)

instruction with my data arrays I get MemoryError. I am new to numpy and matplotlib and am essentially trying to run this by adapting the examples I can find.

Here's how I built my arrays from a file that has them stored:

XY_File = open ('XY_Output.txt', 'r')
XY = XY_File.readlines()
XY_File.close()

Xf=[]
Yf=[]
for line in XY:
    Xf.append(float(line.split('\t')[0]))
    Yf.append(float(line.split('\t')[1]))
x=array(Xf)
y=array(Yf)

Is there a problem with my arrays? This same code worked when put into this example but I'm not too sure.

Why am I getting this MemoryError and how can I fix this?

© Stack Overflow or respective owner

Related posts about python

Related posts about numpy