day2/MEDIA/m2/data/record.py
author Madhusudan.C.S <madhusudancs@gmail.com>
Tue, 10 Nov 2009 16:26:47 +0530
changeset 298 df494695e061
parent 22 492017122355
permissions -rwxr-xr-x
Added all day 2 slides.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
22
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     1
# Recorded script from Mayavi2
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     2
from numpy import array
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     3
try:
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     4
    engine = mayavi.engine
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     5
except NameError:
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     6
    from enthought.mayavi.api import Engine
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     7
    engine = Engine()
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     8
    engine.start()
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     9
if len(engine.scenes) == 0:
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    10
    engine.new_scene()
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    11
# ------------------------------------------- 
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    12
scene = engine.scenes[0]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    13
vtkxml_file_reader = engine.open(u'/Users/prabhu/work/MEDIA/m2/data/solution.vtp', scene)
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    14
from enthought.mayavi.modules.surface import Surface
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    15
surface = Surface()
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    16
engine.add_filter(surface, vtkxml_file_reader)
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    17
scene.scene.camera.position = [-5.0805380472988206, -22.772737120755238, 27.951999647518075]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    18
scene.scene.camera.focal_point = [-0.30313491821289062, 0.0, 1.4027749300003052]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    19
scene.scene.camera.view_angle = 30.0
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    20
scene.scene.camera.view_up = [-0.1142423672711194, 0.76412329986979977, 0.63487342369670707]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    21
scene.scene.camera.clipping_range = [22.838642391722981, 51.077591804257452]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    22
scene.scene.camera.compute_view_plane_normal()
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    23
scene.scene.render()
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    24
scene.scene.camera.position = [-26.79814746753679, -17.616423028517339, 16.698474306673273]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    25
scene.scene.camera.focal_point = [-0.30313491821289062, 0.0, 1.4027749300003052]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    26
scene.scene.camera.view_angle = 30.0
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    27
scene.scene.camera.view_up = [0.117668827287714, 0.54423876670086724, 0.83063723243342136]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    28
scene.scene.camera.clipping_range = [16.95271984178639, 58.486755617116714]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    29
scene.scene.camera.compute_view_plane_normal()
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    30
scene.scene.render()
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    31
surface.actor.property.edge_visibility = True
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    32
surface.actor.property.line_width = 1.0908000469207764
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    33
surface.actor.property.line_width = 1.0908
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    34
vtkxml_file_reader1 = engine.open(u'/Users/prabhu/work/MEDIA/m2/data/shuttle_flow_vel.vti', scene)
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    35
from enthought.mayavi.filters.extract_vector_norm import ExtractVectorNorm
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    36
extract_vector_norm = ExtractVectorNorm()
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    37
engine.add_filter(extract_vector_norm, vtkxml_file_reader1)
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    38
from enthought.mayavi.modules.streamline import Streamline
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    39
streamline = Streamline()
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    40
engine.add_filter(streamline, extract_vector_norm)
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    41
from enthought.mayavi.modules.outline import Outline
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    42
outline = Outline()
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    43
engine.add_filter(outline, extract_vector_norm)
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    44
scene.scene.camera.position = [-26.161739435640946, -23.33968605285963, -4.330818803012459]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    45
scene.scene.camera.focal_point = [-0.30313491821289062, 0.0, 1.4027749300003052]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    46
scene.scene.camera.view_angle = 30.0
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    47
scene.scene.camera.view_up = [-0.41262625326967384, 0.24138827815138408, 0.87833437498696409]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    48
scene.scene.camera.clipping_range = [12.567524761986057, 64.885104918139973]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    49
scene.scene.camera.compute_view_plane_normal()
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    50
scene.scene.render()
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    51
scene.scene.camera.position = [-33.987476012111991, 7.0742035800218508, 9.2515505356797192]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    52
scene.scene.camera.focal_point = [-0.30313491821289062, 0.0, 1.4027749300003052]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    53
scene.scene.camera.view_angle = 30.0
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    54
scene.scene.camera.view_up = [0.27210126222372499, 0.27131677472862931, 0.92322700937911817]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    55
scene.scene.camera.clipping_range = [13.498366440121661, 63.78023185599239]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    56
scene.scene.camera.compute_view_plane_normal()
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    57
scene.scene.render()
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    58
streamline.seed.widget.center = array([-1.76092294, -2.19636703, -4.07769924])
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    59
streamline.seed.widget.handle_direction = array([ 1.,  0.,  0.])
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    60
scene.scene.camera.position = [-0.14627247022011527, 35.246003093475835, -0.59149933326899151]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    61
scene.scene.camera.focal_point = [-0.30313491821289062, 0.0, 1.4027749300003052]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    62
scene.scene.camera.view_angle = 30.0
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    63
scene.scene.camera.view_up = [0.10775362069649223, 0.055684269920481991, 0.99261695497821301]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    64
scene.scene.camera.clipping_range = [22.165106941458703, 51.720503614694223]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    65
scene.scene.camera.compute_view_plane_normal()
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    66
scene.scene.render()
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    67
streamline.seed.widget.center = array([-9.46036585, -1.98695846, -0.98230673])
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    68
streamline.seed.widget.handle_direction = array([ 1.,  0.,  0.])
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    69
scene.scene.camera.position = [-24.531837698557823, -25.223630761907124, -3.3952332503501701]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    70
scene.scene.camera.focal_point = [-0.30313491821289062, 0.0, 1.4027749300003052]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    71
scene.scene.camera.view_angle = 30.0
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    72
scene.scene.camera.view_up = [-0.014255927708073379, -0.17361673895115709, 0.98471010783943314]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    73
scene.scene.camera.clipping_range = [10.590545716157719, 65.485850871289045]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    74
scene.scene.camera.compute_view_plane_normal()
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    75
scene.scene.render()
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    76
# ------------------------------------------- 
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    77
from enthought.mayavi.tools.show import show
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    78
show()