On 23 August 2013 16:59, Benjamin Root <[email protected]> wrote: > A lot of the code you have here can be greatly simplified. I would start > with just trying to get rid of appends as much as possible and use > preallocated arrays with np.empty() or np.ones() or the likes.
Also, if you don't know beforehand the final size of the array (I find difficult to follow the flow of the program, it is quite lengthy), you can use lists as a temporary thing: results = [] while SomeCondition: do_something() results.append(res) results = np.array(res) Also, it may also help to trace things down encapsulate pieces of code inside functions. There are two reasons for this: it will make the code more readable, easier to test, and you could run independently pieces of code to find where is your memory growing. I hope it is of any help. David. _______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
