4

I am running this code:

F = interpolate.Rbf(X,Y,Z,V, function = 'linear')

Where X,Y,Z and V shapes are:

(1300, 691, 122)
(1300, 691, 122)
(1300, 691, 122)
(1300, 691, 122)

and i am getting this error every time i run my script.

Traceback (most recent call last):
  File "make3d.py", line 180, in <module>
    main(sys.argv[1:])
  File "make3d.py", line 133, in main
    F = interpolate.Rbf(X,Y,Z,V, function = 'linear')
  File "/anaconda2/lib/python2.7/site-packages/scipy/interpolate/rbf.py", line 200, in __init__
    r = self._call_norm(self.xi, self.xi)
  File "/anaconda2/lib/python2.7/site-packages/scipy/interpolate/rbf.py", line 231, in _call_norm
    return self.norm(x1, x2)
  File "/anaconda2/lib/python2.7/site-packages/scipy/interpolate/rbf.py", line 118, in _euclidean_norm
    return np.sqrt(((x1 - x2)**2).sum(axis=0))
MemoryError

At first i thought it was my laptop's fault so i tried in a 30 core desktop and i got exactly the same error message. I can't understand what is wrong. Any suggestions or alternative functions?

Christos ZS
  • 109
  • 2
  • 11
  • 1
    Not a duplicate but closely related: http://stackoverflow.com/questions/11865378/python-memoryerror-in-scipy-radial-basis-function-scipy-interpolate-rbf – paisanco Sep 29 '16 at 01:54
  • I saw his post, but it is stated that in that case the RAM needed was 1.72 GiB. My samples are maybe a bit more than those in the post but also my RAM is `MemTotal: 198015432 kB` (print from `grep MemTotal /proc/meminfo` ) – Christos ZS Sep 29 '16 at 03:37
  • 5
    In that traceback, `x1` and `x2` are going to have shapes `(3, 109592600, 1)` and `(3, 1, 109592600)` respectively. `x1 - x2` will therefore broadcast out to a `(3, 109592600, 109592600)` array, containing 36031613924280000 (36 *quadrillion*) elements! Assuming you're dealing with 64bit floats, the result would fill about 290 *petabytes* of RAM. Unless you have access to the equivalent of about 415 [Titan supercomputers](https://en.wikipedia.org/wiki/Titan_(supercomputer))'s worth of RAM, I suggest you try with fewer datapoints... – ali_m Sep 29 '16 at 19:54

0 Answers0