

def do(self):
    from mayavi.filters.optional import Optional
    from mayavi.filters.user_defined import UserDefined
    from mayavi.filters.api import CellToPointData, ExtractVectorNorm, ExtractVectorComponents
    from mayavi.modules.api import ScalarCutPlane
    from mayavi.sources.vtk_xml_file_reader import VTKXMLFileReader
    s = self.new_scene()
    script = mayavi = self.script
    r = VTKXMLFileReader()
    r.initialize(get_example_data('fire_ug.vtu'))
    script.add_source(r)
    cd = tvtk.CellDerivatives()
    ud = UserDefined(filter=cd)
    script.add_filter(ud)
    ctp = CellToPointData()
    ctp.filter.pass_cell_data = False
    script.add_filter(ctp)
    evn = ExtractVectorNorm()
    script.add_filter(evn)
    evc = ExtractVectorComponents(component='y-component')
    o = Optional(filter=evc)
    script.add_filter(o)
    script.add_module(ScalarCutPlane())
    s.scene.isometric_view()
    self.check(saved=False)
    f = BytesIO()
    f.name = abspath('test.mv2')
    script.save_visualization(f)
    f.seek(0)
    engine = script.engine
    engine.close_scene(s)
    script.load_visualization(f)
    s = engine.current_scene
    s.scene.isometric_view()
    self.check(saved=True)
    source = s.children.pop()
    s.children.append(source)
    s.scene.isometric_view()
    self.check(saved=True)
    source1 = copy.deepcopy(source)
    s.children[0] = source1
    s.scene.isometric_view()
    self.check(saved=True)

dataset/ETHPy150Open enthought/mayavi/integrationtests/mayavi/test_user_defined.py TestUserDefined.do/original