tm-data-types 0.5.0__tar.gz → 0.6.0__tar.gz

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 (47) hide show
  1. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/PKG-INFO +7 -9
  2. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/pyproject.toml +15 -22
  3. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/datum/data_types.py +4 -3
  4. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/files_and_formats/mat/mat.py +1 -1
  5. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/helpers/byte_data_class.py +5 -4
  6. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/helpers/byte_data_types.py +1 -1
  7. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/io_factory_methods.py +34 -28
  8. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/LICENSE.md +0 -0
  9. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/README.md +0 -0
  10. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/__init__.py +0 -0
  11. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/datum/__init__.py +0 -0
  12. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/datum/datum.py +0 -0
  13. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/datum/waveforms/__init__.py +0 -0
  14. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/datum/waveforms/analog_waveform.py +0 -0
  15. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/datum/waveforms/digital_waveform.py +0 -0
  16. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/datum/waveforms/fastframe_analog_waveform.py +0 -0
  17. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/datum/waveforms/fastframe_common.py +0 -0
  18. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/datum/waveforms/fastframe_digital_waveform.py +0 -0
  19. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/datum/waveforms/iq_waveform.py +0 -0
  20. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/datum/waveforms/waveform.py +0 -0
  21. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/files_and_formats/__init__.py +0 -0
  22. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/files_and_formats/abstracted_file.py +0 -0
  23. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/files_and_formats/csv/__init__.py +0 -0
  24. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/files_and_formats/csv/csv.py +0 -0
  25. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/files_and_formats/csv/data_formats/__init__.py +0 -0
  26. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/files_and_formats/csv/data_formats/analog.py +0 -0
  27. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/files_and_formats/csv/data_formats/digital.py +0 -0
  28. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/files_and_formats/csv/data_formats/iq.py +0 -0
  29. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/files_and_formats/mat/__init__.py +0 -0
  30. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/files_and_formats/mat/data_formats/__init__.py +0 -0
  31. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/files_and_formats/mat/data_formats/analog.py +0 -0
  32. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/files_and_formats/mat/data_formats/digital.py +0 -0
  33. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/files_and_formats/mat/data_formats/iq.py +0 -0
  34. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/files_and_formats/tss/__init__.py +0 -0
  35. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/files_and_formats/tss/tss_reader.py +0 -0
  36. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/files_and_formats/wfm/__init__.py +0 -0
  37. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/files_and_formats/wfm/data_formats/__init__.py +0 -0
  38. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/files_and_formats/wfm/data_formats/analog.py +0 -0
  39. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/files_and_formats/wfm/data_formats/digital.py +0 -0
  40. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/files_and_formats/wfm/data_formats/iq.py +0 -0
  41. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/files_and_formats/wfm/wfm.py +0 -0
  42. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/files_and_formats/wfm/wfm_data_classes.py +0 -0
  43. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/files_and_formats/wfm/wfm_format.py +0 -0
  44. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/helpers/__init__.py +0 -0
  45. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/helpers/class_lookup.py +0 -0
  46. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/helpers/enums.py +0 -0
  47. {tm_data_types-0.5.0 → tm_data_types-0.6.0}/src/tm_data_types/helpers/instrument_series.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tm_data_types
3
- Version: 0.5.0
3
+ Version: 0.6.0
4
4
  Summary: Read and write common Test & Measurement data types.
5
5
  License-Expression: Apache-2.0
6
6
  License-File: LICENSE.md
@@ -9,28 +9,26 @@ Author: Tektronix
9
9
  Author-email: opensource@tektronix.com
10
10
  Maintainer: Tektronix
11
11
  Maintainer-email: opensource@tektronix.com
12
- Requires-Python: >=3.10,<3.14
12
+ Requires-Python: >=3.11,<3.16
13
13
  Classifier: Development Status :: 4 - Beta
14
14
  Classifier: Intended Audience :: Developers
15
15
  Classifier: Intended Audience :: Science/Research
16
16
  Classifier: Operating System :: OS Independent
