day2/MEDIA/m2/data/test.py
author Puneeth Chaganti <punchagan@fossee.in>
Tue, 27 Oct 2009 14:24:49 +0530
changeset 199 85a799d90c6a
parent 22 492017122355
permissions -rwxr-xr-x
Added a slide for transition from sslc to lstsq in session3.
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 = [-7.8710042803035831, -23.270734468965951, 26.848457084803901]
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.18791276028283388, 0.75198808427818908, 0.63182490899497246]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    21
scene.scene.camera.clipping_range = [21.722908882245918, 52.482070417945934]
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 = [-29.36388986802725, -16.258291095191616, 13.125528963969458]
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.17522011839126639, 0.35024314762581926, 0.92012371323214404]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    28
scene.scene.camera.clipping_range = [16.803351361631922, 58.674779759221536]
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.1832000017166138
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    33
surface.actor.property.line_width = 1.1831999999999998
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
module_manager1 = extract_vector_norm.children[0]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    44
engine.add_filter(outline, module_manager1)
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    45
scene.scene.camera.position = [-35.527291132838059, 1.5271766756373661, 3.1941487321866866]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    46
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
    47
scene.scene.camera.view_angle = 30.0
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    48
scene.scene.camera.view_up = [0.061459962287939186, 0.30146804029963314, 0.9514934018233987]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    49
scene.scene.camera.clipping_range = [16.205447930141609, 60.499114495812179]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    50
scene.scene.camera.compute_view_plane_normal()
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    51
scene.scene.render()
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    52
streamline.seed.widget.center = array([-0.25031545, -0.70449392, -2.82145082])
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    53
streamline.seed.widget.handle_direction = array([ 1.,  0.,  0.])
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    54
scene.scene.camera.position = [-18.768485102212434, -27.67378446387562, 13.212726909551698]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    55
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
    56
scene.scene.camera.view_angle = 30.0
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    57
scene.scene.camera.view_up = [0.43630018818630739, 0.090909067630530527, 0.89519701027826293]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    58
scene.scene.camera.clipping_range = [12.911509899232243, 64.852594297042543]
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    59
scene.scene.camera.compute_view_plane_normal()
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    60
scene.scene.render()
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    61
streamline.seed.widget.center = array([-4.35750409,  1.91665121, -3.10118704])
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    62
streamline.seed.widget.handle_direction = array([ 1.,  0.,  0.])
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    63
streamline.seed.widget.center = array([-4.35750409,  1.91665121, -3.10118704])
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    64
streamline.seed.widget.handle_direction = array([ 1.,  0.,  0.])
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    65
# ------------------------------------------- 
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    66
from enthought.mayavi.tools.show import show
492017122355 Added files for Session 3 Day2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    67
show()