def test_test_backend(self): """Test if setting the backend to 'test' works.""" mlab.options.backend = 'test' mlab.test_contour3d() mlab.clf() mlab.pipeline.open(get_example_data('cube.vti')) mlab.clf()
def example(): # setup movie m = movie(frame_rate=22.5) # setup example from mayavi import mlab mlab.options.offscreen = True mlab.test_contour3d() f = mlab.gcf() # save frames for i in range(36*3): f.scene.camera.azimuth(10) # rotate f.scene.render() mlab.savefig(m.next_frame(), figure=f) # encode frames encoded = m.encode() # remove tempdir del m if not encoded: # report error exit(m.output)
def test_test_backend_clf(self): """Test if setting the backend to 'test' works.""" mlab.options.backend = 'test' mlab.test_contour3d() e = mlab.get_engine() self.assertEqual(len(e.scenes), 1) self.assertEqual(len(e.scenes[0].children), 1) mlab.clf() self.assertEqual(len(e.scenes), 1) self.assertEqual(len(e.scenes[0].children), 0) mlab.pipeline.open(get_example_data('cube.vti')) mlab.clf() self.assertEqual(len(e.scenes), 1) self.assertEqual(len(e.scenes[0].children), 0)
def test_save(self): mlab.test_contour3d() viz.save("test", "png") self.assertTrue(os.path.exists("test.png")) os.remove("test.png")
A simple example of the plot of a 3D graph with Mayavi in order to test the autonomy of the gallery. """ # Code source: Alex Gramfort # License: BSD 3 clause # This will show the mlab.test_mesh figure in the gallery # sphinx_gallery_thumbnail_number = 4 from mayavi import mlab mlab.test_plot3d() mlab.figure() mlab.test_contour3d() ##################################################################### # Note: this shows that inside a cell matplotlib figures are always # put before mayavi in the example HTML. In other words, the order of # plotting is not respected between matplotlib and mayavi figures mlab.figure() mlab.test_mesh() mlab.figure() mlab.test_flow() import matplotlib.pyplot as plt plt.plot([1, 2, 3], [1, 2, 3])
def f(): from mayavi.preferences.api import preference_manager preference_manager.root.show_splash_screen = False mlab.options.backend = 'envisage' mlab.test_contour3d() GUI.invoke_after(3000, close)
def f(): mlab.options.backend = 'envisage' mlab.test_contour3d() GUI.invoke_after(3000, close)