17
17
  Classifier: Programming Language :: Python :: 3
18
- Classifier: Programming Language :: Python :: 3.10
19
18
  Classifier: Programming Language :: Python :: 3.11
20
19
  Classifier: Programming Language :: Python :: 3.12
21
20
  Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
22
  Classifier: Topic :: Scientific/Engineering
23
23
  Classifier: Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator
24
24
  Classifier: Topic :: System :: Hardware :: Hardware Drivers
25
25
  Requires-Dist: bidict (>=0.23.1,<0.24.0)
26
- Requires-Dist: numba (>=0.60.0,<0.61.0) ; python_version >= "3.10" and python_version < "3.13"
27
- Requires-Dist: numba (>=0.61.0,<0.62.0) ; python_version >= "3.13"
28
- Requires-Dist: numpy (>=1.24,<2.0) ; python_version >= "3.10" and python_version < "3.13"
29
- Requires-Dist: numpy (>=2.1,<3.0) ; python_version >= "3.13"
26
+ Requires-Dist: certifi (>=2026.7.22)
27
+ Requires-Dist: numba (>=0.68.0,<0.69.0)
28
+ Requires-Dist: numpy (>=2.0,<3.0)
30
29
  Requires-Dist: pydantic (>=2.7,<3.0)
31
30
  Requires-Dist: python-dateutil (>=2.8,<3.0)
32
- Requires-Dist: scipy (>=1.14,<2.0) ; python_version >= "3.13"
33
- Requires-Dist: scipy (>=1.9,<2.0) ; python_version >= "3.10" and python_version < "3.13"
31
+ Requires-Dist: scipy (>=1.13,<2.0)
34
32
  Project-URL: Bug Tracker, https://github.com/tektronix/tm_data_types/issues
35
33
  Project-URL: Changelog, https://github.com/tektronix/tm_data_types/blob/main/CHANGELOG.md
36
34
  Project-URL: Documentation, https://tm-data-types.readthedocs.io
@@ -8,14 +8,12 @@ authors = [
8
8
  ]
9
9
  dependencies = [
10
10
  "bidict~=0.23.1",
11
- "numba~=0.60.0; python_version >= '3.10' and python_version < '3.13'",
12
- "numba~=0.61.0; python_version >= '3.13'",
13
- "numpy~=1.24; python_version >= '3.10' and python_version < '3.13'",
14
- "numpy~=2.1; python_version >= '3.13'",
11
+ "certifi>=2026.7.22",
12
+ "numba~=0.68.0",
13
+ "numpy~=2.0",
15
14
  "pydantic~=2.7",
16
15
  "python-dateutil~=2.8",
17
- "scipy~=1.14; python_version >= '3.13'",
18
- "scipy~=1.9; python_version >= '3.10' and python_version < '3.13'",
16
+ "scipy~=1.13",
19
17
  ]
20
18
  description = "Read and write common Test & Measurement data types."
21
19
  dynamic = ["classifiers", "version"]
@@ -29,7 +27,7 @@ maintainers = [
29
27
  ]
30
28
  name = "tm_data_types"
31
29
  readme = "README.md"
32
- requires-python = ">=3.10,<3.14" # PYTHON VERSION MARKER
30
+ requires-python = ">=3.11,<3.16" # PYTHON VERSION MARKER
33
31
 
34
32
  [project.urls]
35
33
  "Bug Tracker" = "https://github.com/tektronix/tm_data_types/issues"
@@ -76,17 +74,12 @@ classifiers = [
76
74
  "Topic :: Scientific/Engineering",
77
75
  "Topic :: System :: Hardware :: Hardware Drivers",
78
76
  ]
79
- version = "0.5.0"
77
+ version = "0.6.0"
80
78
 
81
79
  [tool.poetry.group.dev.dependencies]
82
80
  docutils-stubs = "^0.0.22"
83
81
  matplotlib = "^3.8"
84
82
  nodeenv = "^1.9.1"
