In [1]:
%matplotlib inline
import numpy as np
from fatiando import gridder, utils
from fatiando.mesher import PointGrid, Sphere
from fatiando.gravmag import sphere, _sphere_numpy
In [2]:
model = PointGrid((-500, 500, -500, 500), 100, (5, 5))
model.addprop('density', np.ones(model.size))
model.addprop('magnetization', utils.ang2vec(2*np.ones(model.size), 25, -10))
inc, dec = -30, 50
x, y, z = gridder.regular((-500, 500, -500, 500), (200, 200), z=-1)
In [3]:
%timeit sphere.gz(x, y, z, model)
In [4]:
%timeit _sphere_numpy.gz(x, y, z, model)
In [5]:
%timeit sphere.gzz(x, y, z, model)
In [6]:
%timeit _sphere_numpy.gzz(x, y, z, model)
In [7]:
%timeit sphere.tf(x, y, z, model, inc, dec)
In [8]:
%timeit _sphere_numpy.tf(x, y, z, model, inc, dec)
In [9]:
model2 = PointGrid((-500, 500, -500, 500), 100, (100, 100))
model2.addprop('density', np.ones(model2.size))
model2.addprop('magnetization', utils.ang2vec(2*np.ones(model2.size), 25, -10))
x2, y2, z2 = gridder.regular((-500, 500, -500, 500), (20, 20), z=-1)
In [10]:
%timeit sphere.gz(x2, y2, z2, model2)
In [11]:
%timeit _sphere_numpy.gz(x2, y2, z2, model2)
In [12]:
%timeit sphere.gzz(x2, y2, z2, model2)
In [13]:
%timeit _sphere_numpy.gzz(x2, y2, z2, model2)
In [14]:
%timeit sphere.tf(x2, y2, z2, model2, inc, dec)
In [15]:
%timeit _sphere_numpy.tf(x2, y2, z2, model2, inc, dec)
In [15]: