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,280 @@
1
+ import logging
2
+ from textwrap import dedent
3
+
4
+ from ..tecutil import _tecutil, _tecutil_connector
5
+ from ..constant import *
6
+ from ..exception import *
7
+ from .. import layout, session, tecutil
8
+ from . import array
9
+
10
+ log = logging.getLogger(__name__)
11
+
12
+
13
+ @tecutil.lock_attributes
14
+ class Variable(object):
15
+ """Key value for a data array within a `Dataset <tecplot.data.Dataset>`.
16
+
17
+ `Variables <Variable>` can be identified (uniquely) by the index within
18
+ their parent `Dataset <tecplot.data.Dataset>` or (non-uniquely) by name. In general, a `Zone
19
+ <data_access>` must also be selected to access the underlying data array.
20
+ This object is used by several style controlling classes such as contours
21
+ and vectors. The following example sets the contour variable for the first
22
+ contour group to the first variable named 'S'::
23
+
24
+ >>> plot.contour(0).variable = dataset.variable('S')
25
+ """
26
+ def __init__(self, uid, dataset):
27
+ self.uid = uid
28
+ self.dataset = dataset
29
+
30
+ @property
31
+ def _cache(self):
32
+ if _tecutil_connector.suspended:
33
+ _tecutil_connector._delete_caches.append(self._delete_cache)
34
+ return True
35
+ else:
36
+ return False
37
+
38
+ def _delete_cache(self):
39
+ attrs = ['_index']
40
+ for attr in attrs:
41
+ try:
42
+ delattr(self, attr)
43
+ except AttributeError:
44
+ pass
45
+
46
+ def __str__(self):
47
+ """Brief string representation.
48
+
49
+ Returns:
50
+ `str`: Brief representation of this `Variable`, showing
51
+ `Zones <data_access>`.
52
+
53
+ Example::
54
+
55
+ >>> p = dataset.variable('Pressure')
56
+ >>> print(p)
57
+ Pressure
58
+ """
59
+ return self.name
60
+
61
+ def __repr__(self):
62
+ """Executable string representation.
63
+
64
+ Returns:
65
+ `str`: Internal representation of this `Variable`.
66
+
67
+ The string returned can be executed to generate a
68
+ clone of this `Variable` object::
69
+
70
+ >>> x = dataset.variable('x')
71
+ >>> print(repr(x))
72
+ Variable(uid=41, Dataset(uid=21, frame=Frame(uid=11,
73
+ page=Page(uid=1)))
74
+ >>> exec('x_clone = '+repr(x))
75
+ >>> x_clone
76
+ Variable(uid=41, Dataset(uid=21, frame=Frame(uid=11,
77
+ page=Page(uid=1)))
78
+ >>> x == x_clone
79
+ True
80
+ """
81
+ return 'Variable(uid={uid}, dataset={dataset})'.format(
82
+ uid=self.uid, dataset=repr(self.dataset))
83
+
84
+ def __eq__(self, other):
85
+ """Checks for equality in the |Tecplot Engine|.
86
+
87
+ Returns:
88
+ `bool`: `True` if the unique ID numbers are the same for both
89
+ `Variables <Variable>`.
90
+ """
91
+ return self.uid == other.uid
92
+
93
+ def __ne__(self, other):
94
+ return not (self == other)
95
+
96
+ @property
97
+ def aux_data(self):
98
+ """Auxiliary data for this variable.
99
+
100
+ Returns:
101
+ `AuxData`
102
+
103
+ This is the auxiliary data attached to the variable. Such data is
104
+ written to the layout file by default and can be retrieved later.
105
+ Example usage::
106
+
107
+ >>> frame = tp.active_frame()
108
+ >>> aux = frame.dataset.variable('X').aux_data
109
+ >>> aux['X_weighted_avg'] = '3.14159'
110
+ >>> print(aux['X_weighted_avg'])
111
+ 3.14159
112
+ """
113
+ return session.AuxData(self.dataset.frame, AuxDataObjectType.Variable,
114
+ self.index)
115
+
116
+ @property
117
+ def index(self):
118
+ """`Index`: Zero-based position within the parent `Dataset <tecplot.data.Dataset>`.
119
+
120
+ Example usage::
121
+
122
+ >>> plot.contour(0).variable_index = dataset.variable('S').index
123
+ """
124
+ if self._cache:
125
+ if not hasattr(self, '_index'):
126
+ num = _tecutil.VarGetNumByUniqueID(self.uid)
127
+ self._index = tecutil.Index(num - 1)
128
+ return self._index
129
+ else:
130
+ return tecutil.Index(_tecutil.VarGetNumByUniqueID(self.uid) - 1)
131
+
132
+ @property
133
+ def lock_mode(self):
134
+ """`VarLockMode`: Type of lock or `None` (read-only).
135
+
136
+ Variables may be locked as a result of other operations, typically
137
+ through the use of the CFD Analyzer. This read-only property returns
138
+ `None` if the variable is not locked, `VarLockMode.ValueChange` if the
139
+ variable may not be modified or `VarLockMode.Delete` if the variable
140
+ may not be deleted.
141
+
142
+ This example modifies variable ``s`` only if it is not locked::
143
+
144
+ >>> variable_s = dataset.variable('s')
145
+ >>> if variable_s.lock_mode is None:
146
+ ... tp.data.operate.execute_equation('{s} = {p}**2')
147
+
148
+ .. versionadded:: 2019.1
149
+ Variable lock mode property requires Tecplot 360 2019 R1 or later.
150
+ """
151
+ with self.dataset.frame.activated():
152
+ _, mode, _ = _tecutil.VariableIsLocked(self.index + 1)
153
+ return mode
154
+
155
+ def minmax(self):
156
+ """Limits of the values stored in this variable across all zones.
157
+
158
+ :rtype: 2-tuple of `floats <float>`
159
+
160
+ This always returns `floats <float>` regardless of the underlying data
161
+ type::
162
+
163
+ >>> print(dataset.variable('x').minmax())
164
+ (0, 10)
165
+ """
166
+ with self.dataset.frame.activated():
167
+ success, vmin, vmax = _tecutil.VarGetMinMax(self.index + 1)
168
+ if not success:
169
+ raise TecplotSystemError()
170
+ return vmin, vmax
171
+
172
+ def min(self):
173
+ """Lower bound of the values stored in this variable across all zones.
174
+
175
+ :rtype: `float`
176
+
177
+ This always returns a `float` regardless of the underlying data type::
178
+
179
+ >>> print(dataset.variable('x').min())
180
+ 0
181
+ """
182
+ return self.minmax()[0]
183
+
184
+ def max(self):
185
+ """Upper bound of the values stored in this variable across all zones.
186
+
187
+ :rtype: `float`
188
+
189
+ This always returns a `float` regardless of the underlying data type::
190
+
191
+ >>> print(dataset.variable('x').max())
192
+ 10
193
+ """
194
+ return self.minmax()[1]
195
+
196
+ @property
197
+ def name(self):
198
+ """Returns or sets the name.
199
+
200
+ :rtype: `string <str>`
201
+
202
+ .. warning:: **Newlines in string identifiers may affect performance.**
203
+
204
+ When iterating over many items by name, such as must be done when
205
+ fetching an item via pattern matching, PyTecplot will optimize the
206
+ search only if there are no newline characters in the searched
207
+ items. Iterating over strings that contain newlines will be slower
208
+ and therefore, it is best to avoid using newlines in string
209
+ identifiers or names of objects such as `Zones <data_access>` or
210
+ `Variables <Variable>`.
211
+
212
+ Example usage::
213
+
214
+ >>> print(dataset.variable(0).name)
215
+ X
216
+ """
217
+ res, var_name = _tecutil.VarGetNameByDataSetID(self.dataset.uid,
218
+ self.index + 1)
219
+ if not res:
220
+ raise TecplotSystemError()
221
+ return var_name
222
+
223
+ @name.setter
224
+ @tecutil.lock()
225
+ def name(self, name):
226
+ _tecutil.VarRenameByDataSetID(self.dataset.uid, self.index + 1, name)
227
+
228
+ @property
229
+ def num_zones(self):
230
+ """`int`: Number of `Zones <data_access>` in the parent `Dataset <tecplot.data.Dataset>`.
231
+
232
+ Example usage, looping over all zones by index::
233
+
234
+ >>> for zindex in range(dataset.num_zones):
235
+ ... zone = dataset.zone(zindex)
236
+ """
237
+ return self.dataset.num_zones
238
+
239
+ def values(self, pattern):
240
+ """Returns `Array` by index or string pattern.
241
+
242
+ Parameters:
243
+ pattern (`int`, `str` or `Zone <data_access>`): Zero-based index
244
+ or `glob-style pattern <fnmatch.fnmatch>` in which case, the
245
+ first match is returned, or a `Zone <data_access>` object.
246
+
247
+ .. note:: **Data operations can make use of Numpy when installed.**
248
+
249
+ When doing large data transfers into and out of Tecplot using
250
+ PyTecplot, it is recommended to install the Python array-processing
251
+ module `Numpy <https://scipy.org>`_. PyTecplot will automatically
252
+ use this to optimize data transfers which may result in significant
253
+ performance gains.
254
+
255
+ The `Zone.name <OrderedZone.name>` attribute is used to match the
256
+ *pattern* to the desired `Array` though this is not necessarily
257
+ unique::
258
+
259
+ >>> ds = frame.dataset
260
+ >>> print(ds)
261
+ Dataset:
262
+ Zones: 'Rectangular zone'
263
+ Variables: 'x', 'y', 'z'
264
+ >>> x = ds.variable('x')
265
+ >>> rectzone = x.values('Rectangular zone')
266
+ >>> rectzone == x.values(0)
267
+ True
268
+
269
+ .. warning:: **Zone and variable ordering may change between releases**
270
+
271
+ Due to possible changes in data loaders or data formats over time,
272
+ the ordering of zones and variables may be different between
273
+ versions of Tecplot 360. Therefore it is recommended to always
274
+ reference zones and variables **by name** instead of by index.
275
+ """
276
+ if isinstance(pattern, (str, int)):
277
+ zone = self.dataset.zone(pattern)
278
+ else:
279
+ zone = pattern
280
+ return array.Array(zone, self)