236 |
236 |
237 \begin{frame}[fragile] |
237 \begin{frame}[fragile] |
238 \frametitle{Using mlab} |
238 \frametitle{Using mlab} |
239 |
239 |
240 \begin{lstlisting} |
240 \begin{lstlisting} |
241 >>> from enthought.mayavi import mlab |
241 In []: from enthought.mayavi import mlab |
242 \end{lstlisting} |
242 \end{lstlisting} |
243 |
243 |
244 \vspace*{0.5in} |
244 \vspace*{0.5in} |
245 |
245 |
246 \myemph{\Large Try these} |
246 \myemph{\Large Try these} |
247 |
247 |
248 \vspace*{0.25in} |
248 \vspace*{0.25in} |
249 |
249 |
250 \begin{lstlisting} |
250 \begin{lstlisting} |
251 >>> mlab.test_<TAB> |
251 In []: mlab.test_<TAB> |
252 >>> mlab.test_contour3d() |
252 In []: mlab.test_contour3d() |
253 >>> mlab.test_contour3d?? |
253 in []: mlab.test_contour3d?? |
254 \end{lstlisting} |
254 \end{lstlisting} |
255 \end{frame} |
255 \end{frame} |
256 |
256 |
257 \begin{frame} |
257 \begin{frame} |
258 {Exploring the view} |
258 {Exploring the view} |
277 \column{0.5\textwidth} |
277 \column{0.5\textwidth} |
278 \pgfimage[width=2in]{MEDIA/m2/mlab/points3d_ex} |
278 \pgfimage[width=2in]{MEDIA/m2/mlab/points3d_ex} |
279 \end{columns} |
279 \end{columns} |
280 |
280 |
281 \begin{lstlisting} |
281 \begin{lstlisting} |
282 >>> from numpy import * |
282 In []: from numpy import * |
283 >>> t = linspace(0, 2*pi, 50) |
283 In []: t = linspace(0, 2*pi, 50) |
284 >>> u = cos(t)*pi |
284 In []: u = cos(t) * pi |
285 >>> x, y, z = sin(u), cos(u), sin(t) |
285 in []: x, y, z = sin(u), cos(u), sin(t) |
286 \end{lstlisting} |
286 \end{lstlisting} |
287 \emphbar{\PythonCode{>>> mlab.points3d(x, y, z)}} |
287 \emphbar{\PythonCode{In []: mlab.points3d(x, y, z)}} |
288 \end{frame} |
288 \end{frame} |
289 |
289 |
290 \begin{frame} |
290 \begin{frame} |
291 \begin{columns} |
291 \begin{columns} |
292 \column{0.25\textwidth} |
292 \column{0.25\textwidth} |
293 \myemph{\Large 1D data} |
293 \myemph{\Large 1D data} |
294 \column{0.5\textwidth} |
294 \column{0.5\textwidth} |
295 \pgfimage[width=2.5in]{MEDIA/m2/mlab/plot3d_ex} |
295 \pgfimage[width=2.5in]{MEDIA/m2/mlab/plot3d_ex} |
296 \end{columns} |
296 \end{columns} |
297 \emphbar{\PythonCode{>>> mlab.plot3d(x, y, z, t)}} |
297 \emphbar{\PythonCode{In []: mlab.plot3d(x, y, z, t)}} |
298 |
298 |
299 Plots lines between the points |
299 Plots lines between the points |
300 |
300 |
301 \end{frame} |
301 \end{frame} |
302 |
302 |
306 \myemph{\Large 2D data} |
306 \myemph{\Large 2D data} |
307 \column{0.5\textwidth} |
307 \column{0.5\textwidth} |
308 \pgfimage[width=2in]{MEDIA/m2/mlab/surf_ex} |
308 \pgfimage[width=2in]{MEDIA/m2/mlab/surf_ex} |
309 \end{columns} |
309 \end{columns} |
310 \begin{lstlisting} |
310 \begin{lstlisting} |
311 >>> x, y = mgrid[-3:3:100j,-3:3:100j] |
311 In []: x, y = mgrid[-3:3:100j,-3:3:100j] |
312 >>> z = sin(x*x + y*y) |
312 In []: z = sin(x*x + y*y) |
313 \end{lstlisting} |
313 \end{lstlisting} |
314 |
314 |
315 \emphbar{\PythonCode{>>> mlab.surf(x, y, z)}} |
315 \emphbar{\PythonCode{In []: mlab.surf(x, y, z)}} |
316 |
316 |
317 \alert{Assumes the points are rectilinear} |
317 \alert{Assumes the points are rectilinear} |
318 |
318 |
319 \end{frame} |
319 \end{frame} |
320 |
320 |
321 \begin{frame}[fragile] |
321 \begin{frame}[fragile] |
322 \myemph{\Large 2D data: \texttt{mlab.mesh}} |
322 \myemph{\Large 2D data: \texttt{mlab.mesh}} |
323 \vspace*{0.25in} |
323 \vspace*{0.25in} |
324 |
324 |
325 \emphbar{\PythonCode{>>> mlab.mesh(x, y, z)}} |
325 \emphbar{\PythonCode{In []: mlab.mesh(x, y, z)}} |
326 |
326 |
327 \alert{Points needn't be regular} |
327 \alert{Points needn't be regular} |
328 |
328 |
329 \vspace*{0.25in} |
329 \vspace*{0.25in} |
330 \begin{lstlisting} |
330 \begin{lstlisting} |
331 >>> phi, theta = numpy.mgrid[0:pi:20j, |
331 In []: phi, theta = numpy.mgrid[0:pi:20j, |
332 ... 0:2*pi:20j] |
332 ... 0:2*pi:20j] |
333 >>> x = sin(phi)*cos(theta) |
333 In []: x = sin(phi)*cos(theta) |
334 >>> y = sin(phi)*sin(theta) |
334 In []: y = sin(phi)*sin(theta) |
335 >>> z = cos(phi) |
335 In []: z = cos(phi) |
336 >>> mlab.mesh(x, y, z, |
336 In []: mlab.mesh(x, y, z, |
337 ... representation= |
337 ... representation= |
338 ... 'wireframe') |
338 ... 'wireframe') |
339 \end{lstlisting} |
339 \end{lstlisting} |
340 |
340 |
341 \end{frame} |
341 \end{frame} |
347 \myemph{\Large 3D data} |
347 \myemph{\Large 3D data} |
348 \column{0.5\textwidth} |
348 \column{0.5\textwidth} |
349 \pgfimage[width=1.5in]{MEDIA/m2/mlab/contour3d}\\ |
349 \pgfimage[width=1.5in]{MEDIA/m2/mlab/contour3d}\\ |
350 \end{columns} |
350 \end{columns} |
351 \begin{lstlisting} |
351 \begin{lstlisting} |
352 >>> x, y, z = ogrid[-5:5:64j, |
352 In []: x, y, z = ogrid[-5:5:64j, |
353 ... -5:5:64j, |
353 ... -5:5:64j, |
354 ... -5:5:64j] |
354 ... -5:5:64j] |
355 >>> mlab.contour3d(x*x*0.5 + y*y + |
355 In []: mlab.contour3d(x*x*0.5 + y*y + |
356 z*z*2) |
356 z*z*2) |
357 \end{lstlisting} |
357 \end{lstlisting} |
358 \end{frame} |
358 \end{frame} |
359 |
359 |
360 \begin{frame}[fragile] |
360 \begin{frame}[fragile] |
363 \vspace*{0.25in} |
363 \vspace*{0.25in} |
364 |
364 |
365 \pgfimage[width=2in]{MEDIA/m2/mlab/quiver3d_ex}\\ |
365 \pgfimage[width=2in]{MEDIA/m2/mlab/quiver3d_ex}\\ |
366 |
366 |
367 \begin{lstlisting} |
367 \begin{lstlisting} |
368 >>> mlab.test_quiver3d() |
368 In []: mlab.test_quiver3d() |
369 \end{lstlisting} |
369 \end{lstlisting} |
370 |
370 |
371 \emphbar{\PythonCode{obj = mlab.quiver3d(x, y, z, u, v, w)}} |
371 \emphbar{\PythonCode{obj = mlab.quiver3d(x, y, z, u, v, w)}} |
372 \inctime{20} |
372 \inctime{20} |
373 \end{frame} |
373 \end{frame} |