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,66 @@
1
+ from builtins import super
2
+
3
+ from ..tecutil import sv
4
+ from . import legend
5
+
6
+
7
+ class LineLegend(legend.CategoryLegend):
8
+ """Line plot legend attributes.
9
+
10
+ The XY line legend shows the line and symbol attributes of XY mappings. In
11
+ `XY line plots <XYLinePlot>`, this legend includes the bar chart
12
+ information. The legend can be positioned anywhere within the line plot
13
+ frame by setting the `position` attribute. By default, all mappings are
14
+ shown, but |Tecplot 360| removes redundant entries. Example usage:
15
+
16
+ .. code-block:: python
17
+ :emphasize-lines: 23-38
18
+
19
+ import os
20
+
21
+ import tecplot
22
+ from tecplot.constant import *
23
+
24
+ examples_dir = tecplot.session.tecplot_examples_directory()
25
+ datafile = os.path.join(examples_dir, 'SimpleData', 'Rainfall.dat')
26
+ dataset = tecplot.data.load_tecplot(datafile)
27
+
28
+ frame = tecplot.active_frame()
29
+ plot = frame.plot()
30
+ frame.plot_type = tecplot.constant.PlotType.XYLine
31
+
32
+ for i in range(3):
33
+ plot.linemap(i).show = True
34
+ plot.linemap(i).line.line_thickness = .4
35
+
36
+ y_axis = plot.axes.y_axis(0)
37
+ y_axis.title.title_mode = AxisTitleMode.UseText
38
+ y_axis.title.text = 'Rainfall (in)'
39
+ y_axis.fit_range_to_nice()
40
+
41
+ legend = plot.legend
42
+ legend.show = True
43
+ legend.box.box_type = TextBox.Filled
44
+ legend.box.color = Color.Purple
45
+ legend.box.fill_color = Color.LightGrey
46
+ legend.box.line_thickness = .4
47
+ legend.box.margin = 5
48
+
49
+ legend.anchor_alignment = AnchorAlignment.MiddleRight
50
+ legend.row_spacing = 1.5
51
+ legend.show_text = True
52
+ legend.font.typeface = 'Arial'
53
+ legend.font.italic = True
54
+
55
+ legend.text_color = Color.Black
56
+ legend.position = (90, 88)
57
+
58
+ tecplot.export.save_png('legend_line.png', 600, supersample=3)
59
+
60
+ .. figure:: /_static/images/legend_line.png
61
+ :width: 300px
62
+ :figwidth: 300px
63
+ """
64
+ def __init__(self, plot):
65
+ self.plot = plot
66
+ super().__init__(sv.GLOBALLINEPLOT, sv.LEGEND, **plot._kw)
@@ -0,0 +1,291 @@
1
+ from builtins import str, super
2
+
3
+ from ..constant import *
4
+ from ..tecutil import sv
5
+ from .. import tecutil
6
+ from . import legend
7
+
8
+
9
+ class RGBColoringLegend(legend.Legend):
10
+ """Legend for RGB coloring (multivariate contour) plots.
11
+
12
+ .. note::
13
+ The RGB coloring legend will only show when an active fieldmap's
14
+ contour is being flooded by RGB.
15
+
16
+ .. code-block:: python
17
+ :emphasize-lines: 46-48
18
+
19
+ import os
20
+ import numpy as np
21
+
22
+ import tecplot as tp
23
+ from tecplot.constant import *
24
+
25
+ def normalize_variable(dataset, varname, nsigma=2):
26
+ '''
27
+ Normalize a variable such that the specified number of standard deviations
28
+ are within the range [0.5, 1] and the mean is transformed to 0.5. The
29
+ new variable will append " normalized" to the original variable's name.
30
+ '''
31
+ with tp.session.suspend():
32
+ newvarname = varname + ' normalized'
33
+ dataset.add_variable(newvarname)
34
+ data = np.concatenate([z.values(varname).as_numpy_array()
35
+ for z in dataset.zones()])
36
+ vmin = data.mean() - nsigma * data.std()
37
+ vmax = data.mean() + nsigma * data.std()
38
+ for z in dataset.zones():
39
+ arr = z.values(varname).as_numpy_array()
40
+ z.values(newvarname)[:] = (arr - vmin) / (vmax - vmin)
41
+
42
+
43
+ examples_dir = tp.session.tecplot_examples_directory()
44
+ infile = os.path.join(examples_dir, 'SimpleData', 'HeatExchanger.plt')
45
+ dataset = tp.data.load_tecplot(infile)
46
+
47
+ frame = tp.active_frame()
48
+ plot = frame.plot(PlotType.Cartesian2D)
49
+ plot.show_contour = True
50
+
51
+ # Variables must be normalized relative to each other
52
+ # to make effective use of RGB coloring.
53
+ normalize_variable(dataset, 'T(K)')
54
+ normalize_variable(dataset, 'P(N)')
55
+
56
+ plot.rgb_coloring.mode = RGBMode.SpecifyGB
57
+
58
+ # all three channel variables must be set even if
59
+ # we are only contouring on two of them.
60
+ plot.rgb_coloring.red_variable = dataset.variable(0)
61
+ plot.rgb_coloring.green_variable = dataset.variable('P(N) normalized')
62
+ plot.rgb_coloring.blue_variable = dataset.variable('T(K) normalized')
63
+
64
+ plot.rgb_coloring.legend.show = True
65
+ plot.rgb_coloring.legend.green_label = 'Pressure'
66
+ plot.rgb_coloring.legend.blue_label = 'Temperature'
67
+
68
+ plot.fieldmaps().contour.flood_contour_group = plot.rgb_coloring
69
+
70
+ tp.export.save_png('rgb_coloring_legend.png')
71
+
72
+ .. figure:: /_static/images/rgb_coloring_legend.png
73
+ :width: 300px
74
+ :figwidth: 300px
75
+ """
76
+ def __init__(self, rgb_coloring):
77
+ self.rgb_coloring = rgb_coloring
78
+ super().__init__(rgb_coloring._sv, sv.LEGEND, **rgb_coloring._kw)
79
+
80
+ @tecutil.inherited_property(legend.CategoryLegend)
81
+ def box(self):
82
+ """`text.TextBox`: Legend box attributes.
83
+
84
+ Example usage::
85
+
86
+ >>> from tecplot.constant import Color
87
+ >>> plot.rgb_coloring.legend.box.fill_color = Color.Yellow
88
+ """
89
+
90
+ @tecutil.inherited_property(legend.CategoryLegend)
91
+ def show(self):
92
+ """`bool`: Display the RGB coloring legend.
93
+
94
+ Example usage::
95
+
96
+ >>> plot.rgb_coloring.legend.show = True
97
+ """
98
+
99
+ @tecutil.inherited_property(legend.CategoryLegend)
100
+ def anchor_alignment(self):
101
+ """`AnchorAlignment`: Anchor location of the legend.
102
+
103
+ Example usage::
104
+
105
+ >>> from tecplot.constant import AnchorAlignment
106
+ >>> legend = plot.rgb_coloring.legend
107
+ >>> legend.anchor_alignment = AnchorAlignment.BottomCenter
108
+ """
109
+
110
+ @tecutil.inherited_property(legend.CategoryLegend)
111
+ def text_color(self):
112
+ """`Color`: Color of legend text.
113
+
114
+ Example usage::
115
+
116
+ >>> from tecplot.constant import Color
117
+ >>> legend = plot.rgb_coloring.legend
118
+ >>> legend.text_color = Color.Blue
119
+ """
120
+
121
+ @tecutil.inherited_property(legend.CategoryLegend)
122
+ def position(self):
123
+ """`tuple`: Position as a percentage of frame width/height.
124
+
125
+ The legend is automatically placed for you. You may specify the
126
+ :math:`(x,y)` position of the legend by setting this value, where
127
+ :math:`x` is the percentage of frame width, and :math:`y` is a
128
+ percentage of frame height.
129
+
130
+ Example usage::
131
+
132
+ >>> plot.rgb_coloring.legend.position = (20, 80)
133
+ """
134
+
135
+ @tecutil.inherited_property(legend.CategoryLegend)
136
+ def font(self):
137
+ """`text.Font`: Legend font attributes.
138
+
139
+ .. note::
140
+ The font `size_units <tecplot.text.Font.size_units>` property
141
+ may only be set to `Units.Frame` or `Units.Point`.
142
+
143
+ Example usage::
144
+
145
+ >>> plot.rgb_coloring.legend.font.italic = True
146
+ """
147
+
148
+ @property
149
+ def show_labels(self):
150
+ """`bool`: Show the RGB channel labels.
151
+
152
+ Example usage::
153
+
154
+ >>> legend = plot.rgb_coloring.legend
155
+ >>> legend.show_labels = True
156
+ >>> legend.red_label = 'Variable A'
157
+ >>> legend.green_label = 'Variable B'
158
+ >>> legend.blue_label = 'Variable C'
159
+ """
160
+ return self._get_style(bool, sv.SHOWLABELS)
161
+
162
+ @show_labels.setter
163
+ def show_labels(self, value):
164
+ self._set_style(bool(value), sv.SHOWLABELS)
165
+
166
+ @property
167
+ def height(self):
168
+ """`float`: Size of RGB coloring legend
169
+
170
+ Example usage::
171
+
172
+ >>> plot.rgb_coloring.legend.height = 20
173
+ """
174
+ return self._get_style(float, sv.HEIGHT)
175
+
176
+ @height.setter
177
+ def height(self, value):
178
+ self._set_style(float(value), sv.HEIGHT)
179
+
180
+ @property
181
+ def orientation(self):
182
+ """`RGBLegendOrientation`: Placement of the RGB channels on the legend.
183
+
184
+ The first color is on the bottom left, the second is on the bottom
185
+ right, and the third is on top. Example usage::
186
+
187
+ >>> from tecplot.constant import RGBLegendOrientation
188
+ >>> legend = plot.rgb_coloring.legend
189
+ >>> legend.orientation = RGBLegendOrientation.RBG
190
+ """
191
+ return self._get_style(RGBLegendOrientation, sv.RGBLEGENDORIENTATION)
192
+
193
+ @orientation.setter
194
+ def orientation(self, value):
195
+ self._set_style(RGBLegendOrientation(value), sv.RGBLEGENDORIENTATION)
196
+
197
+ @property
198
+ def use_variable_for_red_label(self):
199
+ """`bool`: Use the `Variable` name for the red channel.
200
+
201
+ Example usage::
202
+
203
+ >>> plot.rgb_coloring.legend.use_variable_for_red_label = False
204
+ >>> plot.rgb_coloring.legend.red_label = 'gas'
205
+ """
206
+ return self._get_style(bool, sv.USEREDVARNAME)
207
+
208
+ @use_variable_for_red_label.setter
209
+ def use_variable_for_red_label(self, value):
210
+ self._set_style(bool(value), sv.USEREDVARNAME)
211
+
212
+ @property
213
+ def red_label(self):
214
+ """`str`: Label to use for the red channel.
215
+
216
+ This can be set to a string (which may be empty) but the
217
+ `use_variable_for_red_label` property must be set to `False` for this
218
+ label to be shown::
219
+
220
+ >>> plot.rgb_coloring.legend.use_variable_for_red_label = False
221
+ >>> plot.rgb_coloring.legend.red_label = 'gas'
222
+ """
223
+ return self._get_style(str, sv.REDCHANNELLABEL)
224
+
225
+ @red_label.setter
226
+ def red_label(self, value):
227
+ self._set_style(str(value), sv.REDCHANNELLABEL)
228
+
229
+ @property
230
+ def use_variable_for_green_label(self):
231
+ """`bool`: Use the `Variable` name for the green channel.
232
+
233
+ Example usage::
234
+
235
+ >>> plot.rgb_coloring.legend.use_variable_for_green_label = False
236
+ >>> plot.rgb_coloring.legend.green_label = 'gas'
237
+ """
238
+ return self._get_style(bool, sv.USEGREENVARNAME)
239
+
240
+ @use_variable_for_green_label.setter
241
+ def use_variable_for_green_label(self, value):
242
+ self._set_style(bool(value), sv.USEGREENVARNAME)
243
+
244
+ @property
245
+ def green_label(self):
246
+ """`str`: Label to use for the green channel.
247
+
248
+ This can be set to a string (which may be empty) but the
249
+ `use_variable_for_green_label` property must be set to `False` for this
250
+ label to be shown::
251
+
252
+ >>> plot.rgb_coloring.legend.use_variable_for_green_label = False
253
+ >>> plot.rgb_coloring.legend.green_label = 'oil'
254
+ """
255
+ return self._get_style(str, sv.GREENCHANNELLABEL)
256
+
257
+ @green_label.setter
258
+ def green_label(self, value):
259
+ self._set_style(str(value), sv.GREENCHANNELLABEL)
260
+
261
+ @property
262
+ def use_variable_for_blue_label(self):
263
+ """`bool`: Use the `Variable` name for the blue channel.
264
+
265
+ Example usage::
266
+
267
+ >>> plot.rgb_coloring.legend.use_variable_for_blue_label = False
268
+ >>> plot.rgb_coloring.legend.blue_label = 'gas'
269
+ """
270
+ return self._get_style(bool, sv.USEBLUEVARNAME)
271
+
272
+ @use_variable_for_blue_label.setter
273
+ def use_variable_for_blue_label(self, value):
274
+ self._set_style(bool(value), sv.USEBLUEVARNAME)
275
+
276
+ @property
277
+ def blue_label(self):
278
+ """`str`: Label to use for the blue channel.
279
+
280
+ This can be set to a string (which may be empty) but the
281
+ `use_variable_for_blue_label` property must be set to `False` for this
282
+ label to be shown::
283
+
284
+ >>> plot.rgb_coloring.legend.use_variable_for_blue_label = False
285
+ >>> plot.rgb_coloring.legend.blue_label = 'water'
286
+ """
287
+ return self._get_style(str, sv.BLUECHANNELLABEL)
288
+
289
+ @blue_label.setter
290
+ def blue_label(self, value):
291
+ self._set_style(str(value), sv.BLUECHANNELLABEL)
@@ -0,0 +1,136 @@
1
+ from builtins import super
2
+
3
+ from ..tecutil import sv
4
+ from .. import session, tecutil
5
+ from . import legend
6
+
7
+
8
+ class ScatterLegend(legend.CategoryLegend):
9
+ """Legend style for scatter plots.
10
+
11
+ .. code-block:: python
12
+ :emphasize-lines: 27-28
13
+
14
+ from os import path
15
+ import tecplot as tp
16
+ from tecplot.constant import *
17
+
18
+ examples_dir = tp.session.tecplot_examples_directory()
19
+ infile = path.join(examples_dir, 'SimpleData', 'HeatExchanger.plt')
20
+ dataset = tp.data.load_tecplot(infile)
21
+
22
+ frame = tp.active_frame()
23
+ frame.plot_type = PlotType.Cartesian2D
24
+ plot = frame.plot()
25
+ plot.show_scatter = True
26
+
27
+ # make space for the legend
28
+ plot.axes.viewport.right = 70
29
+ plot.axes.x_axis.min = 4
30
+ plot.axes.x_axis.max = 7
31
+
32
+ # assign some shape and color to each fieldmap
33
+ for i, fmap in enumerate(plot.fieldmaps()):
34
+ for zone in fmap.zones:
35
+ zone.name = 'Zone {}'.format(i)
36
+ fmap.scatter.symbol().shape = GeomShape(i % 7)
37
+ fmap.scatter.fill_mode = FillMode.UseSpecificColor
38
+ fmap.scatter.fill_color = Color(i % 7)
39
+
40
+ plot.scatter.legend.show = True
41
+ plot.scatter.legend.row_spacing = 0.95
42
+
43
+ tp.export.save_png('scatter_legend.png')
44
+
45
+ .. figure:: /_static/images/scatter_legend.png
46
+ :width: 300px
47
+ :figwidth: 300px
48
+ """
49
+ def __init__(self, scatter):
50
+ self.scatter = scatter
51
+ super().__init__(scatter._sv, sv.LEGEND, **scatter._kw)
52
+
53
+ @tecutil.inherited_property(legend.CategoryLegend)
54
+ def box(self):
55
+ """`text.TextBox`: Legend box attributes.
56
+
57
+ Example usage::
58
+
59
+ >>> from tecplot.constant import PlotType, Color
60
+ >>> plot.scatter.legend.box.color = Color.Blue
61
+ """
62
+
63
+ @tecutil.inherited_property(legend.CategoryLegend)
64
+ def show(self):
65
+ """`bool`: Show or hide the legend.
66
+
67
+ Example usage::
68
+
69
+ >>> plot.scatter.legend.show = True
70
+ """
71
+
72
+ @tecutil.inherited_property(legend.CategoryLegend)
73
+ def anchor_alignment(self):
74
+ """`AnchorAlignment`: Anchor location of the legend.
75
+
76
+ Example usage::
77
+
78
+ >>> from tecplot.constant import AnchorAlignment
79
+ >>> legend = plot.scatter.legend
80
+ >>> legend.anchor_alignment = AnchorAlignment.BottomCenter
81
+ """
82
+
83
+ @tecutil.inherited_property(legend.CategoryLegend)
84
+ def row_spacing(self):
85
+ """`float`: Spacing between rows in the legend.
86
+
87
+ Example usage::
88
+
89
+ >>> plot.scatter.legend.row_spacing = 1.5
90
+ """
91
+
92
+ @tecutil.inherited_property(legend.CategoryLegend)
93
+ def text_color(self):
94
+ """`Color`: Color of legend text.
95
+
96
+ Example usage::
97
+
98
+ >>> from tecplot.constant import Color
99
+ >>> plot.scatter.legend.text_color = Color.Blue
100
+ """
101
+
102
+ @tecutil.inherited_property(legend.CategoryLegend)
103
+ def position(self):
104
+ """`tuple`: Position as a percentage of frame width/height.
105
+
106
+ The legend is automatically placed for you. You may specify the
107
+ :math:`(x,y)` position of the legend by setting this value, where
108
+ :math:`x` is the percentage of frame width, and :math:`y` is a
109
+ percentage of frame height.
110
+
111
+ Example usage::
112
+
113
+ >>> plot.scatter.legend.position = (10, 30)
114
+ """
115
+
116
+ @tecutil.inherited_property(legend.CategoryLegend)
117
+ def show_text(self):
118
+ """`bool`: Show/hide mapping names in the legend.
119
+
120
+ Example usage::
121
+
122
+ >>> plot.scatter.legend.show_text = True
123
+ """
124
+
125
+ @tecutil.inherited_property(legend.CategoryLegend)
126
+ def font(self):
127
+ """`text.Font`: Legend font attributes.
128
+
129
+ .. note::
130
+ The font `size_units <tecplot.text.Font.size_units>` property
131
+ may only be set to `Units.Frame` or `Units.Point`.
132
+
133
+ Example usage::
134
+
135
+ >>> plot.scatter.legend.font.italic = True
136
+ """