示例#1
0
def update(chset):
    mlab.get_engine().scenes[0].children[-1].remove()
    new = numpy.array([estimate[chset['new']]])
    pnew = vis.plot_prism_mesh(new, style='surface', xy2ne=True)    
    neighbors = numpy.array([setden(e, chset['dens']) for e in [estimate[n] for n in chset['nn']]])
    pnn = vis.plot_prism_mesh(neighbors, style='wireframe', xy2ne=True)
    pnn.actor.property.color = neighborcolor
    pnn.actor.property.line_width = 1
    pos = 0
    scale = 800
    Z = numpy.reshape(data['value'] - chset['res'], dshape)
    ct = mlab.contour_surf(X, Y, Z, contours=10, colormap='jet')
    ct.contour.filled_contours = True
    ct.actor.actor.position = (0,0,pos)
    ct.actor.actor.scale = (1,1,scale)
示例#2
0
def init(changes, ns):
    for chset in changes[0:ns]:
        seed = numpy.array([estimate[chset['new']]])
        pnew = vis.plot_prism_mesh(seed, style='surface', xy2ne=True)
        mlab.get_engine().scenes[0].children[-1].children[0].children[0].children[0].scalar_lut_manager.data_range = [0,1000]
         
        neighbors = numpy.array([setden(e, chset['dens']) for e in [estimate[n] for n in chset['nn']]])
        pnn = vis.plot_prism_mesh(neighbors, style='wireframe', xy2ne=True)
        pnn.actor.property.color = neighborcolor
        pnn.actor.property.line_width = 1
    pos = 0
    scale = 800
    Z = numpy.reshape(data['value'] - changes[ns-1]['res'], dshape)
    ct = mlab.contour_surf(X, Y, Z, contours=10, colormap='jet')
    ct.contour.filled_contours = True
    ct.actor.actor.position = (0,0,pos)
    ct.actor.actor.scale = (1,1,scale)
示例#3
0
p = vis.plot_prism_mesh(mesh, style='surface', opacity=0.4)
#p.actor.mapper.scalar_visibility = False
#p.actor.property.color = (0,0,0)
p.actor.property.line_width = 5

#a = mlab.axes(p, nb_labels=0, extent=extent, color=(0,0,0))
#a.label_text_property.color = (0,0,0)
#a.title_text_property.color = (0,0,0)
#a.axes.label_format = ""
#a.axes.x_label, a.axes.y_label, a.axes.z_label = "", "", ""
#a.property.line_width = 3

for field, pos, scale in zip(fields, [500, 2000], [25, 40]):
    Y, X, Z = utils.extract_matrices(data[field])
    p = mlab.contour_surf(X, Y, Z, contours=10, colormap='Greys')
    p.contour.filled_contours = True
    p.actor.actor.position = (0,0,pos)
    p.actor.actor.scale = (1,1,scale)

    #a = mlab.axes(p, nb_labels=0, extent=[0,3000,0,3000,pos,pos + scale*Z.max()], color=(0,0,0))
    #a.label_text_property.color = (0,0,0)
    #a.title_text_property.color = (0,0,0)
    #a.axes.label_format = ""
    #a.axes.x_label, a.axes.y_label, a.axes.z_label = "", "", ""
    #a.property.line_width = 3
    
fig.scene.camera.position = [-3146.9567922907049, -9163.4060799024755, 5741.7604134051016]
fig.scene.camera.focal_point = [1480.0106958881547, 1276.2836085370318, -489.3486831029677]
fig.scene.camera.view_angle = 30.0
fig.scene.camera.view_up = [0.18978015606974949, 0.43982063770127594, 0.87780481829059498]
示例#4
0
    data = collect("P", path=path)

    nt = data.shape[0]

    ns = data.shape[1]
    ne = data.shape[2]
    nz = data.shape[3]

    f = mlab.figure(size=(600, 600))
    # Tell visual to use this as the viewer.
    visual.set_viewer(f)

    # First way

    s1 = contour_surf(data[0, :, :, 10] + 0.1,
                      contours=30,
                      line_width=0.5,
                      transparent=True)
    s = surf(data[0, :, :, 10] + 0.1, colormap="Spectral"
             )  # , warp_scale='.1')#, representation='wireframe')

    # second way

    # x, y= mgrid[0:ns:1, 0:ne:1]
    # s = mesh(x,y,data[0,:,:,10], colormap='Spectral')#, warp_scale='auto')
    # #, representation='wireframe')
    s.enable_contours = True
    s.contour.filled_contours = True
    #

    # x, y, z= mgrid[0:ns:1, 0:ne:1, 0:nz:1]
    #
示例#5
0
mlab.get_engine().scenes[0].children[-1].children[0].children[0].children[0].scalar_lut_manager.data_range = [0,2000]

#a = mlab.axes(p, nb_labels=0, extent=extent, color=(0,0,0))
#a.label_text_property.color = (0,0,0)
#a.title_text_property.color = (0,0,0)
#a.axes.label_format = ""
#a.axes.x_label, a.axes.y_label, a.axes.z_label = "", "", ""
#a.property.line_width = 1

mlab.outline(p, extent=extent, color=(0,0,0))

pos = 1000
field = 'gz'
scale = 200
Y, X, Z = utils.extract_matrices(data[field])
p = mlab.contour_surf(X, Y, Z, contours=10, colormap='jet')
p.contour.filled_contours = True
p.actor.actor.position = (0,0,pos)
p.actor.actor.scale = (1,1,scale)

a = mlab.axes(p, nb_labels=0, extent=[0,3000,0,3000,pos,pos + scale*Z.max()], color=(0,0,0))
a.label_text_property.color = (0,0,0)
a.title_text_property.color = (0,0,0)
a.axes.label_format = ""
a.axes.x_label, a.axes.y_label, a.axes.z_label = "", "", ""
a.property.line_width = 1

scene = fig
scene.scene.camera.position = [5845.7904104772751, 10826.008452051316, 3697.0607477775502]
scene.scene.camera.focal_point = [1317.7924322687745, 1352.1830042500999, -1036.6534494994289]
scene.scene.camera.view_angle = 30.0
示例#6
0
mlab.outline(color=(0,0,0), extent=extent)

#pos = 0
#scale = 800
#Z = utils.extract_matrices(adj)[-1]
#p = mlab.contour_surf(X, Y, Z, contours=10, colormap='jet')
#p.contour.filled_contours = True
#p.actor.actor.position = (0,0,pos)
#p.actor.actor.scale = (1,1,scale)

pos = 1300
field = 'gz'
scale = 800
Z = utils.extract_matrices(data)[-1]
p = mlab.contour_surf(X, Y, Z, contours=10, colormap='jet')
p.contour.filled_contours = True
p.actor.actor.position = (0,0,pos)
p.actor.actor.scale = (1,1,scale)
setview(scene)
mlab.savefig("chset%04d.png" % (0))

ns = 2
init(changes, ns)
setview(scene)
mlab.savefig("chset%04d.png" % (1)) 

for i, chset in enumerate(changes[ns:]):
    update(chset)
    setview(scene)
    mlab.savefig("chset%04d.png" % (i+2))
示例#7
0
# -*- coding: utf-8 -*-
import numpy as np
from enthought.mayavi import mlab

x, y = np.ogrid[-2:2:20j, -2:2:20j]
z = x * np.exp(-x**2 - y**2)

mlab.figure(1)
pl = mlab.imshow(x, y, z)

mlab.figure(2)
pl = mlab.contour_surf(x, y, z, contours=20)
mlab.show()
# -*- coding: utf-8 -*-
import numpy as np
from enthought.mayavi import mlab

x, y = np.ogrid[-2:2:20j, -2:2:20j]
z = x * np.exp( - x**2 - y**2)

mlab.figure(1)
pl = mlab.imshow(x, y, z)

mlab.figure(2)
pl = mlab.contour_surf(x, y, z, contours=20)
mlab.show()