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.
- pytecplot-1.5.2.dist-info/LICENSE.html +77 -0
- pytecplot-1.5.2.dist-info/METADATA +508 -0
- pytecplot-1.5.2.dist-info/RECORD +97 -0
- pytecplot-1.5.2.dist-info/WHEEL +5 -0
- pytecplot-1.5.2.dist-info/top_level.txt +1 -0
- tecplot/__init__.py +94 -0
- tecplot/annotation/__init__.py +7 -0
- tecplot/annotation/annotation.py +223 -0
- tecplot/annotation/geometry.py +369 -0
- tecplot/annotation/georeference.py +33 -0
- tecplot/annotation/image.py +185 -0
- tecplot/annotation/iter.py +105 -0
- tecplot/annotation/polyline.py +381 -0
- tecplot/annotation/text.py +744 -0
- tecplot/constant.py +401 -0
- tecplot/data/__init__.py +34 -0
- tecplot/data/array.py +645 -0
- tecplot/data/create.py +1 -0
- tecplot/data/dataset.py +1809 -0
- tecplot/data/extract.py +544 -0
- tecplot/data/face_neighbors.py +494 -0
- tecplot/data/facemap.py +814 -0
- tecplot/data/load.py +2075 -0
- tecplot/data/nodemap.py +577 -0
- tecplot/data/operate.py +928 -0
- tecplot/data/query.py +334 -0
- tecplot/data/save.py +343 -0
- tecplot/data/variable.py +280 -0
- tecplot/data/zone.py +841 -0
- tecplot/exception.py +201 -0
- tecplot/export/__init__.py +13 -0
- tecplot/export/animation.py +521 -0
- tecplot/export/export_setup.py +318 -0
- tecplot/export/image.py +577 -0
- tecplot/export/print_setup.py +218 -0
- tecplot/export/time_animation.py +607 -0
- tecplot/extension/__init__.py +14 -0
- tecplot/extension/ipython.py +68 -0
- tecplot/layout/__init__.py +20 -0
- tecplot/layout/frame.py +1285 -0
- tecplot/layout/layout.py +488 -0
- tecplot/layout/page.py +541 -0
- tecplot/legend/__init__.py +4 -0
- tecplot/legend/contour_legend.py +516 -0
- tecplot/legend/legend.py +141 -0
- tecplot/legend/line_legend.py +66 -0
- tecplot/legend/rgb_coloring_legend.py +291 -0
- tecplot/legend/scatter_legend.py +136 -0
- tecplot/macro.py +339 -0
- tecplot/plot/__init__.py +62 -0
- tecplot/plot/axes.py +881 -0
- tecplot/plot/axis.py +1350 -0
- tecplot/plot/blanking.py +584 -0
- tecplot/plot/contour.py +1302 -0
- tecplot/plot/effects.py +162 -0
- tecplot/plot/fieldmap.py +2159 -0
- tecplot/plot/grid.py +758 -0
- tecplot/plot/isosurface.py +1167 -0
- tecplot/plot/labels.py +338 -0
- tecplot/plot/linemap.py +1905 -0
- tecplot/plot/linking.py +489 -0
- tecplot/plot/plot.py +1791 -0
- tecplot/plot/rgb_coloring.py +281 -0
- tecplot/plot/scatter.py +396 -0
- tecplot/plot/slice.py +1544 -0
- tecplot/plot/streamtrace.py +1949 -0
- tecplot/plot/symbol.py +567 -0
- tecplot/plot/ticks.py +666 -0
- tecplot/plot/title.py +380 -0
- tecplot/plot/vector.py +679 -0
- tecplot/plot/view.py +868 -0
- tecplot/session/__init__.py +112 -0
- tecplot/session/aux_data.py +276 -0
- tecplot/session/config.py +92 -0
- tecplot/session/session.py +425 -0
- tecplot/session/state_changed.py +225 -0
- tecplot/session/style.py +504 -0
- tecplot/tecutil/__init__.py +16 -0
- tecplot/tecutil/arglist.py +230 -0
- tecplot/tecutil/captured_output.py +177 -0
- tecplot/tecutil/constant.py +1312 -0
- tecplot/tecutil/index_set.py +118 -0
- tecplot/tecutil/lock.py +36 -0
- tecplot/tecutil/message_pb2.py +39 -0
- tecplot/tecutil/preamble.py +54 -0
- tecplot/tecutil/stringlist.py +114 -0
- tecplot/tecutil/sv.py +1662 -0
- tecplot/tecutil/tecutil.py +12402 -0
- tecplot/tecutil/tecutil_client.py +627 -0
- tecplot/tecutil/tecutil_connector.py +937 -0
- tecplot/tecutil/tecutil_rpc.py +6845 -0
- tecplot/tecutil/util.py +332 -0
- tecplot/text/__init__.py +3 -0
- tecplot/text/font.py +224 -0
- tecplot/text/label_format.py +374 -0
- tecplot/text/textbox.py +106 -0
- tecplot/version.py +41 -0
tecplot/plot/vector.py
ADDED
|
@@ -0,0 +1,679 @@
|
|
|
1
|
+
from builtins import super
|
|
2
|
+
|
|
3
|
+
from collections import namedtuple
|
|
4
|
+
|
|
5
|
+
from ..tecutil import _tecutil
|
|
6
|
+
from ..constant import *
|
|
7
|
+
from ..exception import *
|
|
8
|
+
from .. import session
|
|
9
|
+
from ..tecutil import Index, lock, color_spec, sv
|
|
10
|
+
from ..text import LabelFormat, Font
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class ReferenceVectorLabel(session.Style):
|
|
14
|
+
"""Label for the reference vector.
|
|
15
|
+
|
|
16
|
+
See the example under `ReferenceVector`.
|
|
17
|
+
"""
|
|
18
|
+
def __init__(self, ref_vector):
|
|
19
|
+
self.ref_vector = ref_vector
|
|
20
|
+
super().__init__(ref_vector._sv, sv.MAGNITUDELABEL, **ref_vector._kw)
|
|
21
|
+
|
|
22
|
+
@property
|
|
23
|
+
def show(self):
|
|
24
|
+
"""`bool`: Print a label next to the reference vector.
|
|
25
|
+
|
|
26
|
+
Example usage::
|
|
27
|
+
|
|
28
|
+
>>> ref_vector = plot.vector.reference_vector
|
|
29
|
+
>>> ref_vector.show = True
|
|
30
|
+
>>> ref_vector.label.show = True
|
|
31
|
+
"""
|
|
32
|
+
return self._get_style(bool, sv.SHOW)
|
|
33
|
+
|
|
34
|
+
@show.setter
|
|
35
|
+
def show(self, value):
|
|
36
|
+
self._set_style(bool(value), sv.SHOW)
|
|
37
|
+
|
|
38
|
+
@property
|
|
39
|
+
def color(self):
|
|
40
|
+
"""`Color`: `Color` of the reference vector label.
|
|
41
|
+
|
|
42
|
+
Example usage::
|
|
43
|
+
|
|
44
|
+
>>> from tecplot.constant import Color
|
|
45
|
+
>>> ref_vector = plot.vector.reference_vector
|
|
46
|
+
>>> ref_vector.show = True
|
|
47
|
+
>>> ref_vector.label.show = True
|
|
48
|
+
>>> ref_vector.label.color = Color.Red
|
|
49
|
+
"""
|
|
50
|
+
return self._get_style(Color, sv.TEXTCOLOR)
|
|
51
|
+
|
|
52
|
+
@color.setter
|
|
53
|
+
def color(self, value):
|
|
54
|
+
self._set_style(Color(value), sv.TEXTCOLOR)
|
|
55
|
+
|
|
56
|
+
@property
|
|
57
|
+
def offset(self):
|
|
58
|
+
"""`float` (percent of frame height): Distance from the reference vector to the associated label.
|
|
59
|
+
|
|
60
|
+
Example usage::
|
|
61
|
+
|
|
62
|
+
>>> ref_vector = plot.vector.reference_vector
|
|
63
|
+
>>> ref_vector.show = True
|
|
64
|
+
>>> ref_vector.label.show = True
|
|
65
|
+
>>> ref_vector.label.offset = 10
|
|
66
|
+
"""
|
|
67
|
+
return self._get_style(float, sv.OFFSET)
|
|
68
|
+
|
|
69
|
+
@offset.setter
|
|
70
|
+
def offset(self, value):
|
|
71
|
+
self._set_style(float(value), sv.OFFSET)
|
|
72
|
+
|
|
73
|
+
@property
|
|
74
|
+
def font(self):
|
|
75
|
+
"""`text.Font`: Typeface of the reference vector label.
|
|
76
|
+
|
|
77
|
+
Example usage::
|
|
78
|
+
|
|
79
|
+
>>> ref_vector = plot.vector.reference_vector
|
|
80
|
+
>>> ref_vector.show = True
|
|
81
|
+
>>> ref_vector.label.show = True
|
|
82
|
+
>>> ref_vector.label.font.size = 6
|
|
83
|
+
"""
|
|
84
|
+
return Font(self)
|
|
85
|
+
|
|
86
|
+
@property
|
|
87
|
+
def format(self):
|
|
88
|
+
"""`LabelFormat`: Number formatting control for the reference vector label.
|
|
89
|
+
|
|
90
|
+
Example usage::
|
|
91
|
+
|
|
92
|
+
>>> from tecplot.constant import NumberFormat
|
|
93
|
+
>>> ref_vector = plot.vector.reference_vector
|
|
94
|
+
>>> ref_vector.show = True
|
|
95
|
+
>>> ref_vector.label.show = True
|
|
96
|
+
>>> ref_vector.label.format.format_type = NumberFormat.Exponential
|
|
97
|
+
"""
|
|
98
|
+
return LabelFormat(self)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
class ReferenceVector(session.Style):
|
|
102
|
+
"""Vector field reference vector.
|
|
103
|
+
|
|
104
|
+
The reference vector is a single arrow with an optional label indicating
|
|
105
|
+
the value of the shown reference length:
|
|
106
|
+
|
|
107
|
+
.. code-block:: python
|
|
108
|
+
:emphasize-lines: 34-41
|
|
109
|
+
|
|
110
|
+
from os import path
|
|
111
|
+
import tecplot as tp
|
|
112
|
+
from tecplot.constant import *
|
|
113
|
+
|
|
114
|
+
examples_dir = tp.session.tecplot_examples_directory()
|
|
115
|
+
infile = path.join(examples_dir, 'SimpleData', 'VortexShedding.plt')
|
|
116
|
+
tp.data.load_tecplot(infile)
|
|
117
|
+
|
|
118
|
+
frame = tp.active_frame()
|
|
119
|
+
dataset = frame.dataset
|
|
120
|
+
plot = frame.plot(PlotType.Cartesian2D)
|
|
121
|
+
|
|
122
|
+
for txt in frame.texts():
|
|
123
|
+
frame.delete_text(txt)
|
|
124
|
+
|
|
125
|
+
vector_contour = plot.contour(0)
|
|
126
|
+
vector_contour.variable = dataset.variable('T(K)')
|
|
127
|
+
vector_contour.colormap_name = 'Magma'
|
|
128
|
+
vector_contour.colormap_filter.reversed = True
|
|
129
|
+
vector_contour.legend.show = False
|
|
130
|
+
base_contour = plot.contour(1)
|
|
131
|
+
base_contour.variable = dataset.variable('P(N/M2)')
|
|
132
|
+
base_contour.colormap_name = 'GrayScale'
|
|
133
|
+
base_contour.colormap_filter.reversed = True
|
|
134
|
+
base_contour.legend.show = False
|
|
135
|
+
|
|
136
|
+
vector = plot.vector
|
|
137
|
+
vector.u_variable = dataset.variable('U(M/S)')
|
|
138
|
+
vector.v_variable = dataset.variable('V(M/S)')
|
|
139
|
+
vector.relative_length = 1E-5
|
|
140
|
+
vector.arrowhead_size = 0.2
|
|
141
|
+
vector.arrowhead_angle = 16
|
|
142
|
+
|
|
143
|
+
ref_vector = vector.reference_vector
|
|
144
|
+
ref_vector.show = True
|
|
145
|
+
ref_vector.position = 50, 95
|
|
146
|
+
ref_vector.line_thickness = 0.4
|
|
147
|
+
ref_vector.label.show = True
|
|
148
|
+
ref_vector.label.format.format_type = NumberFormat.FixedFloat
|
|
149
|
+
ref_vector.label.format.precision = 1
|
|
150
|
+
ref_vector.magnitude = 100
|
|
151
|
+
|
|
152
|
+
fmap = plot.fieldmap(0)
|
|
153
|
+
fmap.contour.flood_contour_group = base_contour
|
|
154
|
+
fmap.vector.color = vector_contour
|
|
155
|
+
fmap.vector.line_thickness = 0.4
|
|
156
|
+
|
|
157
|
+
plot.show_contour = True
|
|
158
|
+
plot.show_streamtraces = False
|
|
159
|
+
plot.show_vector = True
|
|
160
|
+
|
|
161
|
+
plot.axes.y_axis.min = -0.005
|
|
162
|
+
plot.axes.y_axis.max = 0.005
|
|
163
|
+
plot.axes.x_axis.min = -0.002
|
|
164
|
+
plot.axes.x_axis.max = 0.008
|
|
165
|
+
|
|
166
|
+
tp.export.save_png('vector2d_reference.png', 600, supersample=3)
|
|
167
|
+
|
|
168
|
+
.. figure:: /_static/images/vector2d_reference.png
|
|
169
|
+
:width: 300px
|
|
170
|
+
:figwidth: 300px
|
|
171
|
+
"""
|
|
172
|
+
def __init__(self, vector):
|
|
173
|
+
self.vector = vector
|
|
174
|
+
super().__init__(vector._sv, sv.REFVECTOR, **vector._kw)
|
|
175
|
+
|
|
176
|
+
@property
|
|
177
|
+
def show(self):
|
|
178
|
+
"""`bool`: Draw the reference vector.
|
|
179
|
+
|
|
180
|
+
Example usage::
|
|
181
|
+
|
|
182
|
+
>>> plot.vector.reference_vector.show = True
|
|
183
|
+
"""
|
|
184
|
+
return self._get_style(bool, sv.SHOW)
|
|
185
|
+
|
|
186
|
+
@show.setter
|
|
187
|
+
def show(self, value):
|
|
188
|
+
self._set_style(bool(value), sv.SHOW)
|
|
189
|
+
|
|
190
|
+
@property
|
|
191
|
+
def color(self):
|
|
192
|
+
"""`Color`: `Color` of the reference vector.
|
|
193
|
+
|
|
194
|
+
Example usage::
|
|
195
|
+
|
|
196
|
+
>>> from tecplot.constant import Color
|
|
197
|
+
>>> ref_vector = plot.vector.reference_vector
|
|
198
|
+
>>> ref_vector.show = True
|
|
199
|
+
>>> ref_vector.color = Color.Red
|
|
200
|
+
"""
|
|
201
|
+
return self._get_style(Color, sv.COLOR)
|
|
202
|
+
|
|
203
|
+
@color.setter
|
|
204
|
+
def color(self, value):
|
|
205
|
+
self._set_style(Color(value), sv.COLOR)
|
|
206
|
+
|
|
207
|
+
@property
|
|
208
|
+
def position(self):
|
|
209
|
+
"""`tuple`: :math:`(x,y)` of the reference vector in percent of frame height.
|
|
210
|
+
|
|
211
|
+
Example usage::
|
|
212
|
+
|
|
213
|
+
>>> ref_vector = plot.vector.reference_vector
|
|
214
|
+
>>> ref_vector.show = True
|
|
215
|
+
>>> ref_vector.position = (50, 5) # bottom, center
|
|
216
|
+
"""
|
|
217
|
+
return session.XY(self, sv.XYPOS)
|
|
218
|
+
|
|
219
|
+
@position.setter
|
|
220
|
+
def position(self, pos):
|
|
221
|
+
session.XY(self, sv.XYPOS)[:] = pos
|
|
222
|
+
|
|
223
|
+
@property
|
|
224
|
+
def magnitude(self):
|
|
225
|
+
"""`float` (data units): Length of the reference vector.
|
|
226
|
+
|
|
227
|
+
Example usage::
|
|
228
|
+
|
|
229
|
+
>>> ref_vector = plot.vector.reference_vector
|
|
230
|
+
>>> ref_vector.show = True
|
|
231
|
+
>>> ref_vector.magnitude = 2
|
|
232
|
+
"""
|
|
233
|
+
return self._get_style(float, sv.MAGNITUDE)
|
|
234
|
+
|
|
235
|
+
@magnitude.setter
|
|
236
|
+
def magnitude(self, value):
|
|
237
|
+
self._set_style(float(value), sv.MAGNITUDE)
|
|
238
|
+
|
|
239
|
+
@property
|
|
240
|
+
def angle(self):
|
|
241
|
+
"""`float` (degrees): Degrees counter-clockwise to rotate the reference vector.
|
|
242
|
+
|
|
243
|
+
Example usage::
|
|
244
|
+
|
|
245
|
+
>>> ref_vector = plot.vector.reference_vector
|
|
246
|
+
>>> ref_vector.show = True
|
|
247
|
+
>>> ref_vector.angle = 90 # vertical, up
|
|
248
|
+
"""
|
|
249
|
+
return self._get_style(float, sv.ANGLE)
|
|
250
|
+
|
|
251
|
+
@angle.setter
|
|
252
|
+
def angle(self, value):
|
|
253
|
+
self._set_style(float(value), sv.ANGLE)
|
|
254
|
+
|
|
255
|
+
@property
|
|
256
|
+
def line_thickness(self):
|
|
257
|
+
"""`float` (percentage of frame height): reference vector line thickness.
|
|
258
|
+
|
|
259
|
+
Example usage::
|
|
260
|
+
|
|
261
|
+
>>> ref_vector = plot.vector.reference_vector
|
|
262
|
+
>>> ref_vector.show = True
|
|
263
|
+
>>> ref_vector.line_thickness = 0.3
|
|
264
|
+
"""
|
|
265
|
+
return self._get_style(float, sv.LINETHICKNESS)
|
|
266
|
+
|
|
267
|
+
@line_thickness.setter
|
|
268
|
+
def line_thickness(self, value):
|
|
269
|
+
self._set_style(float(value), sv.LINETHICKNESS)
|
|
270
|
+
|
|
271
|
+
@property
|
|
272
|
+
def label(self):
|
|
273
|
+
"""`ReferenceVectorLabel`: reference vector label style control.
|
|
274
|
+
|
|
275
|
+
Example usage::
|
|
276
|
+
|
|
277
|
+
>>> ref_vector = plot.vector.reference_vector
|
|
278
|
+
>>> ref_vector.show = True
|
|
279
|
+
>>> ref_vector.label.show = True
|
|
280
|
+
"""
|
|
281
|
+
return ReferenceVectorLabel(self)
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
class Vector(session.Style):
|
|
285
|
+
def __init__(self, plot, *svargs):
|
|
286
|
+
self.plot = plot
|
|
287
|
+
super().__init__(*svargs, uniqueid=self.plot.frame.uid)
|
|
288
|
+
|
|
289
|
+
@property
|
|
290
|
+
def arrowhead_angle(self):
|
|
291
|
+
"""`float` (degrees): Angle between the vector body and the head line.
|
|
292
|
+
|
|
293
|
+
Example usage::
|
|
294
|
+
|
|
295
|
+
>>> plot.vector.arrowhead_angle = 10
|
|
296
|
+
"""
|
|
297
|
+
return self._get_style(float, sv.ARROWHEADANGLE)
|
|
298
|
+
|
|
299
|
+
@arrowhead_angle.setter
|
|
300
|
+
def arrowhead_angle(self, value):
|
|
301
|
+
self._set_style(float(value), sv.ARROWHEADANGLE)
|
|
302
|
+
|
|
303
|
+
@property
|
|
304
|
+
def arrowhead_fraction(self):
|
|
305
|
+
"""`float` (ratio): Size of the arrowhead when sizing by fraction.
|
|
306
|
+
|
|
307
|
+
The ``size_arrowhead_by_fraction`` property must be set to `True` for
|
|
308
|
+
this to take effect::
|
|
309
|
+
|
|
310
|
+
>>> plot.vector.size_arrowhead_by_fraction = True
|
|
311
|
+
>>> plot.vector.arrowhead_fraction = 0.4
|
|
312
|
+
"""
|
|
313
|
+
return self._get_style(float, sv.HEADSIZEASFRACTION)
|
|
314
|
+
|
|
315
|
+
@arrowhead_fraction.setter
|
|
316
|
+
def arrowhead_fraction(self, value):
|
|
317
|
+
self._set_style(float(value), sv.HEADSIZEASFRACTION)
|
|
318
|
+
|
|
319
|
+
@property
|
|
320
|
+
def arrowhead_size(self):
|
|
321
|
+
"""`float` (percent of frame height): Size of arrowhead when sizing by frame height.
|
|
322
|
+
|
|
323
|
+
The ``size_arrowhead_by_fraction`` property must be set to `False` for
|
|
324
|
+
this to take effect::
|
|
325
|
+
|
|
326
|
+
>>> plot.vector.size_arrowhead_by_fraction = False
|
|
327
|
+
>>> plot.vector.arrowhead_size = 4
|
|
328
|
+
"""
|
|
329
|
+
return self._get_style(float, sv.HEADSIZEINFRAMEUNITS)
|
|
330
|
+
|
|
331
|
+
@arrowhead_size.setter
|
|
332
|
+
def arrowhead_size(self, value):
|
|
333
|
+
self._set_style(float(value), sv.HEADSIZEINFRAMEUNITS)
|
|
334
|
+
|
|
335
|
+
@property
|
|
336
|
+
def relative_length(self):
|
|
337
|
+
"""`float` (grid units or cm per magnitude): Magnitude-varying length of the vector line.
|
|
338
|
+
|
|
339
|
+
When ``use_relative`` is `True`, the length of the vectors will be
|
|
340
|
+
relative to the magnitude of the velocity vector values in the data
|
|
341
|
+
field, scaled by this parameter which is either grid-units or
|
|
342
|
+
centimeters per unit magnitude depending on the value of
|
|
343
|
+
``use_grid_units``::
|
|
344
|
+
|
|
345
|
+
>>> plot.vector.use_relative = True
|
|
346
|
+
>>> plot.vector.use_grid_units = True
|
|
347
|
+
>>> plot.vector.relative_length = 0.003
|
|
348
|
+
"""
|
|
349
|
+
with self.plot.activated():
|
|
350
|
+
return self._get_style(float, sv.RELATIVELENGTH)
|
|
351
|
+
|
|
352
|
+
@relative_length.setter
|
|
353
|
+
def relative_length(self, value):
|
|
354
|
+
self._set_style(float(value), sv.RELATIVELENGTH)
|
|
355
|
+
|
|
356
|
+
@property
|
|
357
|
+
def use_even_spacing(self):
|
|
358
|
+
"""`bool`: Use even spacing for vectors.
|
|
359
|
+
|
|
360
|
+
When `True` this will selectively remove vectors from the plot to
|
|
361
|
+
approximately enforce the display intervals specified by ``even_spacing``.
|
|
362
|
+
|
|
363
|
+
Turn on even spacing::
|
|
364
|
+
|
|
365
|
+
>>> plot.vector.use_even_spacing = True
|
|
366
|
+
"""
|
|
367
|
+
return self._get_style(bool, sv.USEEVENSPACING)
|
|
368
|
+
|
|
369
|
+
@use_even_spacing.setter
|
|
370
|
+
def use_even_spacing(self, value):
|
|
371
|
+
self._set_style(bool(value), sv.USEEVENSPACING)
|
|
372
|
+
|
|
373
|
+
@property
|
|
374
|
+
def use_grid_units(self):
|
|
375
|
+
"""`bool`: Use grid-units when determining the relative length.
|
|
376
|
+
|
|
377
|
+
This takes effect only if ``use_relative`` is `True`. If `False`,
|
|
378
|
+
``relative_length`` will be in cm per magnitude::
|
|
379
|
+
|
|
380
|
+
>>> plot.vector.use_relative = True
|
|
381
|
+
>>> plot.vector.use_grid_units = False
|
|
382
|
+
>>> plot.vector.relative_length = 0.010
|
|
383
|
+
"""
|
|
384
|
+
return self._get_style(bool, sv.RELATIVELENGTHINGRIDUNITS)
|
|
385
|
+
|
|
386
|
+
@use_grid_units.setter
|
|
387
|
+
def use_grid_units(self, value):
|
|
388
|
+
self._set_style(bool(value), sv.RELATIVELENGTHINGRIDUNITS)
|
|
389
|
+
|
|
390
|
+
@property
|
|
391
|
+
def size_arrowhead_by_fraction(self):
|
|
392
|
+
"""`bool`: Base arrowhead size on length of vector line.
|
|
393
|
+
|
|
394
|
+
Example usage::
|
|
395
|
+
|
|
396
|
+
>>> plot.vector.size_arrowhead_by_fraction = True
|
|
397
|
+
>>> plot.vector.relative_length = 0.1
|
|
398
|
+
"""
|
|
399
|
+
return self._get_style(bool, sv.SIZEHEADBYFRACTION)
|
|
400
|
+
|
|
401
|
+
@size_arrowhead_by_fraction.setter
|
|
402
|
+
def size_arrowhead_by_fraction(self, value):
|
|
403
|
+
self._set_style(bool(value), sv.SIZEHEADBYFRACTION)
|
|
404
|
+
|
|
405
|
+
@property
|
|
406
|
+
def length(self):
|
|
407
|
+
"""`float` (percent of plot height): Length of all vectors when not using relative sizing.
|
|
408
|
+
|
|
409
|
+
Example usage::
|
|
410
|
+
|
|
411
|
+
>>> plot.vector.use_relative = False
|
|
412
|
+
>>> plot.vector.length = 5
|
|
413
|
+
"""
|
|
414
|
+
return self._get_style(float, sv.UNIFORMLENGTH)
|
|
415
|
+
|
|
416
|
+
@length.setter
|
|
417
|
+
def length(self, value):
|
|
418
|
+
self._set_style(float(value), sv.UNIFORMLENGTH)
|
|
419
|
+
|
|
420
|
+
@property
|
|
421
|
+
def use_relative(self):
|
|
422
|
+
"""`bool`: Use relative sizing for vector lines.
|
|
423
|
+
|
|
424
|
+
This determines whether ``length`` or ``relative_length`` are used to
|
|
425
|
+
size the arrow lines. Example usage::
|
|
426
|
+
|
|
427
|
+
>>> plot.vector.use_relative = False
|
|
428
|
+
>>> plot.vector.relative_length = 0.5
|
|
429
|
+
"""
|
|
430
|
+
return self._get_style(bool, sv.USERELATIVE)
|
|
431
|
+
|
|
432
|
+
@use_relative.setter
|
|
433
|
+
def use_relative(self, value):
|
|
434
|
+
self._set_style(bool(value), sv.USERELATIVE)
|
|
435
|
+
|
|
436
|
+
@property
|
|
437
|
+
def reference_vector(self):
|
|
438
|
+
"""`ReferenceVector`: Vector field reference vector.
|
|
439
|
+
|
|
440
|
+
Example usage::
|
|
441
|
+
|
|
442
|
+
>>> plot.vector.reference_vector.show = True
|
|
443
|
+
"""
|
|
444
|
+
return ReferenceVector(self)
|
|
445
|
+
|
|
446
|
+
@property
|
|
447
|
+
def u_variable_index(self):
|
|
448
|
+
"""`int` (Zero-based index): :math:`U`-component `Variable` index of the plotted vectors.
|
|
449
|
+
|
|
450
|
+
Vectors are plotted as :math:`(u,v,w)`. Example usage::
|
|
451
|
+
|
|
452
|
+
>>> plot.vector.u_variable_index = 3
|
|
453
|
+
"""
|
|
454
|
+
return self._get_style(Index, sv.UVAR)
|
|
455
|
+
|
|
456
|
+
@u_variable_index.setter
|
|
457
|
+
def u_variable_index(self, index):
|
|
458
|
+
self._set_style(Index(index), sv.UVAR)
|
|
459
|
+
|
|
460
|
+
@property
|
|
461
|
+
def u_variable(self):
|
|
462
|
+
"""`Variable`: :math:`U`-component `Variable` of the plotted vectors.
|
|
463
|
+
|
|
464
|
+
Vectors are plotted as :math:`(u,v,w)`. Example usage::
|
|
465
|
+
|
|
466
|
+
>>> plot.vector.u_variable = dataset.variable('Pressure X')
|
|
467
|
+
"""
|
|
468
|
+
return self.plot.frame.dataset.variable(self.u_variable_index)
|
|
469
|
+
|
|
470
|
+
@u_variable.setter
|
|
471
|
+
def u_variable(self, variable):
|
|
472
|
+
self.u_variable_index = variable.index
|
|
473
|
+
|
|
474
|
+
@property
|
|
475
|
+
def v_variable_index(self):
|
|
476
|
+
"""`int` (Zero-based index): :math:`V`-component `Variable` index of the plotted vectors.
|
|
477
|
+
|
|
478
|
+
Vectors are plotted as :math:`(u,v,w)`. Example usage::
|
|
479
|
+
|
|
480
|
+
>>> plot.vector.v_variable_index = 4
|
|
481
|
+
"""
|
|
482
|
+
return self._get_style(Index, sv.VVAR)
|
|
483
|
+
|
|
484
|
+
@v_variable_index.setter
|
|
485
|
+
def v_variable_index(self, index):
|
|
486
|
+
self._set_style(Index(index), sv.VVAR)
|
|
487
|
+
|
|
488
|
+
@property
|
|
489
|
+
def v_variable(self):
|
|
490
|
+
"""`Variable`: :math:`V`-component `Variable` of the plotted vectors.
|
|
491
|
+
|
|
492
|
+
Vectors are plotted as :math:`(u,v,w)`. Example usage::
|
|
493
|
+
|
|
494
|
+
>>> plot.vector.v_variable = dataset.variable('Pressure Y')
|
|
495
|
+
"""
|
|
496
|
+
return self.plot.frame.dataset.variable(self.v_variable_index)
|
|
497
|
+
|
|
498
|
+
@v_variable.setter
|
|
499
|
+
def v_variable(self, variable):
|
|
500
|
+
self.v_variable_index = variable.index
|
|
501
|
+
|
|
502
|
+
@lock()
|
|
503
|
+
def reset_even_spacing(self):
|
|
504
|
+
"""Reset the even vector spacing.
|
|
505
|
+
|
|
506
|
+
Example usage::
|
|
507
|
+
|
|
508
|
+
>>> plot.vector.reset_even_spacing()
|
|
509
|
+
"""
|
|
510
|
+
with self.plot.frame.activated():
|
|
511
|
+
if not _tecutil.ResetVectorSpacing():
|
|
512
|
+
raise TecplotSystemError()
|
|
513
|
+
|
|
514
|
+
@lock()
|
|
515
|
+
def reset_length(self):
|
|
516
|
+
"""Reset the vector length.
|
|
517
|
+
|
|
518
|
+
Example usage::
|
|
519
|
+
|
|
520
|
+
>>> plot.vector.reset_length()
|
|
521
|
+
"""
|
|
522
|
+
with self.plot.frame.activated():
|
|
523
|
+
if not _tecutil.ResetVectorLength():
|
|
524
|
+
raise TecplotSystemError()
|
|
525
|
+
|
|
526
|
+
|
|
527
|
+
class Vector2D(Vector):
|
|
528
|
+
"""Vector field style control for Cartesian 2D plots.
|
|
529
|
+
|
|
530
|
+
This object controls the style of the vectors that are plotted according to
|
|
531
|
+
the vector properties under fieldmaps. The :math:`(u,v)` components are
|
|
532
|
+
set using this class as well as attributes such as length, arrow-head size
|
|
533
|
+
and the reference vector. This example shows how to show the vector field,
|
|
534
|
+
adjusting the arrows color and thickness:
|
|
535
|
+
|
|
536
|
+
.. code-block:: python
|
|
537
|
+
:emphasize-lines: 22-28
|
|
538
|
+
|
|
539
|
+
from os import path
|
|
540
|
+
import tecplot as tp
|
|
541
|
+
from tecplot.constant import *
|
|
542
|
+
|
|
543
|
+
examples_dir = tp.session.tecplot_examples_directory()
|
|
544
|
+
infile = path.join(examples_dir, 'SimpleData', '3ElementWing.lpk')
|
|
545
|
+
tp.load_layout(infile)
|
|
546
|
+
|
|
547
|
+
frame = tp.active_frame()
|
|
548
|
+
dataset = frame.dataset
|
|
549
|
+
plot = frame.plot(PlotType.Cartesian2D)
|
|
550
|
+
|
|
551
|
+
frame.background_color = Color.Black
|
|
552
|
+
for axis in plot.axes:
|
|
553
|
+
axis.show = False
|
|
554
|
+
|
|
555
|
+
plot.axes.x_axis.min = -0.2
|
|
556
|
+
plot.axes.x_axis.max = 0.3
|
|
557
|
+
plot.axes.y_axis.min = -0.2
|
|
558
|
+
plot.axes.y_axis.max = 0.15
|
|
559
|
+
|
|
560
|
+
vect = plot.vector
|
|
561
|
+
vect.u_variable = dataset.variable('U(M/S)')
|
|
562
|
+
vect.v_variable = dataset.variable('V(M/S)')
|
|
563
|
+
vect.relative_length = 0.00025
|
|
564
|
+
vect.size_arrowhead_by_fraction = False
|
|
565
|
+
vect.arrowhead_size = 4
|
|
566
|
+
vect.arrowhead_angle = 10
|
|
567
|
+
|
|
568
|
+
plot.show_contour = False
|
|
569
|
+
plot.show_streamtraces = False
|
|
570
|
+
plot.show_edge = True
|
|
571
|
+
plot.show_vector = True
|
|
572
|
+
|
|
573
|
+
cont = plot.contour(0)
|
|
574
|
+
cont.variable = dataset.variable('P(N/M2)')
|
|
575
|
+
cont.colormap_name = 'Diverging - Blue/Yellow/Red'
|
|
576
|
+
cont.levels.reset_levels(80000, 90000, 100000, 110000, 120000)
|
|
577
|
+
|
|
578
|
+
plot.fieldmaps().show = False
|
|
579
|
+
|
|
580
|
+
fmap = plot.fieldmap(3)
|
|
581
|
+
fmap.show = True
|
|
582
|
+
fmap.edge.color = Color.White
|
|
583
|
+
fmap.edge.line_thickness = 1
|
|
584
|
+
fmap.points.step = 5
|
|
585
|
+
fmap.vector.color = cont
|
|
586
|
+
fmap.vector.line_thickness = 0.5
|
|
587
|
+
|
|
588
|
+
tp.export.save_png('vector2d.png', 600, supersample=3)
|
|
589
|
+
|
|
590
|
+
.. figure:: /_static/images/vector2d.png
|
|
591
|
+
:width: 300px
|
|
592
|
+
:figwidth: 300px
|
|
593
|
+
"""
|
|
594
|
+
def __init__(self, plot):
|
|
595
|
+
super().__init__(plot, sv.GLOBALTWODVECTOR)
|
|
596
|
+
|
|
597
|
+
@property
|
|
598
|
+
def even_spacing(self):
|
|
599
|
+
"""`tuple`: Spacing for even vectors.
|
|
600
|
+
|
|
601
|
+
Set the spacing values in axial directions for even spaced vectors.
|
|
602
|
+
When ``use_even_spacing`` is turned on this will selectively remove
|
|
603
|
+
vectors so that only one vector occupies each grid region defined
|
|
604
|
+
by the spacing. Spacing is aligned with the X and Y axes.
|
|
605
|
+
|
|
606
|
+
Example of setting spacing in X to 0.1 and Y to 0.2::
|
|
607
|
+
|
|
608
|
+
>>> plot.vector.use_even_spacing = True
|
|
609
|
+
>>> plot.vector.even_spacing = (0.1, 0.2)
|
|
610
|
+
"""
|
|
611
|
+
style = session.Style(sv.GLOBALTWODVECTOR, uniqueid=self.plot.frame.uid)
|
|
612
|
+
return session.XY(style, sv.EVENSPACING)
|
|
613
|
+
|
|
614
|
+
@even_spacing.setter
|
|
615
|
+
def even_spacing(self, values):
|
|
616
|
+
style = session.Style(sv.GLOBALTWODVECTOR, uniqueid=self.plot.frame.uid)
|
|
617
|
+
session.XY(style, sv.EVENSPACING)[:] = values
|
|
618
|
+
|
|
619
|
+
|
|
620
|
+
class Vector3D(Vector):
|
|
621
|
+
"""Vector field style control for Cartesian 3D plots.
|
|
622
|
+
|
|
623
|
+
This object controls the style of the vectors that are plotted according to
|
|
624
|
+
the vector properties under fieldmaps. The :math:`(u,v,w)` components are
|
|
625
|
+
set using this class as well as attributes such as length, arrow-head size
|
|
626
|
+
and the reference vector. See the `example for 2D vector plots <Vector2D>`.
|
|
627
|
+
"""
|
|
628
|
+
def __init__(self, plot):
|
|
629
|
+
super().__init__(plot, sv.GLOBALTHREEDVECTOR)
|
|
630
|
+
|
|
631
|
+
@property
|
|
632
|
+
def w_variable_index(self):
|
|
633
|
+
"""`int` (Zero-based index): :math:`W`-component `Variable` index of the plotted vectors.
|
|
634
|
+
|
|
635
|
+
Vectors are plotted as :math:`(u,v,w)`. Example usage::
|
|
636
|
+
|
|
637
|
+
>>> plot.vector.w_variable_index = 5
|
|
638
|
+
"""
|
|
639
|
+
return self._get_style(Index, sv.WVAR)
|
|
640
|
+
|
|
641
|
+
@w_variable_index.setter
|
|
642
|
+
def w_variable_index(self, index):
|
|
643
|
+
self._set_style(Index(index), sv.WVAR)
|
|
644
|
+
|
|
645
|
+
@property
|
|
646
|
+
def w_variable(self):
|
|
647
|
+
"""`Variable`: :math:`W`-component `Variable` of the plotted vectors.
|
|
648
|
+
|
|
649
|
+
Vectors are plotted as :math:`(u,v,w)`. Example usage::
|
|
650
|
+
|
|
651
|
+
>>> plot.vector.w_variable = dataset.variable('Pressure Z')
|
|
652
|
+
"""
|
|
653
|
+
return self.plot.frame.dataset.variable(self.w_variable_index)
|
|
654
|
+
|
|
655
|
+
@w_variable.setter
|
|
656
|
+
def w_variable(self, variable):
|
|
657
|
+
self.w_variable_index = variable.index
|
|
658
|
+
|
|
659
|
+
@property
|
|
660
|
+
def even_spacing(self):
|
|
661
|
+
"""`tuple`: Spacing for even vectors.
|
|
662
|
+
|
|
663
|
+
Set the spacing values in axial directions for even spaced vectors.
|
|
664
|
+
When ``use_even_spacing`` is turned on this will selectively remove
|
|
665
|
+
vectors so that only one vector occupies each grid region defined
|
|
666
|
+
by the spacing. Spacing is aligned with the X, Y, and Z axes.
|
|
667
|
+
|
|
668
|
+
Example of setting spacing in X to 0.1, Y to 0.2 and Z to 0.3::
|
|
669
|
+
|
|
670
|
+
>>> plot.vector.use_even_spacing = True
|
|
671
|
+
>>> plot.vector.even_spacing = (0.1, 0.2, 0.3)
|
|
672
|
+
"""
|
|
673
|
+
style = session.Style(sv.GLOBALTHREEDVECTOR, uniqueid=self.plot.frame.uid)
|
|
674
|
+
return session.XYZ(style, sv.EVENSPACING)
|
|
675
|
+
|
|
676
|
+
@even_spacing.setter
|
|
677
|
+
def even_spacing(self, values):
|
|
678
|
+
style = session.Style(sv.GLOBALTHREEDVECTOR, uniqueid=self.plot.frame.uid)
|
|
679
|
+
session.XYZ(style, sv.EVENSPACING)[:] = values
|