pytecplot 1.5.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. pytecplot-1.5.2.dist-info/LICENSE.html +77 -0
  2. pytecplot-1.5.2.dist-info/METADATA +508 -0
  3. pytecplot-1.5.2.dist-info/RECORD +97 -0
  4. pytecplot-1.5.2.dist-info/WHEEL +5 -0
  5. pytecplot-1.5.2.dist-info/top_level.txt +1 -0
  6. tecplot/__init__.py +94 -0
  7. tecplot/annotation/__init__.py +7 -0
  8. tecplot/annotation/annotation.py +223 -0
  9. tecplot/annotation/geometry.py +369 -0
  10. tecplot/annotation/georeference.py +33 -0
  11. tecplot/annotation/image.py +185 -0
  12. tecplot/annotation/iter.py +105 -0
  13. tecplot/annotation/polyline.py +381 -0
  14. tecplot/annotation/text.py +744 -0
  15. tecplot/constant.py +401 -0
  16. tecplot/data/__init__.py +34 -0
  17. tecplot/data/array.py +645 -0
  18. tecplot/data/create.py +1 -0
  19. tecplot/data/dataset.py +1809 -0
  20. tecplot/data/extract.py +544 -0
  21. tecplot/data/face_neighbors.py +494 -0
  22. tecplot/data/facemap.py +814 -0
  23. tecplot/data/load.py +2075 -0
  24. tecplot/data/nodemap.py +577 -0
  25. tecplot/data/operate.py +928 -0
  26. tecplot/data/query.py +334 -0
  27. tecplot/data/save.py +343 -0
  28. tecplot/data/variable.py +280 -0
  29. tecplot/data/zone.py +841 -0
  30. tecplot/exception.py +201 -0
  31. tecplot/export/__init__.py +13 -0
  32. tecplot/export/animation.py +521 -0
  33. tecplot/export/export_setup.py +318 -0
  34. tecplot/export/image.py +577 -0
  35. tecplot/export/print_setup.py +218 -0
  36. tecplot/export/time_animation.py +607 -0
  37. tecplot/extension/__init__.py +14 -0
  38. tecplot/extension/ipython.py +68 -0
  39. tecplot/layout/__init__.py +20 -0
  40. tecplot/layout/frame.py +1285 -0
  41. tecplot/layout/layout.py +488 -0
  42. tecplot/layout/page.py +541 -0
  43. tecplot/legend/__init__.py +4 -0
  44. tecplot/legend/contour_legend.py +516 -0
  45. tecplot/legend/legend.py +141 -0
  46. tecplot/legend/line_legend.py +66 -0
  47. tecplot/legend/rgb_coloring_legend.py +291 -0
  48. tecplot/legend/scatter_legend.py +136 -0
  49. tecplot/macro.py +339 -0
  50. tecplot/plot/__init__.py +62 -0
  51. tecplot/plot/axes.py +881 -0
  52. tecplot/plot/axis.py +1350 -0
  53. tecplot/plot/blanking.py +584 -0
  54. tecplot/plot/contour.py +1302 -0
  55. tecplot/plot/effects.py +162 -0
  56. tecplot/plot/fieldmap.py +2159 -0
  57. tecplot/plot/grid.py +758 -0
  58. tecplot/plot/isosurface.py +1167 -0
  59. tecplot/plot/labels.py +338 -0
  60. tecplot/plot/linemap.py +1905 -0
  61. tecplot/plot/linking.py +489 -0
  62. tecplot/plot/plot.py +1791 -0
  63. tecplot/plot/rgb_coloring.py +281 -0
  64. tecplot/plot/scatter.py +396 -0
  65. tecplot/plot/slice.py +1544 -0
  66. tecplot/plot/streamtrace.py +1949 -0
  67. tecplot/plot/symbol.py +567 -0
  68. tecplot/plot/ticks.py +666 -0
  69. tecplot/plot/title.py +380 -0
  70. tecplot/plot/vector.py +679 -0
  71. tecplot/plot/view.py +868 -0
  72. tecplot/session/__init__.py +112 -0
  73. tecplot/session/aux_data.py +276 -0
  74. tecplot/session/config.py +92 -0
  75. tecplot/session/session.py +425 -0
  76. tecplot/session/state_changed.py +225 -0
  77. tecplot/session/style.py +504 -0
  78. tecplot/tecutil/__init__.py +16 -0
  79. tecplot/tecutil/arglist.py +230 -0
  80. tecplot/tecutil/captured_output.py +177 -0
  81. tecplot/tecutil/constant.py +1312 -0
  82. tecplot/tecutil/index_set.py +118 -0
  83. tecplot/tecutil/lock.py +36 -0
  84. tecplot/tecutil/message_pb2.py +39 -0
  85. tecplot/tecutil/preamble.py +54 -0
  86. tecplot/tecutil/stringlist.py +114 -0
  87. tecplot/tecutil/sv.py +1662 -0
  88. tecplot/tecutil/tecutil.py +12402 -0
  89. tecplot/tecutil/tecutil_client.py +627 -0
  90. tecplot/tecutil/tecutil_connector.py +937 -0
  91. tecplot/tecutil/tecutil_rpc.py +6845 -0
  92. tecplot/tecutil/util.py +332 -0
  93. tecplot/text/__init__.py +3 -0
  94. tecplot/text/font.py +224 -0
  95. tecplot/text/label_format.py +374 -0
  96. tecplot/text/textbox.py +106 -0
  97. tecplot/version.py +41 -0
