Hi all, I tried to plot parts of a large 3D array with each 4 float64 entries. Loading the array with numpy.fromfile and performing a type conversion afterwards ends up in a MemoryError.
The following code reproduces the error: *********************************** import gc from os import path from numpy import zeros, empty, float32, float64, fromfile # With the imports of the next three lines a memory error occurs #import matplotlib #matplotlib.use("AGG") #import matplotlib.pylab as plt _filename = "mt.dat" if (path.exists(_filename)==False): print "Write file ..." _mtf = file(_filename, "wb") _mtd = zeros( (300,300,300,4),dtype=float64) _mtd.tofile(_mtf) _mtf.close() _mtd = empty((0)) gc.collect(); print "Try to read file ..." _mtf = file(_filename, "rb") # The memory error occurs with the type conversion to float 64, # but only if mathplotlib is imported! _mtd = fromfile(_mtf,float64).astype(float32) _mtf.close() print "Successful read:",_mtd.shape # Here some plot stuff would be :) *********************************** If the import of matplotlib is not included, no error occures otherwise it will not work. Perhaps anybody can help me (I tested it only on a Windows XP 32Bit). Best regards and thank you Stefan -- View this message in context: http://old.nabble.com/MemoryError-with-import-matplotlib-tp30674798p30674798.html Sent from the matplotlib - users mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Protect Your Site and Customers from Malware Attacks Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing. http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users