85
- numpy = [
86
- # This is required to be duplicated in the "main" and "dev" groups to ensure that the correct version is used in both cases
87
- {python = ">=3.9,<3.13", version = "^1.24"},
88
- {python = ">=3.13", version = "^2.1"},
89
- ]
90
83
  pip = "^26.0"
91
84
  poetry = "^2.2.0"
92
85
  poetry-audit-plugin = "^1.0.0"
@@ -120,7 +113,7 @@ mkdocs-section-index = "^0.3.10"
120
113
  mkdocs-spellcheck = "^1.2.0"
121
114
  mkdocstrings = "^1.0.2"
122
115
  mkdocstrings-python = "^2.0.1"
123
- nodeenv = "^1.9.1"
116
+ nodeenv = "^1.12.0"
124
117
  packaging = "^26.0"
125
118
  pydantic = "^2.7.4"
126
119
  pygments = "^2.17.2"
@@ -157,7 +150,7 @@ ignore-patterns = [
157
150
  "^\\.vscode",
158
151
  "^temp_.*\\..*",
159
152
  ]
160
- jobs = 0
153
+ jobs = 1
161
154
  load-plugins = """
162
155
  pylint.extensions.check_elif,
163
156
  pylint.extensions.code_style,
@@ -176,7 +169,7 @@ pylint.extensions.set_membership,
176
169
  pylint.extensions.typing,
177
170
  pylint.extensions.while_used
178
171
  """
179
- py-version = "3.10" # PYTHON VERSION MARKER
172
+ py-version = "3.11" # PYTHON VERSION MARKER
180
173
  recursive = true
181
174
 
182
175
  [tool.pylint."messages control"]
@@ -226,7 +219,7 @@ ignore = [
226
219
  "temp_*.py",
227
220
  ]
228
221
  pythonPlatform = "All"
229
- pythonVersion = "3.10" # PYTHON VERSION MARKER
222
+ pythonVersion = "3.11" # PYTHON VERSION MARKER
230
223
  reportCallInDefaultInitializer = "error"
231
224
  reportImplicitOverride = "error"
232
225
  reportImplicitStringConcatenation = "error"
@@ -263,7 +256,7 @@ line-length = 100
263
256
  namespace-packages = ["docs/**", "examples/**", "scripts/**", "tests/**"]
264
257
  output-format = "concise"
265
258
  src = ["docs", "examples", "scripts", "src", "tests"]
266
- target-version = "py310" # always generate Python 3.10 compatible code # PYTHON VERSION MARKER
259
+ target-version = "py311" # always generate Python 3.11 compatible code # PYTHON VERSION MARKER
267
260
 
268
261
  [tool.ruff.lint]
269
262
  allowed-confusables = []
@@ -348,22 +341,22 @@ legacy_tox_ini = """
348
341
  [tox]
349
342
  requires = tox>4
350
343
  isolated_build = True
351
- envlist = py310,py311,py312,py313,tests,docs,doctests # PYTHON VERSION MARKER
344
+ envlist = py311,py312,py313,py314,py315,tests,docs,doctests # PYTHON VERSION MARKER
352
345
  skip_missing_interpreters = True
353
346
  labels =
354
- basic = py310,py311,py312,py313,tests # PYTHON VERSION MARKER
347
+ basic = py311,py312,py313,py314,py315,tests # PYTHON VERSION MARKER
355
348
  documentation = docs,doctests
356
349
 
357
350
  [gh-actions]
358
351
  python = # PYTHON VERSION MARKER
359
- 3.10: py310
360
352
  3.11: py311
361
353
  3.12: py312
362
354
  3.13: py313
355
+ 3.14: py314
356
+ 3.15: py315
363
357
 
364
358
  [testenv]
365
359
  package = wheel
366
- install_command = python -I -m pip install --upgrade --upgrade-strategy=eager {opts} {packages}
367
360
  deps =
368
361
  poetry
369
362
  passenv =
@@ -1,7 +1,8 @@
1
1
  """The different formats which are wrapped by a MeasuredData class."""
2
2
 
3
+ import decimal
4
+
3
5
  from abc import abstractmethod
4
- from decimal import Decimal
5
6
  from typing import Any, List, Optional, Type, Union
6
7
 
7
8
  import numpy as np
@@ -58,8 +59,8 @@ def type_ratio(dtype_from: PossibleTypes, dtype_to: PossibleTypes) -> float:
58
59
  Returns:
59
60
  The ratio between the two dtypes.
60
61
  """
