axis = mpl.figure().gca()
mpl.axis('scaled')
model = [
    mesher.PolygonalPrism(mpl.draw_polygon(area, axis, xy2ne=True), 0, 1000,
                          {'density': 500})
]
# Calculate the effect
shape = (100, 100)
xp, yp, zp = gridder.regular(area, shape, z=-500)
data = [
    polyprism.gxx(xp, yp, zp, model),
    polyprism.gxy(xp, yp, zp, model),
    polyprism.gxz(xp, yp, zp, model),
    polyprism.gyy(xp, yp, zp, model),
    polyprism.gyz(xp, yp, zp, model),
    polyprism.gzz(xp, yp, zp, model)
]
# and plot it
titles = ['gxx', 'gxy', 'gxz', 'gyy', 'gyz', 'gzz']
mpl.figure()
mpl.axis('scaled')
mpl.suptitle("Gravity tensor produced by prism model (Eotvos)")
for i in xrange(len(data)):
    mpl.subplot(3, 2, i + 1)
    mpl.title(titles[i])
    mpl.contourf(yp, xp, data[i], shape, 20)
    mpl.colorbar()
    for p in model:
        mpl.polygon(p, '.-k', xy2ne=True)
    mpl.set_area(area)
    mpl.m2km()
        mpl.polygon(p, '.-k', xy2ne=True)
    mpl.set_area(area)
    model.append(
        mesher.PolygonalPrism(
            mpl.draw_polygon(area, fig.gca(), xy2ne=True),
            0, depth, {'density':500}))
# Calculate the effect
shape = (100, 100)
xp, yp, zp = gridder.regular(dataarea, shape, z=-500)
data = [
    polyprism.gxx(xp, yp, zp, model),
    polyprism.gxy(xp, yp, zp, model),
    polyprism.gxz(xp, yp, zp, model),
    polyprism.gyy(xp, yp, zp, model),
    polyprism.gyz(xp, yp, zp, model),
    polyprism.gzz(xp, yp, zp, model)]
# Calculate the 3 invariants
invariants = tensor.invariants(data)
data = data + invariants
# and plot it
mpl.figure()
mpl.axis('scaled')
mpl.suptitle("Tensor and invariants produced by prism model (Eotvos)")
titles = ['gxx', 'gxy', 'gxz', 'gyy', 'gyz', 'gzz', 'I1', 'I2', 'I']
for i in xrange(len(data)):
    mpl.subplot(3, 3, i + 1)
    mpl.title(titles[i])
    levels = 20
    if i == 8:
        levels = numpy.linspace(0, 1, levels)
    mpl.contourf(yp, xp, data[i], shape, levels)
def test_gzz_numpy():
    "polyprism.gzz cython vs numpy implementation"
    cy = polyprism.gzz(xp, yp, zp, model)
    py = _polyprism_numpy.gzz(xp, yp, zp, model)
    diff = np.abs(py - cy)
    assert np.all(diff <= precision), 'max diff: %g' % (max(diff))
def test_gzz():
    "polyprism.gzz against prism"
    resprism = prism.gzz(xp, yp, zp, prismmodel)
    respoly = polyprism.gzz(xp, yp, zp, model)
    diff = np.abs(resprism - respoly)
    assert np.all(diff <= precision), 'max diff: %g' % (max(diff))
Example #5
0
def test_gzz():
    "polyprism.gzz against prism"
    resprism = prism.gzz(xp, yp, zp, prismmodel)
    respoly = polyprism.gzz(xp, yp, zp, model)
    diff = np.abs(resprism - respoly)
    assert np.all(diff <= precision), 'max diff: %g' % (max(diff))
Example #6
0
def test_gzz_numpy():
    "polyprism.gzz cython vs numpy implementation"
    cy = polyprism.gzz(xp, yp, zp, model)
    py = _polyprism_numpy.gzz(xp, yp, zp, model)
    diff = np.abs(py - cy)
    assert np.all(diff <= precision), 'max diff: %g' % (max(diff))