@@ -0,0 +1,521 @@
1
+ import os
2
+ import warnings
3
+
4
+ from ..tecutil import _tecutil
5
+ from ..constant import *
6
+ from ..exception import *
7
+ from .. import tecutil, version
8
+
9
+ from .export_setup import ExportSetup
10
+ from .print_setup import PrintSetup
11
+
12
+
13
+ class animation(object):
14
+ r'''Frame-by-frame animation context.'''
15
+ def __init__(self, filename, width=800, animation_speed=10,
16
+ region=ExportRegion.AllFrames, supersample=3,
17
+ compression=None, image_type=None,
18
+ multiple_color_tables=False, format_options=None,
19
+ convert_to_256_colors=None, jpeg_encoding=None, quality=None,
20
+ gray_scale_depth=None, tiff_byte_order=None, format=None):
21
+ if __debug__:
22
+ if compression is not None:
23
+ if (
24
+ format is ExportFormat.AVI and
25
+ version.sdk_version_info >= (2021, 2)
26
+ ):
27
+ msg = 'Compression option no longer supported for AVI'
28
+ msg += ' animations since ffmpeg is now used to assemble'
29
+ msg += ' AVI movies. Use the avi_format_options property'
30
+ msg += ' instead.'
31
+ warnings.warn(msg, TecplotDeprecationWarning)
32
+ elif format not in [ExportFormat.AVI, ExportFormat.Flash]:
33
+ msg = 'Compression only supported for AVI and Flash animations.'
34
+ msg += ' compression: {} format: {}'.format(compression,
35
+ format)
36
+ raise TecplotLogicError(msg)
37
+ if (
38
+ image_type is not None and
39
+ format != ExportFormat.Flash
40
+ ):
41
+ msg = 'Image-type only supported for Flash animations.'
42
+ raise TecplotLogicError(msg)
43
+ _ext = {
44
+ 'avi': ExportFormat.AVI,
45
+ 'mp4': ExportFormat.MPEG4,
46
+ 'mpeg': ExportFormat.MPEG4,
47
+ 'f4v': ExportFormat.Flash,
48
+ 'flv': ExportFormat.Flash,
49
+ 'swf': ExportFormat.Flash,
50
+ 'rm': ExportFormat.RasterMetafile,
51
+ 'wmv': ExportFormat.WMV,
52
+
53
+ # image formats
54
+ 'bmp': ExportFormat.BMP,
55
+ 'jpeg': ExportFormat.JPEG,
56
+ 'png': ExportFormat.PNG,
57
+ 'tiff': ExportFormat.TIFF,
58
+ }
59
+ if format is None:
60
+ format = _ext.get(os.path.splitext(filename)[-1].split('.')[-1],
61
+ ExportFormat.MPEG4)
62
+ self.format = ExportFormat(format)
63
+
64
+ self.filename = filename
65
+ self.width = width
66
+ self.animation_speed = animation_speed
67
+ self.region = region
68
+ self.supersample = supersample
69
+ self.compression = compression
70
+ self.image_type = image_type
71
+ self.multiple_color_tables = multiple_color_tables
72
+ self.format_options = format_options
73
+
74
+ # image format options
75
+ self.convert_to_256_colors = convert_to_256_colors
76
+ self.jpeg_encoding = jpeg_encoding
77
+ self.quality = quality
78
+ self.gray_scale_depth = gray_scale_depth
79
+ self.tiff_byte_order = tiff_byte_order
80
+
81
+ @tecutil.lock()
82
+ def setup(self):
83
+ export_setup = ExportSetup()
84
+ export_setup.reset()
85
+ export_setup.format = self.format
86
+ export_setup.filename = self.filename
87
+ export_setup.width = self.width
88
+ export_setup.animation_speed = self.animation_speed
89
+ export_setup.region = self.region
90
+ export_setup.supersample = self.supersample
91
+ export_setup.multiple_color_tables = self.multiple_color_tables
92
+
93
+ if self.format == ExportFormat.AVI:
94
+ if version.sdk_version_info < (2021, 2):
95
+ export_setup.avi_compression = self.compression
96
+ else:
97
+ export_setup.avi_format_options = self.format_options
98
+ elif self.format == ExportFormat.Flash:
99
+ export_setup.flash_compression = self.compression
100
+ export_setup.flash_image_type = self.image_type
101
+ elif self.format == ExportFormat.MPEG4:
102
+ export_setup.mpeg_format_options = self.format_options
103
+ elif self.format == ExportFormat.WMV:
104
+ export_setup.wmv_format_options = self.format_options
105
+ elif self.format in [ExportFormat.BMP, ExportFormat.PNG]:
106
+ export_setup.convert_to_256_colors = self.convert_to_256_colors
107
+ elif self.format == ExportFormat.JPEG:
108
+ export_setup.jpeg_encoding = self.jpeg_encoding
109
+ export_setup.quality = self.quality
110
+ elif self.format == ExportFormat.TIFF:
111
+ export_setup.gray_scale_depth = self.gray_scale_depth
112
+ export_setup.tiff_byte_order = self.tiff_byte_order
113
+
114
+ @tecutil.lock()
115
+ def __enter__(self):
116
+ self.setup()
117
+ if not _tecutil.ExportStart():
118
+ raise TecplotSystemError()
119
+ return self
120
+
121
+ @tecutil.lock()
122
+ def __exit__(self, *args, **kargs):
123
+ if not _tecutil.ExportFinish():
124
+ raise TecplotSystemError()
125
+
126
+ @tecutil.lock()
127
+ def export_animation_frame(self):
128
+ """Append a frame to the current animation.
129
+
130
+ This function is available as a method on the object returned by the
131
+ animation contexts:
132
+
133
+ * `animation_avi`
134
+ * `animation_flash`
135
+ * `animation_mpeg4`
136
+ * `animation_raster_metafile`
137
+ * `animation_wmv`
138
+
139
+ It instructs Tecplot 360 to capture the current state of the plot or
140
+ workspace (see the *region* parameter in the contexts above) as a
141
+ single frame in the resulting animation. Typical usage is to make small
142
+ changes to the plot, calling `animation.export_animation_frame()` after
143
+ each change to create a smooth transition from one view to another. For
144
+ a detailed example, see `animation_mpeg4`. The following example is an
145
+ excerpt from the MPEG-4 example code::
146
+
147
+ with tp.export.animation_mpeg4(outfile, **opts) as ani:
148
+ for i in range(args.nframes):
149
+ view.rotate_axes(5, (1, 0, 0))
150
+ translate_view(view, 30 / args.nframes)
151
+ ani.export_animation_frame()
152
+ """
153
+ if not _tecutil.ExportNextFrame():
154
+ raise TecplotSystemError()
155
+
156
+
157
+ class animation_avi(animation):
158
+ r'''Frame-by-frame AVI animation context.
159
+
160
+ Parameters:
161
+ filename (`str`): The resulting video file name or path, relative to
162
+ Python's current working directory.
163
+ width (`int`, optional): The width of the video in pixels. (default:
164
+ 800)
165
+ animation_speed (`int`, optional): The frame-rate of the video in
166
+ frames per second. (default: 10)
167
+ region (`Frame <tecplot.layout.Frame>` or `ExportRegion`, optional):
168
+ The rectangular area to be exported. This can be a specific `Frame
169
+ <tecplot.layout.Frame>` object or one of
170
+ `ExportRegion.CurrentFrame`, `ExportRegion.AllFrames` (default) or
171
+ `ExportRegion.WorkArea`.
172
+ supersample (`int`, optional): Controls the amount of anti-aliasing
173
+ used in each frame. Valid values are 1-16. A value of **1**
174
+ indicates that no antialiasing will be used. Antialiasing smooths
175
+ jagged edges on text, lines, and edges of the video output by the
176
+ process of supersampling. *Some graphics cards* can cause Tecplot
177
+ 360 to crash when larger anti-aliasing values are used. If this
178
+ occurs on your machine, try updating your graphics driver or using
179
+ a lower anti-aliasing value. (default: **3**)
180
+ format_options (`str`, optional): A string of options passed directly
181
+ to the underlying application `FFmpeg <https://www.ffmpeg.org/>`_.
182
+ By default, this will be "-vcodec mjpeg -q:v 5".
183
+
184
+ This is a `context manager
185
+ <https://docs.python.org/3/reference/datamodel.html#context-managers>`_ and
186
+ must be invoked using the `with
187
+ <https://docs.python.org/3/reference/compound_stmts.html#with>`_ statement.
188
+ The returned object of the context manager is used to control when each
189
+ frame of the video is captured. This is done using the context method
190
+ `animation.export_animation_frame()` as shown in the example below, at
191
+ which point the specified region or plot is rendered. The actual video file
192
+ is produced upon exit of the context.
193
+
194
+ Typical code looks like the following (see the example under
195
+ `animation_mpeg4` for a complete working example)::
196
+
197
+ >>> with tp.export.animation_avi('output.avi') as ani:
198
+ ... # make some view changes here
199
+ ... ani.export_animation_frame()
200
+ '''
201
+ def __init__(self, filename, width=800, animation_speed=10,
202
+ region=ExportRegion.AllFrames, supersample=3,
203
+ compression=None, multiple_color_tables=False,
204
+ format_options=None):
205
+ animation.__init__(self, filename=filename, width=width,
206
+ animation_speed=animation_speed, region=region,
207
+ supersample=supersample,
208
+ format_options=format_options,
209
+ compression=compression, # deprecated: use format_options instead
210
+ multiple_color_tables=multiple_color_tables, # deprecated: use format_options instead
211
+ format=ExportFormat.AVI)
212
+
213
+
214
+ class animation_flash(animation):
215
+ r'''Frame-by-frame Flash animation context.
216
+
217
+ Parameters:
218
+ filename (`str`): The resulting video file name or path, relative to
219
+ Python's current working directory.
220
+ width (`int`, optional): The width of the video in pixels. (default:
221
+ 800)
222
+ animation_speed (`int`, optional): The frame-rate of the video in
223
+ frames per second. (default: 10)
224
+ region (`Frame <tecplot.layout.Frame>` or `ExportRegion`, optional):
225
+ The rectangular area to be exported. This can be a specific `Frame
226
+ <tecplot.layout.Frame>` object or one of
227
+ `ExportRegion.CurrentFrame`, `ExportRegion.AllFrames` (default) or
228
+ `ExportRegion.WorkArea`.
229
+ supersample (`int`, optional): Controls the amount of anti-aliasing
230
+ used in each frame. Valid values are 1-16. A value of **1**
231
+ indicates that no antialiasing will be used. Antialiasing smooths
232
+ jagged edges on text, lines, and edges of the video output by the
233
+ process of supersampling. *Some graphics cards* can cause Tecplot
234
+ 360 to crash when larger anti-aliasing values are used. If this
235
+ occurs on your machine, try updating your graphics driver or using
236
+ a lower anti-aliasing value. (default: **3**)
237
+ compression (`FlashCompressionType`, optional): The compression scheme
238
+ to use when creating the video stream. Options are:
239
+ `FlashCompressionType.BestSpeed` (default) and
240
+ `FlashCompressionType.SmallestSize`.
241
+ image_type (`FlashImageType`, optional): The type of images to generate
242
+ for each frame of the animation. Options are:
243
+ `FlashImageType.Color256`, `FlashImageType.JPEG` and
244
+ `FlashImageType.Lossless` (default).
245
+
246
+ This is a `context manager
247
+ <https://docs.python.org/3/reference/datamodel.html#context-managers>`_ and
248
+ must be invoked using the `with
249
+ <https://docs.python.org/3/reference/compound_stmts.html#with>`_ statement.
250
+ The returned object of the context manager is used to control when each
251
+ frame of the video is captured. This is done using the context method
252
+ `animation.export_animation_frame()` as shown in the example below, at
253
+ which point the specified region or plot is rendered. The actual video file
254
+ is produced upon exit of the context.
255
+
256
+ Typical code looks like the following (see the example under
257
+ `animation_mpeg4` for a complete working example)::
258
+
259
+ >>> with tp.export.animation_flash('output.flv') as ani:
260
+ ... # make some view changes here
261
+ ... ani.export_animation_frame()
262
+ '''
263
+ def __init__(self, filename, width=800, animation_speed=10,
264
+ region=ExportRegion.AllFrames, supersample=3,
265
+ compression=None, image_type=FlashImageType.Lossless):
266
+ animation.__init__(self, filename=filename, width=width,
267
+ animation_speed=animation_speed, region=region,
268
+ supersample=supersample, compression=compression,
269
+ image_type=image_type, format=ExportFormat.Flash)
270
+
271
+
272
+ class animation_mpeg4(animation):
273
+ r'''Frame-by-frame MPEG4 animation context.
274
+
275
+ Parameters:
276
+ filename (`str`): The resulting video file name or path, relative to
277
+ Python's current working directory.
278
+ width (`int`, optional): The width of the video in pixels. (default:
279
+ 800)
280
+ animation_speed (`int`, optional): The frame-rate of the video in
281
+ frames per second. (default: 10)
282
+ region (`Frame <tecplot.layout.Frame>` or `ExportRegion`, optional):
283
+ The rectangular area to be exported. This can be a specific `Frame
284
+ <tecplot.layout.Frame>` object or one of
285
+ `ExportRegion.CurrentFrame`, `ExportRegion.AllFrames` (default) or
286
+ `ExportRegion.WorkArea`.
287
+ supersample (`int`, optional): Controls the amount of anti-aliasing
288
+ used in each frame. Valid values are 1-16. A value of **1**
289
+ indicates that no antialiasing will be used. Antialiasing smooths
290
+ jagged edges on text, lines, and edges of the video output by the
291
+ process of supersampling. *Some graphics cards* can cause Tecplot
292
+ 360 to crash when larger anti-aliasing values are used. If this
293
+ occurs on your machine, try updating your graphics driver or using
294
+ a lower anti-aliasing value. (default: **3**)
295
+ format_options (`str`, optional): A string of options passed directly
296
+ to the underlying application `FFmpeg <https://www.ffmpeg.org/>`_.
297
+ By default, this will be "-c:v libx264 -profile:v high -crf 20
298
+ -pix_fmt yuv420p".
299
+
300
+ This is a `context manager
301
+ <https://docs.python.org/3/reference/datamodel.html#context-managers>`_ and
302
+ must be invoked using the `with
303
+ <https://docs.python.org/3/reference/compound_stmts.html#with>`_ statement.
304
+ The returned object of the context manager is used to control when each
305
+ frame of the video is captured. This is done using the context method
306
+ `animation.export_animation_frame()` as shown in the example below, at
307
+ which point the specified region or plot is rendered. The actual video file
308
+ is produced upon exit of the context.
309
+
310
+ Example usage:
311
+
312
+ .. code-block:: python
313
+ :emphasize-lines: 64,68
314
+
315
+ import argparse, os
316
+
317
+ import tecplot as tp
318
+ from tecplot.constant import *
319
+
320
+ def parse_args():
321
+ """
322
+ This script is to be run from the command line and accepts the
323
+ following command line arguments. Run this script with "--help"
324
+ to see usage and help information.
325
+ """
326
+ parser = argparse.ArgumentParser()
327
+ parser.add_argument('-c', '--connect', action='store_true',
328
+ help='connect to TecUtil Server')
329
+ parser.add_argument('-p', '--port', type=int, default=7600,
330
+ help='port to use when connecting to TecUtil Server')
331
+ parser.add_argument('-n', '--nframes', type=int, default=360,
332
+ help='number of frames to produce in video')
333
+ parser.add_argument('outfile', nargs='?', default='aileron_roll.mp4',
334
+ help='output file name')
335
+ return parser.parse_args()
336
+
337
+ def setup_plot():
338
+ """
339
+ Load the F-18 dataset from Tecplot 360's examples and show the
340
+ jet surface in 3D.
341
+ """
342
+ tp.new_layout()
343
+ exdir = tp.session.tecplot_examples_directory()
344
+ datafile = os.path.join(exdir, 'SimpleData', 'F18.plt')
345
+ ds = tp.data.load_tecplot(datafile)
346
+
347
+ frame = tp.active_frame()
348
+ frame.show_border = False
349
+ plot = frame.plot(PlotType.Cartesian3D)
350
+ plot.activate()
351
+
352
+ plot.contour(0).variable = ds.variable('S')
353
+ plot.show_contour = True
354
+ return plot
355
+
356
+ def translate_view(view, x=0, y=0, z=0):
357
+ """
358
+ Translate the viewer with respect to the data.
359
+ """
360
+ p = view.position
361
+ view.position = p.x + x, p.y + y, p.z + z
362
+
363
+ def create_animation(outfile, plot, nframes):
364
+ """
365
+ Using the tp.export.animation_mpeg4() context manager, the F-18 is
366
+ recorded doing an "aileron roll" by rotating and translating the
367
+ viewer with respect to the data by a small amount and capturing
368
+ each frame of the animation with a call to ani.export_animation_frame()
369
+ """
370
+ with tp.session.suspend():
371
+ opts = dict(
372
+ width=400,
373
+ animation_speed=30,
374
+ supersample=3,
375
+ )
376
+ view = plot.view
377
+ translate_view(view, -15)
378
+ with tp.export.animation_mpeg4(outfile, **opts) as ani:
379
+ for i in range(args.nframes):
380
+ view.rotate_axes(5, (1, 0, 0))
381
+ translate_view(view, 30 / args.nframes)
382
+ ani.export_animation_frame()
383
+
384
+ """
385
+ This script is meant to run on the command line. Run with "--help" to see
386
+ usage and help information about the options it understands. It loads
387
+ the F-18 dataset from Tecplot 360's examples directory and produces a
388
+ video of the model doing an "aileron roll" by manipulating the viewer
389
+ position.
390
+ """
391
+ args = parse_args()
392
+ if args.connect:
393
+ tp.session.connect(port=args.port)
394
+ plot = setup_plot()
395
+ create_animation(args.outfile, plot, args.nframes)
396
+ print('video file created:', args.outfile)
397
+
398
+ .. raw:: html
399
+
400
+ <video controls>
401
+ <source src="../_static/videos/aileron_roll.m4v" type="video/mp4">
402
+ I'm sorry; your browser doesn't support HTML5 MPEG4/H.264 video.
403
+ </video>
404
+ '''
405
+ def __init__(self, filename, width=800, animation_speed=10,
406
+ region=ExportRegion.AllFrames, supersample=3,
407
+ format_options=None):
408
+ animation.__init__(self, filename=filename, width=width,
409
+ animation_speed=animation_speed, region=region,
410
+ supersample=supersample,
411
+ format_options=format_options,
412
+ format=ExportFormat.MPEG4)
413
+
414
+
415
+ class animation_raster_metafile(animation):
416
+ r'''Frame-by-frame Raster Metafile animation context.
417
+
418
+ Parameters:
419
+ filename (`str`): The resulting video file name or path, relative to
420
+ Python's current working directory.
421
+ width (`int`, optional): The width of the video in pixels. (default:
422
+ 800)
423
+ animation_speed (`int`, optional): The frame-rate of the video in
424
+ frames per second. (default: 10)
425
+ region (`Frame <tecplot.layout.Frame>` or `ExportRegion`, optional):
426
+ The rectangular area to be exported. This can be a specific `Frame
427
+ <tecplot.layout.Frame>` object or one of
428
+ `ExportRegion.CurrentFrame`, `ExportRegion.AllFrames` (default) or
429
+ `ExportRegion.WorkArea`.
430
+ supersample (`int`, optional): Controls the amount of anti-aliasing
431
+ used in each frame. Valid values are 1-16. A value of **1**
432
+ indicates that no antialiasing will be used. Antialiasing smooths
433
+ jagged edges on text, lines, and edges of the video output by the
434
+ process of supersampling. *Some graphics cards* can cause Tecplot
435
+ 360 to crash when larger anti-aliasing values are used. If this
436
+ occurs on your machine, try updating your graphics driver or using
437
+ a lower anti-aliasing value. (default: **3**)
438
+ multiple_color_tables (`bool`, optional): Create a color table for each
439
+ frame of the animation. If `False` (default), the whole animation
440
+ will be scanned in an attempt to create a single table of 256
441
+ colors.
442
+
443
+ This is a `context manager
444
+ <https://docs.python.org/3/reference/datamodel.html#context-managers>`_ and
445
+ must be invoked using the `with
446
+ <https://docs.python.org/3/reference/compound_stmts.html#with>`_ statement.
447
+ The returned object of the context manager is used to control when each
448
+ frame of the video is captured. This is done using the context method
449
+ `animation.export_animation_frame()` as shown in the example below, at
450
+ which point the specified region or plot is rendered. The actual video file
451
+ is produced upon exit of the context.
452
+
453
+ Typical code looks like the following (see the example under
454
+ `animation_mpeg4` for a complete working example)::
455
+
456
+ >>> with tp.export.animation_raster_metafile('output.rm') as ani:
457
+ ... # make some view changes here
458
+ ... ani.export_animation_frame()
459
+ '''
460
+ def __init__(self, filename, width=800, animation_speed=10,
461
+ region=ExportRegion.AllFrames, supersample=3,
462
+ multiple_color_tables=False):
463
+ animation.__init__(self, filename=filename, width=width,
464
+ animation_speed=animation_speed, region=region,
465
+ supersample=supersample,
466
+ multiple_color_tables=multiple_color_tables,
467
+ format=ExportFormat.RasterMetafile)
468
+
469
+
470
+ class animation_wmv(animation):
471
+ r'''Frame-by-frame WMV animation context.
472
+
473
+ Parameters:
474
+ filename (`str`): The resulting video file name or path, relative to
475
+ Python's current working directory.
476
+ width (`int`, optional): The width of the video in pixels. (default:
477
+ 800)
478
+ animation_speed (`int`, optional): The frame-rate of the video in
479
+ frames per second. (default: 10)
480
+ region (`Frame <tecplot.layout.Frame>` or `ExportRegion`, optional):
481
+ The rectangular area to be exported. This can be a specific `Frame
482
+ <tecplot.layout.Frame>` object or one of
483
+ `ExportRegion.CurrentFrame`, `ExportRegion.AllFrames` (default) or
484
+ `ExportRegion.WorkArea`.
485
+ supersample (`int`, optional): Controls the amount of anti-aliasing
486
+ used in each frame. Valid values are 1-16. A value of **1**
487
+ indicates that no antialiasing will be used. Antialiasing smooths
488
+ jagged edges on text, lines, and edges of the video output by the
489
+ process of supersampling. *Some graphics cards* can cause Tecplot
490
+ 360 to crash when larger anti-aliasing values are used. If this
491
+ occurs on your machine, try updating your graphics driver or using
492
+ a lower anti-aliasing value. (default: **3**)
493
+ format_options (`str`, optional): A string of options passed directly
494
+ to the underlying application `FFmpeg <https://www.ffmpeg.org/>`_.
495
+ By default, this will be "-qscale 4".
496
+
497
+ This is a `context manager
498
+ <https://docs.python.org/3/reference/datamodel.html#context-managers>`_ and
499
+ must be invoked using the `with
500
+ <https://docs.python.org/3/reference/compound_stmts.html#with>`_ statement.
501
+ The returned object of the context manager is used to control when each
502
+ frame of the video is captured. This is done using the context method
503
+ `animation.export_animation_frame()` as shown in the example below, at
504
+ which point the specified region or plot is rendered. The actual video file
505
+ is produced upon exit of the context.
506
+
507
+ Typical code looks like the following (see the example under
508
+ `animation_mpeg4` for a complete working example)::
509
+
510
+ >>> with tp.export.animation_wmv('output.wmv') as ani:
511
+ ... # make some view changes here
512
+ ... ani.export_animation_frame()
513
+ '''
514
+ def __init__(self, filename, width=800, animation_speed=10,
515
+ region=ExportRegion.AllFrames, supersample=3,
516
+ format_options=None):
517
+ animation.__init__(self, filename=filename, width=width,
518
+ animation_speed=animation_speed, region=region,
519
+ supersample=supersample,
520
+ format_options=format_options,
521
+ format=ExportFormat.WMV)