61
- old_dtype_range = Decimal(type_max(dtype_from)) - Decimal(type_min(dtype_from))
62
- new_dtype_range = Decimal(type_max(dtype_to)) - Decimal(type_min(dtype_to))
62
+ old_dtype_range = decimal.Decimal(type_max(dtype_from)) - decimal.Decimal(type_min(dtype_from))
63
+ new_dtype_range = decimal.Decimal(type_max(dtype_to)) - decimal.Decimal(type_min(dtype_to))
63
64
  return float(new_dtype_range / old_dtype_range)
64
65
 
65
66
 
@@ -241,7 +241,7 @@ class MATFile(AbstractedFile, Generic[DATUM_TYPE_VAR]):
241
241
  for key, value in self._WAVEFORM_PROPERTIES.items():
242
242
  try:
243
243
  formatted_data[value] = float(getattr(waveform, key))
244
- except ValueError: # noqa: PERF203
244
+ except ValueError:
245
245
  formatted_data[value] = str(getattr(waveform, key))
246
246
  except TypeError:
247
247
  # if None
@@ -109,7 +109,7 @@ class StructuredInfo(EnforcedTypeDataClass):
109
109
  def __len__(self) -> int:
110
110
  """Sum the number of bytes for all annotations in this dataclass."""
111
111
  total_length = 0
112
- for value in self.__annotations__.values():
112
+ for value in type(self).__annotations__.values():
113
113
  total_length += value.length
114
114
  return total_length
115
115
 
@@ -176,16 +176,17 @@ class StructuredInfo(EnforcedTypeDataClass):
176
176
  msg = "Requested custom order unpacking, but order not provided"
177
177
  raise IndexError(msg)
178
178
 
179
+ annotations = type(self).__annotations__
179
180
  if not in_order and order: # noqa: SIM108
180
181
  packing = order
181
182
  else:
182
183
  # this only works because dictionaries preserve order
183
- packing = self.__annotations__.keys()
184
+ packing = annotations.keys()
184
185
 
185
186
  value = []
186
187
 
187
188
  for key in packing:
188
- if key in self.__annotations__:
189
+ if key in annotations:
189
190
  attribute_value = getattr(self, key)
190
191
  value.append(attribute_value)
191
192
  struct_repr_str += attribute_value.struct_repr
@@ -195,7 +196,7 @@ class StructuredInfo(EnforcedTypeDataClass):
195
196
  def get_value_summation(self) -> int:
196
197
  """Sum each byte for all annotations in this dataclass."""
197
198
  total_summation = 0
198
- for key in self.__annotations__:
199
+ for key in type(self).__annotations__:
199
200
  value = getattr(self, key)
200
201
  total_summation += value.get_value_summation()
201
202
  return total_summation
@@ -108,7 +108,7 @@ class String(ByteData, bytes):
108
108
 
109
109
  def __str__(self) -> str:
110
110
  """Remove the null terminations and return it."""
111
- return self.decode("utf_8").rstrip("\x00")
111
+ return self.split(b"\x00", 1)[0].decode("utf-8")
112
112
 
113
113
  ################################################################################################
114
114
  # Public Methods
