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,118 @@
1
+ import ctypes
2
+
3
+ from ctypes import c_size_t, c_void_p, POINTER, cast, pointer
4
+ from textwrap import dedent
5
+
6
+ from .tecutil_connector import _tecutil_connector, _tecutil
7
+ from .. import constant
8
+ from ..exception import TecplotTypeError
9
+ from .util import flatten_args, Index
10
+
11
+ class IndexSet(c_void_p):
12
+ def __init__(self, *numbers):
13
+ # numbers may be an iterable or a single value
14
+ super().__init__(_tecutil.SetAlloc(False))
15
+ self.__iadd__(flatten_args(*numbers))
16
+
17
+ @staticmethod
18
+ def _bind_tecutil():
19
+ try:
20
+ _tecutil.handle.tecUtilArgListGetSetByIndex.restype = IndexSet
21
+ except AttributeError:
22
+ pass
23
+ try:
24
+ _tecutil.handle.tecUtilDataValueGetShareZoneSet.restype = IndexSet
25
+ except AttributeError:
26
+ pass
27
+ try:
28
+ _tecutil.handle.tecUtilConnectGetShareZoneSet.restype = IndexSet
29
+ except AttributeError:
30
+ pass
31
+
32
+ if _tecutil_connector.client is not None:
33
+ _ArgListGetSetByIndex = _tecutil_connector.client.ArgListGetSetByIndex
34
+ _tecutil_connector.client.ArgListGetSetByIndex = lambda *a, **kw: cast(_ArgListGetSetByIndex(*a, **kw), IndexSet)
35
+
36
+ _DataValueGetShareZoneSet = _tecutil_connector.client.DataValueGetShareZoneSet
37
+ _tecutil_connector.client.DataValueGetShareZoneSet = lambda *a, **kw: cast(_DataValueGetShareZoneSet(*a, **kw), IndexSet)
38
+
39
+ _ConnectGetShareZoneSet = _tecutil_connector.client.ConnectGetShareZoneSet
40
+ _tecutil_connector.client.ConnectGetShareZoneSet = lambda *a, **kw: cast(_ConnectGetShareZoneSet(*a, **kw), IndexSet)
41
+
42
+ # tecutil function with output IndexSet pointer argument
43
+ if not hasattr(_tecutil, '_ZoneGetActiveForFrame'):
44
+ _tecutil._ZoneGetActiveForFrame = _tecutil.ZoneGetActiveForFrame
45
+ def ZoneGetActiveForFrame(*a, **kw):
46
+ success, ptr = _tecutil._ZoneGetActiveForFrame(*a, **kw)
47
+ if not success:
48
+ raise TecplotSystemError()
49
+ return cast(ptr, IndexSet)
50
+ _tecutil.ZoneGetActiveForFrame = ZoneGetActiveForFrame
51
+
52
+ def __eq__(self, other):
53
+ if len(self) != len(other):
54
+ return False
55
+ for i in self:
56
+ if i not in other:
57
+ return False
58
+ return True
59
+
60
+ # data access
61
+ def __getitem__(self,i):
62
+ return Index(_tecutil.SetGetMember(self, i + 1) - 1)
63
+
64
+ def __len__(self):
65
+ return _tecutil.SetGetMemberCount(self)
66
+
67
+ # string representations
68
+ def __repr__(self):
69
+ return 'IndexSet({args})'.format(args=', '.join([str(s) for s in self]))
70
+
71
+ def __str__(self):
72
+ return str(set(self))
73
+
74
+ # iterating
75
+ def __iter__(self):
76
+ self.current_index = -1
77
+ self.max_index = len(self)
78
+ return self
79
+
80
+ def __next__(self):
81
+ self.current_index += 1
82
+ if self.current_index < self.max_index:
83
+ return self.__getitem__(self.current_index)
84
+ else:
85
+ del self.current_index
86
+ del self.max_index
87
+ raise StopIteration()
88
+
89
+ # context management
90
+ def __enter__(self):
91
+ return self
92
+
93
+ def __exit__(self, *args):
94
+ self.dealloc()
95
+
96
+ # public methods
97
+ def __iadd__(self, numbers):
98
+ for i in numbers:
99
+ self.append(i)
100
+ return self
101
+
102
+ def append(self, i):
103
+ if isinstance(i, int):
104
+ _tecutil.SetAddMember(self, i+1, False)
105
+ elif hasattr(i, 'index') and isinstance(i.index, int):
106
+ _tecutil.SetAddMember(self, i.index+1, False)
107
+ else:
108
+ msg = dedent('''\
109
+ Set can only hold integers or objects
110
+ with an integer attribute named index.
111
+ failed on input: {} {}''')
112
+ raise TecplotTypeError(msg.format(type(i),i))
113
+
114
+ def clear(self):
115
+ _tecutil.SetClear(self)
116
+
117
+ def dealloc(self):
118
+ _tecutil.SetDealloc(pointer(self))
@@ -0,0 +1,36 @@
1
+ import contextlib
2
+ import functools
3
+ import sys
4
+
5
+ from .tecutil_connector import _tecutil_connector, _tecutil
6
+
7
+
8
+ @contextlib.contextmanager
9
+ def lock(with_recording=True):
10
+ """
11
+ ParentLockStart takes a boolean: ShutdownImplicitRecording
12
+ ShutdownImplicitRecording = True -> No recording
13
+ ShutdownImplicitRecording = False -> With Recording
14
+ """
15
+ lock.FORCE_RECORDING = getattr(lock, 'FORCE_RECORDING', False)
16
+ if _tecutil_connector.connected:
17
+ yield
18
+ else:
19
+ _tecutil.ParentLockStart(not (with_recording or lock.FORCE_RECORDING))
20
+ try:
21
+ yield
22
+ finally:
23
+ _tecutil.handle.tecUtilParentLockFinish()
24
+
25
+
26
+ @contextlib.contextmanager
27
+ def force_recording():
28
+ """Do not disable implicit recording when locking the engine."""
29
+ if lock.FORCE_RECORDING:
30
+ yield
31
+ else:
32
+ try:
33
+ lock.FORCE_RECORDING = True
34
+ yield
35
+ finally:
36
+ lock.FORCE_RECORDING = False
@@ -0,0 +1,39 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: message.proto
4
+ """Generated protocol buffer code."""
5
+ from google.protobuf.internal import builder as _builder
6
+ from google.protobuf import descriptor as _descriptor
7
+ from google.protobuf import descriptor_pool as _descriptor_pool
8
+ from google.protobuf import symbol_database as _symbol_database
9
+ # @@protoc_insertion_point(imports)
10
+
11
+ _sym_db = _symbol_database.Default()
12
+
13
+
14
+
15
+
16
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\rmessage.proto\x12\x06tecrpc\"\xac\x04\n\x08\x41rgument\x12+\n\x04type\x18\x01 \x01(\x0e\x32\x1d.tecrpc.Argument.ArgumentType\x12\x11\n\x07\x62oolean\x18\x02 \x01(\x08H\x00\x12\x0f\n\x05int32\x18\x03 \x01(\x11H\x00\x12\x10\n\x06uint32\x18\x04 \x01(\rH\x00\x12\x0f\n\x05int64\x18\x05 \x01(\x12H\x00\x12\x10\n\x06uint64\x18\x06 \x01(\x04H\x00\x12\x11\n\x07\x66loat32\x18\x07 \x01(\x02H\x00\x12\x11\n\x07\x66loat64\x18\x08 \x01(\x01H\x00\x12\x0e\n\x04text\x18\t \x01(\tH\x00\x12\x10\n\x06\x62uffer\x18\n \x01(\x0cH\x00\x12\'\n\x07\x61rglist\x18\x0b \x01(\x0b\x32\x14.tecrpc.ArgListItemsH\x00\"\x9f\x02\n\x0c\x41rgumentType\x12\x0f\n\x0bUnspecified\x10\x00\x12\x08\n\x04Null\x10\x01\x12\x0b\n\x07\x41\x64\x64ress\x10\x02\x12\t\n\x05\x41rray\x10\x04\x12\x08\n\x04\x42ool\x10\x08\x12\x08\n\x04Text\x10\x10\x12\x08\n\x04Int8\x10 \x12\t\n\x05UInt8\x10@\x12\n\n\x05Int16\x10\x80\x01\x12\x0b\n\x06UInt16\x10\x80\x02\x12\n\n\x05Int32\x10\x80\x04\x12\x0b\n\x06UInt32\x10\x80\x08\x12\n\n\x05Int64\x10\x80\x10\x12\x0b\n\x06UInt64\x10\x80 \x12\x0c\n\x07\x46loat32\x10\x80@\x12\r\n\x07\x46loat64\x10\x80\x80\x01\x12\n\n\x04\x45num\x10\x80\x80\x02\x12\x10\n\nStringList\x10\x80\x80\x04\x12\x0e\n\x08IndexSet\x10\x80\x80\x08\x12\x0e\n\x08\x41rbParam\x10\x80\x80\x10\x12\r\n\x07\x41rgList\x10\x80\x80 B\x07\n\x05value\"2\n\x0c\x41rgListItems\x12\"\n\x05items\x18\x01 \x03(\x0b\x32\x13.tecrpc.ArgListItem\";\n\x0b\x41rgListItem\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x1f\n\x05value\x18\x02 \x01(\x0b\x32\x10.tecrpc.Argument\"\xd9\x01\n\x07Request\x12\x0f\n\x07version\x18\x02 \x01(\r\x12+\n\x04type\x18\x03 \x01(\x0e\x32\x1d.tecrpc.Request.OperationType\x12\x11\n\toperation\x18\x04 \x01(\t\x12\x1e\n\x04\x61rgs\x18\x05 \x03(\x0b\x32\x10.tecrpc.Argument\"W\n\rOperationType\x12\x0b\n\x07TecUtil\x10\x00\x12\r\n\tImmediate\x10\x01\x12\x10\n\x0cLockRequired\x10\x02\x12\n\n\x06Server\x10\x04\x12\x0c\n\x08TecUtilX\x10\x08J\x04\x08\x01\x10\x02\"\xa8\x01\n\x05Reply\x12\x0f\n\x07version\x18\x02 \x01(\r\x12$\n\x06status\x18\x03 \x01(\x0e\x32\x14.tecrpc.Reply.Status\x12\x0b\n\x03log\x18\x04 \x01(\t\x12\x11\n\tlog_level\x18\x05 \x01(\r\x12\x1e\n\x04\x61rgs\x18\x06 \x03(\x0b\x32\x10.tecrpc.Argument\"\"\n\x06Status\x12\x0b\n\x07Success\x10\x00\x12\x0b\n\x07\x46\x61ilure\x10\x01J\x04\x08\x01\x10\x02\x62\x06proto3')
17
+
18
+ _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
19
+ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'message_pb2', globals())
20
+ if _descriptor._USE_C_DESCRIPTORS == False:
21
+
22
+ DESCRIPTOR._options = None
23
+ _ARGUMENT._serialized_start=26
24
+ _ARGUMENT._serialized_end=582
25
+ _ARGUMENT_ARGUMENTTYPE._serialized_start=286
26
+ _ARGUMENT_ARGUMENTTYPE._serialized_end=573
27
+ _ARGLISTITEMS._serialized_start=584
28
+ _ARGLISTITEMS._serialized_end=634
29
+ _ARGLISTITEM._serialized_start=636
30
+ _ARGLISTITEM._serialized_end=695
31
+ _REQUEST._serialized_start=698
32
+ _REQUEST._serialized_end=915
33
+ _REQUEST_OPERATIONTYPE._serialized_start=822
34
+ _REQUEST_OPERATIONTYPE._serialized_end=909
35
+ _REPLY._serialized_start=918
36
+ _REPLY._serialized_end=1086
37
+ _REPLY_STATUS._serialized_start=1046
38
+ _REPLY_STATUS._serialized_end=1080
39
+ # @@protoc_insertion_point(module_scope)
@@ -0,0 +1,54 @@
1
+ import functools
2
+ import logging
3
+
4
+ from ..exception import *
5
+
6
+
7
+ def tecutil_preamble(fn):
8
+ """Wrapper for all calls into the TecUtil layer.
9
+
10
+ This wrapper shows up as a decorator for all TecUtil functions. It first
11
+ ensures a valid license is acquired and clears any previous error messages
12
+ cached by the `_TecUtilConnector` class. After calling the actual function,
13
+ the `_connector.last_message` object is updated and checked. Internal
14
+ assertions will have a level of `logging.CRITICAL` and will be raised as
15
+ `TecplotLogicError` exceptions. Other messages that normally go through
16
+ dialogs are also checked (when `__debug__` is `True`) and errors will
17
+ trigger an exception, but warnings and informational messages are merely
18
+ logged (with the appropriate level).
19
+ """
20
+ @functools.wraps(fn)
21
+ def _fn(self, *a, **kw):
22
+ if __debug__:
23
+ self.connector._tecutil_call_count[fn.__name__] += 1
24
+ if self.connector.connected:
25
+ client = self.connector.client
26
+ result = getattr(client, fn.__name__)(*a, **kw)
27
+ else:
28
+ try:
29
+ self.connector.clear_last_message()
30
+ self.connector.acquire_license()
31
+ result = fn(self, *a, **kw)
32
+ except TecplotInitializationError:
33
+ raise
34
+ except:
35
+ lastmsg = self.connector.update_last_message()
36
+ if lastmsg:
37
+ if lastmsg.level < logging.ERROR:
38
+ self.connector.log_last_message()
39
+ raise
40
+ else:
41
+ raise TecplotLogicError(lastmsg.message)
42
+ else:
43
+ raise
44
+ else:
45
+ lastmsg = self.connector.update_last_message()
46
+ if lastmsg:
47
+ if lastmsg.level < logging.ERROR:
48
+ if __debug__:
49
+ self.connector.log_last_message()
50
+ pass
51
+ else:
52
+ raise TecplotLogicError(lastmsg.message)
53
+ return result
54
+ return _fn
@@ -0,0 +1,114 @@
1
+ import copy
2
+ import logging
3
+
4
+ from ctypes import c_void_p, cast, pointer
5
+
6
+ from .tecutil_connector import _tecutil_connector, _tecutil
7
+ from .util import flatten_args
8
+ from .. import constant
9
+ from ..exception import TecplotTypeError
10
+
11
+
12
+ log = logging.getLogger(__name__)
13
+
14
+
15
+ class StringList(c_void_p):
16
+ def __init__(self, *strings):
17
+ super().__init__(_tecutil.StringListAlloc())
18
+ self += flatten_args(*filter(lambda x: x, strings))
19
+
20
+ @staticmethod
21
+ def _bind_tecutil():
22
+ try:
23
+ _tecutil.handle.tecUtilArgListGetStringListByIndex.restype = StringList
24
+ except AttributeError:
25
+ pass
26
+
27
+ if _tecutil_connector.client is not None:
28
+ _ArgListGetStringListByIndex = _tecutil_connector.client.ArgListGetStringListByIndex
29
+ def ArgListGetStringListByIndex(*a, **kw):
30
+ return cast(_ArgListGetStringListByIndex(*a, **kw), StringList)
31
+ _tecutil_connector.client.ArgListGetStringListByIndex = ArgListGetStringListByIndex
32
+
33
+ if not hasattr(_tecutil, '_CustomLabelsGet'):
34
+ _tecutil._CustomLabelsGet = _tecutil.CustomLabelsGet
35
+ def CustomLabelsGet(*a, **kw):
36
+ success, ptr = _tecutil._CustomLabelsGet(*a, **kw)
37
+ if not success:
38
+ raise TecplotSystemError()
39
+ return cast(ptr, StringList)
40
+ _tecutil.CustomLabelsGet = CustomLabelsGet
41
+
42
+ # data access
43
+ def __getitem__(self,i):
44
+ return _tecutil.StringListGetRawStringPtr(self, i+1)
45
+
46
+ def __len__(self):
47
+ return _tecutil.StringListGetCount(self)
48
+
49
+ def __eq__(self, other):
50
+ if len(self) != len(other):
51
+ return False
52
+ for i in self:
53
+ if i not in other:
54
+ return False
55
+ return True
56
+
57
+ # string representations
58
+ def __repr__(self):
59
+ return 'StringList({args})'.format(args=', '.join("'{arg}'".format(arg=s) for s in self))
60
+
61
+ def __str__(self):
62
+ return str(list(self))
63
+
64
+ # iterating
65
+ def __iter__(self):
66
+ obj = copy.copy(self) if hasattr(self, 'current_index') else self
67
+ obj.current_index = -1
68
+ obj.max_index = len(self)
69
+ obj.iter_items = _tecutil.StringListToNLString(obj).split('\n')
70
+ if len(obj.iter_items) != obj.max_index:
71
+ del obj.iter_items
72
+ return obj
73
+
74
+ def __next__(self):
75
+ self.current_index += 1
76
+ if self.current_index < self.max_index:
77
+ try:
78
+ return self.iter_items[self.current_index]
79
+ except (AttributeError, IndexError):
80
+ return self.__getitem__(self.current_index)
81
+ else:
82
+ del self.current_index
83
+ del self.max_index
84
+ try:
85
+ delattr(self, 'iter_items')
86
+ except AttributeError:
87
+ pass
88
+ raise StopIteration()
89
+
90
+ # context management
91
+ def __enter__(self):
92
+ return self
93
+
94
+ def __exit__(self, *args):
95
+ self.dealloc()
96
+
97
+ # public methods
98
+ def __iadd__(self, string_list):
99
+ for s in string_list:
100
+ self.append(s)
101
+ return self
102
+
103
+ def append(self,s):
104
+ if not isinstance(s, str):
105
+ raise TecplotTypeError('StringList can only hold strings')
106
+ if hasattr(self, 'current_index'):
107
+ raise TecplotLogicError('Cannot append to StringList while iterating over it')
108
+ _tecutil.StringListAppendString(self, s)
109
+
110
+ def clear(self):
111
+ _tecutil.StringListClear(self)
112
+
113
+ def dealloc(self):
114
+ _tecutil.StringListDealloc(pointer(self))