Python Numpy Maximum Recursion Depth Exceeded