@@ -169,45 +169,51 @@ def write_files_in_parallel(
169
169
  if len(file_paths) != len(datums):
170
170
  msg = "The number of files paths must be equal to the number of waveforms to write."
171
171
  raise IndexError(msg)
172
+ if not file_paths:
173
+ return
172
174
  process_count = min(force_process_count, len(file_paths))
173
175
  with multiprocessing.Pool(process_count) as process_pool:
176
+ results = []
174
177
  previous_index = 0
175
178
  for index in range(process_count):
176
179
  end_index = min(
177
180
  round((index + 1) * (len(file_paths) / process_count)) + 1,
178
181
  len(file_paths),
179
182
  )
180
- result = process_pool.apply_async(
181
- _write_files,
182
- args=(
183
- file_paths[previous_index:end_index],
184
- datums[previous_index:end_index],
185
- product,
186
- file_format,
187
- ),
183
+ results.append(
184
+ process_pool.apply_async(
185
+ _write_files,
186
+ args=(
187
+ file_paths[previous_index:end_index],
188
+ datums[previous_index:end_index],
189
+ product,
190
+ file_format,
191
+ ),
192
+ )
188
193
  )
189
194
  previous_index = end_index
190
195
 
191
- for index in range(process_count):
196
+ for index, result in enumerate(results):
192
197
  try:
193
198
  result.get()
194
- except Exception as e: # noqa: PERF203
199
+ except Exception as e:
195
200
  msg = f"Error on process {index}, view process stack."
196
201
  raise ChildProcessError(msg) from e
197
202
 
198
203
 
199
- def _read_files(file_paths: str, file_queue: multiprocessing.Queue) -> None:
204
+ def _read_files(file_paths: List[str]) -> List[tuple[str, Datum]]:
200
205
  """Read a waveform from a provided file.
201
206
 
202
207
  Args:
203
208
  file_paths: The file paths to read from.
204
- file_queue: The queue to put the read data into.
209
+ A list of file paths and their read waveforms.
205
210
  """
206
- for file_path in file_paths:
207
- file_queue.put((file_path, read_file(file_path)))
211
+ return [(file_path, read_file(file_path)) for file_path in file_paths]
208
212
 
209
213
 
210
- def read_files_in_parallel(file_paths: List[str], force_process_count: int = 4) -> List[Datum]:
214
+ def read_files_in_parallel(
215
+ file_paths: List[str], force_process_count: int = 4
216
+ ) -> List[tuple[str, Datum]]:
211
217
  """Read a list of files in parallel.
212
218
 
213
219
  This method allows for the parallel reading of multiple waveform files.
@@ -223,32 +229,32 @@ def read_files_in_parallel(file_paths: List[str], force_process_count: int = 4)
223
229
  file_paths: A list of file paths to read from.
224
230
  force_process_count: The number of processes that should be created for this operation.
225
231
  """
232
+ if not file_paths:
233
+ return []
226
234
  process_count = min(force_process_count, len(file_paths))
227
235
  with multiprocessing.Pool(process_count) as process_pool:
236
+ results = []
228
237
  previous_index = 0
229
- manager = multiprocessing.Manager()
230
- file_queue = manager.Queue()
231
238
  for index in range(process_count):
232
239
  end_index = min(
233
240
  round((index + 1) * (len(file_paths) / process_count)) + 1,
234
241
  len(file_paths),
235
242
  )
236
243
 
237
- result = process_pool.apply_async(
238
- _read_files,
239
- args=(
240
- file_paths[previous_index:end_index],
241
- file_queue,
242
- ),
244
+ results.append(
245
+ process_pool.apply_async(
246
+ _read_files,
247
+ args=(file_paths[previous_index:end_index],),
248
+ )
243
249
  )
244
250
  previous_index = end_index
245
251
 
246
- for index in range(process_count):
252
+ read_info = []
253
+ for index, result in enumerate(results):
247
254
  try:
248
- result.get()
249
- except Exception as e: # noqa: PERF203
255
+ read_info.extend(result.get())
256
+ except Exception as e:
250
257
  msg = f"Error on process {index}, view process stack."
251
258
  raise ChildProcessError(msg) from e
252
259
 
253
- file_queue.put(None)
254
- return list(iter(file_queue.get, None))
260
+ return read_info
File without changes
File without changes