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/session/style.py
ADDED
|
@@ -0,0 +1,504 @@
|
|
|
1
|
+
import ctypes
|
|
2
|
+
import copy
|
|
3
|
+
import enum
|
|
4
|
+
import logging
|
|
5
|
+
|
|
6
|
+
from collections.abc import Iterable
|
|
7
|
+
from ctypes import (c_char, c_char_p, c_double, c_size_t, c_int64, pointer,
|
|
8
|
+
POINTER)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
from ..tecutil import _tecutil, _tecutil_connector
|
|
12
|
+
from ..constant import *
|
|
13
|
+
from ..exception import *
|
|
14
|
+
from .. import tecutil, version
|
|
15
|
+
from ..tecutil import sv
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
log = logging.getLogger(__name__)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@tecutil.lock(with_recording=False)
|
|
22
|
+
def set_style(value, *args, **kwargs):
|
|
23
|
+
if __debug__:
|
|
24
|
+
assert len(args) < 7, ', '.join(args)
|
|
25
|
+
if isinstance(value, int):
|
|
26
|
+
if value < tecutil.minint64 or tecutil.maxuint64 < value:
|
|
27
|
+
raise TecplotOverflowError('Integer outside of valid range.')
|
|
28
|
+
|
|
29
|
+
if log.getEffectiveLevel() < logging.INFO:
|
|
30
|
+
msg = 'SetStyle\n'
|
|
31
|
+
msg += ' value: {}\n'.format(value)
|
|
32
|
+
for a in args:
|
|
33
|
+
msg += ' {} {}\n'.format(type(a), a)
|
|
34
|
+
for k, v in kwargs.items():
|
|
35
|
+
msg += ' {} : {} {}\n'.format(k, type(v), v)
|
|
36
|
+
log.debug(msg[:-1])
|
|
37
|
+
|
|
38
|
+
_tecutil_connector._style_call_count['SET'][' '.join(args)] += 1
|
|
39
|
+
|
|
40
|
+
with tecutil.ArgList() as arglist:
|
|
41
|
+
|
|
42
|
+
allocd = []
|
|
43
|
+
try:
|
|
44
|
+
for i, p in enumerate(args):
|
|
45
|
+
arglist[getattr(sv, 'P' + str(i + 1))] = p
|
|
46
|
+
|
|
47
|
+
if isinstance(value, enum.Enum):
|
|
48
|
+
arglist[sv.IVALUE] = c_size_t(value.value)
|
|
49
|
+
elif isinstance(value, tecutil.Index):
|
|
50
|
+
arglist[sv.IVALUE] = c_size_t(value + 1)
|
|
51
|
+
elif isinstance(value, (int, bool)):
|
|
52
|
+
arglist[sv.IVALUE] = c_size_t(value)
|
|
53
|
+
elif isinstance(value, float):
|
|
54
|
+
arglist[sv.DVALUE] = value
|
|
55
|
+
elif isinstance(value, str):
|
|
56
|
+
arglist[sv.STRVALUE] = value
|
|
57
|
+
elif hasattr(value, '__iter__'):
|
|
58
|
+
value_list = list(value)
|
|
59
|
+
if not len(value_list) or isinstance(value_list[0], int):
|
|
60
|
+
value_obj = tecutil.IndexSet(*value_list)
|
|
61
|
+
allocd.append(value_obj)
|
|
62
|
+
arglist[sv.IVALUE] = c_size_t(value_obj.value)
|
|
63
|
+
else:
|
|
64
|
+
value_obj = tecutil.StringList(*value_list)
|
|
65
|
+
allocd.append(value_obj)
|
|
66
|
+
arglist[sv.IVALUE] = c_size_t(ctypes.addressof(
|
|
67
|
+
ctypes.cast(value_obj, POINTER(c_size_t)).contents))
|
|
68
|
+
elif value is None:
|
|
69
|
+
arglist[sv.IVALUE] = c_size_t(0)
|
|
70
|
+
else:
|
|
71
|
+
raise TecplotTypeError
|
|
72
|
+
|
|
73
|
+
for k, v in kwargs.items():
|
|
74
|
+
k = k.upper()
|
|
75
|
+
if k == sv.UNIQUEID:
|
|
76
|
+
v = c_size_t(v)
|
|
77
|
+
elif k in [sv.OBJECTSET]:
|
|
78
|
+
v = tecutil.IndexSet(*v)
|
|
79
|
+
allocd.append(v)
|
|
80
|
+
elif k in [sv.OFFSET1, sv.OFFSET2]:
|
|
81
|
+
v = v + 1
|
|
82
|
+
arglist[k] = v
|
|
83
|
+
|
|
84
|
+
if __debug__:
|
|
85
|
+
if log.getEffectiveLevel() < logging.INFO:
|
|
86
|
+
msg = 'SetStyle\n'
|
|
87
|
+
for k, v in arglist.items():
|
|
88
|
+
msg += ' {}: {}\n'.format(k, v)
|
|
89
|
+
log.debug(msg[:-1])
|
|
90
|
+
|
|
91
|
+
try:
|
|
92
|
+
res = _tecutil.StyleSetLowLevelX(arglist)
|
|
93
|
+
if res not in [SetValueReturnCode.Ok,
|
|
94
|
+
SetValueReturnCode.DuplicateValue]:
|
|
95
|
+
if __debug__:
|
|
96
|
+
msg = 'SetStyle\n'
|
|
97
|
+
for k, v in arglist.items():
|
|
98
|
+
msg += ' {}: {}\n'.format(k, v)
|
|
99
|
+
raise TecplotSystemError(str(res) + '\n' + msg)
|
|
100
|
+
raise TecplotSystemError(res)
|
|
101
|
+
except TecplotLogicError as e:
|
|
102
|
+
if __debug__:
|
|
103
|
+
msg = 'SetStyle\n'
|
|
104
|
+
for k, v in arglist.items():
|
|
105
|
+
msg += ' {}: {}\n'.format(k, v)
|
|
106
|
+
raise TecplotLogicError(str(e) + '\n' + msg)
|
|
107
|
+
else:
|
|
108
|
+
raise
|
|
109
|
+
|
|
110
|
+
finally:
|
|
111
|
+
for a in allocd:
|
|
112
|
+
a.dealloc()
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def get_style(return_type, *args, **kwargs):
|
|
116
|
+
if __debug__:
|
|
117
|
+
assert len(args) < 7
|
|
118
|
+
|
|
119
|
+
if log.getEffectiveLevel() < logging.INFO:
|
|
120
|
+
msg = 'GetStyle\n'
|
|
121
|
+
for a in args:
|
|
122
|
+
msg += ' {} {}\n'.format(type(a), a)
|
|
123
|
+
for k, v in kwargs.items():
|
|
124
|
+
msg += ' {} : {} {}\n'.format(k, type(v), v)
|
|
125
|
+
log.debug(msg[:-1])
|
|
126
|
+
|
|
127
|
+
_tecutil_connector._style_call_count['GET'][' '.join(args)] += 1
|
|
128
|
+
|
|
129
|
+
with tecutil.ArgList() as arglist:
|
|
130
|
+
|
|
131
|
+
allocd = []
|
|
132
|
+
try:
|
|
133
|
+
|
|
134
|
+
for i, p in enumerate(args):
|
|
135
|
+
arglist[getattr(sv, 'P' + str(i + 1))] = p
|
|
136
|
+
|
|
137
|
+
for k, v in kwargs.items():
|
|
138
|
+
k = k.upper()
|
|
139
|
+
if k == sv.UNIQUEID:
|
|
140
|
+
v = c_size_t(v)
|
|
141
|
+
elif k in [sv.OBJECTSET]:
|
|
142
|
+
v = tecutil.IndexSet(*v)
|
|
143
|
+
allocd.append(v)
|
|
144
|
+
elif k in [sv.OFFSET1, sv.OFFSET2]:
|
|
145
|
+
v = v + 1
|
|
146
|
+
arglist[k] = v
|
|
147
|
+
|
|
148
|
+
if (return_type in [int, bool, tecutil.Index, list, set] or
|
|
149
|
+
issubclass(return_type, enum.Enum)):
|
|
150
|
+
arglist[sv.IVALUE] = pointer(c_size_t())
|
|
151
|
+
elif return_type in [str]:
|
|
152
|
+
arglist[sv.IVALUE] = pointer(pointer(c_char()))
|
|
153
|
+
elif return_type in [float]:
|
|
154
|
+
arglist[sv.DVALUE] = pointer(c_double())
|
|
155
|
+
else:
|
|
156
|
+
raise TecplotTypeError('unknown return_type: {}'.format(return_type))
|
|
157
|
+
|
|
158
|
+
if __debug__:
|
|
159
|
+
if log.getEffectiveLevel() < logging.INFO:
|
|
160
|
+
msg = 'GetStyle\n'
|
|
161
|
+
for k, v in arglist.items():
|
|
162
|
+
msg += ' {}: {}\n'.format(k, v)
|
|
163
|
+
log.debug(msg[:-1])
|
|
164
|
+
|
|
165
|
+
try:
|
|
166
|
+
res = _tecutil.StyleGetLowLevelX(arglist)
|
|
167
|
+
if res is not GetValueReturnCode.Ok:
|
|
168
|
+
raise TecplotSystemError(res)
|
|
169
|
+
except TecplotLogicError as e:
|
|
170
|
+
if __debug__:
|
|
171
|
+
msg = 'GetStyle\n'
|
|
172
|
+
for k, v in arglist.items():
|
|
173
|
+
msg += ' {}: {}\n'.format(k, v)
|
|
174
|
+
raise TecplotLogicError(str(e) + '\n' + msg)
|
|
175
|
+
else:
|
|
176
|
+
raise
|
|
177
|
+
|
|
178
|
+
if return_type in [str]:
|
|
179
|
+
ivalue = ctypes.cast(arglist[sv.IVALUE], POINTER(c_char_p))
|
|
180
|
+
result = ivalue.contents.value
|
|
181
|
+
if result not in [None, '']:
|
|
182
|
+
result = result.decode('utf-8')
|
|
183
|
+
elif issubclass(return_type, enum.Enum):
|
|
184
|
+
ival = arglist[sv.IVALUE]
|
|
185
|
+
val = ctypes.cast(ival, POINTER(c_int64)).contents.value
|
|
186
|
+
result = return_type(int(val))
|
|
187
|
+
elif return_type in [tecutil.Index]:
|
|
188
|
+
ival = arglist[sv.IVALUE]
|
|
189
|
+
val = ctypes.cast(ival, POINTER(c_int64)).contents.value
|
|
190
|
+
result = return_type(int(val) - 1)
|
|
191
|
+
elif return_type in [list, set]:
|
|
192
|
+
ptr = ctypes.cast(arglist[sv.IVALUE], POINTER(tecutil.IndexSet))
|
|
193
|
+
iset = ptr.contents
|
|
194
|
+
result = return_type(iset)
|
|
195
|
+
iset.dealloc()
|
|
196
|
+
elif return_type in [int, bool]:
|
|
197
|
+
result = return_type(arglist[sv.IVALUE].contents.value)
|
|
198
|
+
else: # if return_type in [float]:
|
|
199
|
+
result = return_type(arglist[sv.DVALUE].contents.value)
|
|
200
|
+
|
|
201
|
+
if __debug__:
|
|
202
|
+
if log.getEffectiveLevel() < logging.INFO:
|
|
203
|
+
log.debug('GetStyle result: {}'.format(result))
|
|
204
|
+
|
|
205
|
+
return result
|
|
206
|
+
|
|
207
|
+
finally:
|
|
208
|
+
for a in allocd:
|
|
209
|
+
a.dealloc()
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
@tecutil.lock_attributes
|
|
213
|
+
class Style(object):
|
|
214
|
+
def __init__(self, *svargs, **kwargs):
|
|
215
|
+
self._sv = list(tecutil.flatten_args(*svargs))
|
|
216
|
+
uniqueid = kwargs.pop('uniqueid', None)
|
|
217
|
+
offset1 = kwargs.pop('offset1', None)
|
|
218
|
+
offset2 = kwargs.pop('offset2', None)
|
|
219
|
+
objectset = kwargs.pop('objectset', None)
|
|
220
|
+
|
|
221
|
+
assert not (offset1 and objectset), \
|
|
222
|
+
'offset1 and objectset are mutually exclusive'
|
|
223
|
+
assert not (offset2 and not (offset1 or objectset)), \
|
|
224
|
+
'offset2 requires offset1 or objectset to also be specified'
|
|
225
|
+
|
|
226
|
+
self._style_attrs = {}
|
|
227
|
+
if uniqueid is not None:
|
|
228
|
+
self._style_attrs[sv.UNIQUEID] = int(uniqueid)
|
|
229
|
+
if offset1 is not None:
|
|
230
|
+
self._style_attrs[sv.OFFSET1] = tecutil.Index(offset1)
|
|
231
|
+
if offset2 is not None:
|
|
232
|
+
self._style_attrs[sv.OFFSET2] = tecutil.Index(offset2)
|
|
233
|
+
if objectset is not None:
|
|
234
|
+
self._style_attrs[sv.OBJECTSET] = set(objectset)
|
|
235
|
+
|
|
236
|
+
@property
|
|
237
|
+
def _kw(self):
|
|
238
|
+
return {k.lower(): v for k, v in self._style_attrs.items()}
|
|
239
|
+
|
|
240
|
+
def _get_style(self, rettype, *svargs, **kwargs):
|
|
241
|
+
svargs = self._sv + list(svargs)
|
|
242
|
+
kw = self._style_attrs.copy()
|
|
243
|
+
kw.update(**kwargs)
|
|
244
|
+
if sv.OBJECTSET in kw:
|
|
245
|
+
objectset = kw.pop(sv.OBJECTSET)
|
|
246
|
+
result = []
|
|
247
|
+
for offset1 in sorted(objectset):
|
|
248
|
+
kw[sv.OFFSET1] = tecutil.Index(offset1)
|
|
249
|
+
result.append(get_style(rettype, *svargs, **kw))
|
|
250
|
+
return tuple(result)
|
|
251
|
+
else:
|
|
252
|
+
return get_style(rettype, *svargs, **kw)
|
|
253
|
+
|
|
254
|
+
def _set_style(self, value, *svargs, **kwargs):
|
|
255
|
+
svargs = self._sv + list(svargs)
|
|
256
|
+
kw = self._style_attrs.copy()
|
|
257
|
+
kw.update(**kwargs)
|
|
258
|
+
set_style(value, *svargs, **kw)
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
@tecutil.lock_attributes
|
|
262
|
+
class SubStyle(object):
|
|
263
|
+
def __init__(self, parent, *svargs):
|
|
264
|
+
self.parent = parent
|
|
265
|
+
self._svargs = list(tecutil.flatten_args(*svargs))
|
|
266
|
+
|
|
267
|
+
def __eq__(self, that):
|
|
268
|
+
return (isinstance(that, type(self))
|
|
269
|
+
and self.parent == that.parent
|
|
270
|
+
and self._svargs == that._svargs)
|
|
271
|
+
|
|
272
|
+
def __ne__(self, that):
|
|
273
|
+
return not (self == that)
|
|
274
|
+
|
|
275
|
+
def _get_style(self, rettype, *svargs, **kwargs):
|
|
276
|
+
svargs = self._svargs + list(tecutil.flatten_args(*svargs))
|
|
277
|
+
return self.parent._get_style(rettype, *svargs, **kwargs)
|
|
278
|
+
|
|
279
|
+
def _set_style(self, value, *svargs, **kwargs):
|
|
280
|
+
svargs = self._svargs + list(tecutil.flatten_args(*svargs))
|
|
281
|
+
self.parent._set_style(value, *svargs, **kwargs)
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
class StyleConfig(Style):
|
|
285
|
+
"""Runtime Configuration Control Base Class."""
|
|
286
|
+
def __init__(self, name=None, *svargs):
|
|
287
|
+
if svargs:
|
|
288
|
+
Style.__init__(self, *svargs)
|
|
289
|
+
self._ns = name.split('.') if name else []
|
|
290
|
+
|
|
291
|
+
def __setattr__(self, name, value):
|
|
292
|
+
if not name.startswith('_'):
|
|
293
|
+
if not hasattr(self, '_keys'):
|
|
294
|
+
self._keys = list(filter(lambda x: not x.startswith('_'), dir(self)))
|
|
295
|
+
if name not in self._keys:
|
|
296
|
+
msg = 'No configuration found: '
|
|
297
|
+
raise TecplotAttributeError(msg + '.'.join(self._ns + [name]))
|
|
298
|
+
super().__setattr__(name, value)
|
|
299
|
+
|
|
300
|
+
@property
|
|
301
|
+
def _opts(self):
|
|
302
|
+
if not hasattr(self, '_attrs'):
|
|
303
|
+
configs, props = [], []
|
|
304
|
+
for key in filter(lambda x: not x.startswith('_'), dir(self)):
|
|
305
|
+
value = getattr(self, key)
|
|
306
|
+
if isinstance(value, StyleConfig):
|
|
307
|
+
configs.append((key, value))
|
|
308
|
+
else:
|
|
309
|
+
props.append(key)
|
|
310
|
+
self._attrs = (sorted(configs), sorted(props))
|
|
311
|
+
return self._attrs
|
|
312
|
+
|
|
313
|
+
def __str__(self):
|
|
314
|
+
configs, props = self._opts
|
|
315
|
+
lines = []
|
|
316
|
+
for keyname in props:
|
|
317
|
+
key = '.'.join(self._ns + [keyname])
|
|
318
|
+
lines.append('{} = {}'.format(key, getattr(self, keyname)))
|
|
319
|
+
for _, value in configs:
|
|
320
|
+
lines.append(str(value))
|
|
321
|
+
return '\n'.join(lines)
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
def style_property(value_type, svarg, value_cast=None):
|
|
325
|
+
def getter(self):
|
|
326
|
+
return self._get_style(value_type, svarg)
|
|
327
|
+
|
|
328
|
+
if value_cast:
|
|
329
|
+
def setter(self, val):
|
|
330
|
+
val = value_cast(val)
|
|
331
|
+
if val is not None:
|
|
332
|
+
self._set_style(val, svarg)
|
|
333
|
+
else:
|
|
334
|
+
def setter(self, val):
|
|
335
|
+
if val is not None:
|
|
336
|
+
self._set_style(value_type(val), svarg)
|
|
337
|
+
|
|
338
|
+
return property(getter, setter)
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
class NamedTupleStyle(SubStyle, Iterable):
|
|
342
|
+
def __len__(self):
|
|
343
|
+
return len(self._keys)
|
|
344
|
+
|
|
345
|
+
def __getitem__(self, index):
|
|
346
|
+
if isinstance(index, slice):
|
|
347
|
+
rng = range(index.start or 0,
|
|
348
|
+
index.stop or len(self),
|
|
349
|
+
index.step or 1)
|
|
350
|
+
return tuple([self[x] for x in rng])
|
|
351
|
+
else:
|
|
352
|
+
return getattr(self, self._keys[index])
|
|
353
|
+
|
|
354
|
+
def __setitem__(self, index, value):
|
|
355
|
+
if isinstance(index, slice):
|
|
356
|
+
for i in range(index.start or 0,
|
|
357
|
+
index.stop or len(self),
|
|
358
|
+
index.step or 1):
|
|
359
|
+
self[i] = value[i] if i < len(value) else None
|
|
360
|
+
else:
|
|
361
|
+
setattr(self, self._keys[index], value)
|
|
362
|
+
|
|
363
|
+
def __iter__(self):
|
|
364
|
+
self._current_index = -1
|
|
365
|
+
return self
|
|
366
|
+
|
|
367
|
+
def __next__(self):
|
|
368
|
+
self._current_index += 1
|
|
369
|
+
if self._current_index < len(self):
|
|
370
|
+
return self.__getitem__(self._current_index)
|
|
371
|
+
else:
|
|
372
|
+
del self._current_index
|
|
373
|
+
raise StopIteration()
|
|
374
|
+
|
|
375
|
+
def __str__(self):
|
|
376
|
+
return '({})'.format(', '.join(str(x) for x in self))
|
|
377
|
+
|
|
378
|
+
def __eq__(self, other):
|
|
379
|
+
return (len(self) == len(other)
|
|
380
|
+
and all(a == b for a, b in zip(self, other)))
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
class NamedVectorStyle(NamedTupleStyle):
|
|
384
|
+
def __neg__(self):
|
|
385
|
+
return tuple([-v for v in self])
|
|
386
|
+
|
|
387
|
+
def __add__(self, other):
|
|
388
|
+
return tuple([a - b for a, b in zip(self, other)])
|
|
389
|
+
|
|
390
|
+
def __sub__(self, other):
|
|
391
|
+
return tuple([a - b for a, b in zip(self, other)])
|
|
392
|
+
|
|
393
|
+
def __iadd__(self, other):
|
|
394
|
+
for k, v in zip(self._keys, other):
|
|
395
|
+
setattr(self, k, getattr(self, k) + v)
|
|
396
|
+
return self
|
|
397
|
+
|
|
398
|
+
def __isub__(self, other):
|
|
399
|
+
for k, v in zip(self._keys, other):
|
|
400
|
+
setattr(self, k, getattr(self, k) - v)
|
|
401
|
+
return self
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
class IndependentVariableLimits(NamedTupleStyle):
|
|
405
|
+
_keys = ('min', 'max')
|
|
406
|
+
min = style_property(float, sv.INDVARMIN)
|
|
407
|
+
max = style_property(float, sv.INDVARMAX)
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
class IJK(NamedVectorStyle):
|
|
411
|
+
_keys = ('i', 'j', 'k')
|
|
412
|
+
i = style_property(int, sv.I)
|
|
413
|
+
j = style_property(int, sv.J)
|
|
414
|
+
k = style_property(int, sv.K)
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
class IJKMaxFract(NamedTupleStyle):
|
|
418
|
+
_keys = ('i', 'j', 'k')
|
|
419
|
+
i = style_property(float, sv.IMAXFRACT)
|
|
420
|
+
j = style_property(float, sv.JMAXFRACT)
|
|
421
|
+
k = style_property(float, sv.KMAXFRACT)
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
class IJKMinFract(NamedTupleStyle):
|
|
425
|
+
_keys = ('i', 'j', 'k')
|
|
426
|
+
i = style_property(float, sv.IMINFRACT)
|
|
427
|
+
j = style_property(float, sv.JMINFRACT)
|
|
428
|
+
k = style_property(float, sv.KMINFRACT)
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
class Limits(NamedTupleStyle):
|
|
432
|
+
_keys = ('min', 'max')
|
|
433
|
+
min = style_property(float, sv.MIN)
|
|
434
|
+
max = style_property(float, sv.MAX)
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
class IndexIJK(NamedVectorStyle):
|
|
438
|
+
_keys = ('i', 'j', 'k')
|
|
439
|
+
i = style_property(tecutil.Index, sv.I)
|
|
440
|
+
j = style_property(tecutil.Index, sv.J)
|
|
441
|
+
k = style_property(tecutil.Index, sv.K)
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
class IndexRange(NamedTupleStyle):
|
|
445
|
+
"""Index range specification along some axis.
|
|
446
|
+
|
|
447
|
+
This is similar to Python's :class:`slice` object except that ``max`` is
|
|
448
|
+
included in the evaluated indexes. Here are some things to note:
|
|
449
|
+
|
|
450
|
+
* All indices start with 0 and go to some maximum index ``m``.
|
|
451
|
+
* Negative values represent the indexes starting with the maximum at -1
|
|
452
|
+
and continuing back to the beginning of the range.
|
|
453
|
+
* A step of `None`, 0 and 1 are all equivalent and mean that no elements
|
|
454
|
+
are skipped.
|
|
455
|
+
* A negative step indicates a skip less than the maximum.
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
.. versionchanged:: 1.1
|
|
459
|
+
**(Bug fix)** ``IndexRange`` max value of zero is now interpreted as
|
|
460
|
+
the first index in the range instead of the last index. Prior to
|
|
461
|
+
version 1.1, the ``max`` parameter interpreted zero to be the end of
|
|
462
|
+
the range instead of the first element. This meant that an
|
|
463
|
+
``IndexRange`` of ``(0, 0, 1)`` would represent the whole range instead
|
|
464
|
+
of just the first item. The standard way to represent the entire index
|
|
465
|
+
"""
|
|
466
|
+
_keys = ('min', 'max', 'step')
|
|
467
|
+
min = style_property(tecutil.Index, sv.MIN,
|
|
468
|
+
lambda x: tecutil.Index(x or 0))
|
|
469
|
+
max = style_property(tecutil.Index, sv.MAX,
|
|
470
|
+
lambda x: tecutil.Index(-1 if x is None else x))
|
|
471
|
+
step = style_property(int, sv.SKIP, lambda x: int(x or 1))
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
class RectPosition(NamedTupleStyle):
|
|
475
|
+
_keys = ('x1', 'y1', 'x2', 'y2')
|
|
476
|
+
x1 = style_property(float, sv.X1)
|
|
477
|
+
y1 = style_property(float, sv.Y1)
|
|
478
|
+
x2 = style_property(float, sv.X2)
|
|
479
|
+
y2 = style_property(float, sv.Y2)
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
class RectSize(NamedTupleStyle):
|
|
483
|
+
_keys = ('width', 'height')
|
|
484
|
+
width = style_property(float, sv.WIDTH)
|
|
485
|
+
height = style_property(float, sv.HEIGHT)
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+
class SplineDerivativeAtEnds(NamedTupleStyle):
|
|
489
|
+
_keys = ('start', 'end')
|
|
490
|
+
start = style_property(float, sv.SPLINEDERIVATIVEATSTART)
|
|
491
|
+
end = style_property(float, sv.SPLINEDERIVATIVEATEND)
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
class XY(NamedVectorStyle):
|
|
495
|
+
_keys = ('x', 'y')
|
|
496
|
+
x = style_property(float, sv.X)
|
|
497
|
+
y = style_property(float, sv.Y)
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
class XYZ(NamedVectorStyle):
|
|
501
|
+
_keys = ('x', 'y', 'z')
|
|
502
|
+
x = style_property(float, sv.X)
|
|
503
|
+
y = style_property(float, sv.Y)
|
|
504
|
+
z = style_property(float, sv.Z)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from .tecutil_connector import _tecutil_connector, _tecutil
|
|
2
|
+
|
|
3
|
+
from . import constant, sv
|
|
4
|
+
from .arglist import LocalArgList, RemoteArgList
|
|
5
|
+
from .captured_output import captured_output
|
|
6
|
+
from .index_set import IndexSet
|
|
7
|
+
from .lock import force_recording, lock
|
|
8
|
+
from .stringlist import StringList
|
|
9
|
+
from .util import (maxint64, minint64, maxuint64, IndexRange, Index, XY, XYZ,
|
|
10
|
+
flatten_args, array_to_enums, inherited_property,
|
|
11
|
+
lock_attributes, check_arglist_argtypes, color_spec,
|
|
12
|
+
filled_slice, array_to_str, ListWrapper, optional,
|
|
13
|
+
split_macro, normalize_path, temporary_closed_file,
|
|
14
|
+
api_changed, api_moved)
|
|
15
|
+
|
|
16
|
+
ArgList = RemoteArgList
|