tm-data-types 0.3.0__tar.gz → 0.4.1__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.
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/PKG-INFO +8 -10
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/pyproject.toml +79 -92
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/datum/data_types.py +26 -26
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/datum/waveforms/analog_waveform.py +3 -4
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/datum/waveforms/digital_waveform.py +1 -1
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/datum/waveforms/iq_waveform.py +3 -3
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/datum/waveforms/waveform.py +8 -7
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/files_and_formats/abstracted_file.py +3 -2
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/files_and_formats/csv/csv.py +4 -2
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/files_and_formats/csv/data_formats/analog.py +2 -3
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/files_and_formats/csv/data_formats/digital.py +2 -3
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/files_and_formats/csv/data_formats/iq.py +4 -5
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/files_and_formats/mat/data_formats/analog.py +1 -1
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/files_and_formats/mat/data_formats/digital.py +1 -1
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/files_and_formats/mat/data_formats/iq.py +1 -1
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/files_and_formats/mat/mat.py +6 -5
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/files_and_formats/wfm/data_formats/digital.py +44 -0
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/files_and_formats/wfm/data_formats/iq.py +6 -1
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/files_and_formats/wfm/wfm.py +41 -25
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/files_and_formats/wfm/wfm_format.py +25 -16
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/helpers/byte_data_class.py +14 -10
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/helpers/byte_data_types.py +10 -12
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/helpers/class_lookup.py +7 -8
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/io_factory_methods.py +12 -8
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/LICENSE.md +0 -0
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/README.md +0 -0
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/__init__.py +0 -0
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/datum/__init__.py +0 -0
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/datum/datum.py +0 -0
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/datum/waveforms/__init__.py +0 -0
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/files_and_formats/__init__.py +0 -0
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/files_and_formats/csv/__init__.py +0 -0
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/files_and_formats/csv/data_formats/__init__.py +0 -0
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/files_and_formats/mat/__init__.py +0 -0
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/files_and_formats/mat/data_formats/__init__.py +0 -0
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/files_and_formats/wfm/__init__.py +0 -0
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/files_and_formats/wfm/data_formats/__init__.py +0 -0
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/files_and_formats/wfm/data_formats/analog.py +0 -0
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/files_and_formats/wfm/wfm_data_classes.py +0 -0
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/helpers/__init__.py +0 -0
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/helpers/enums.py +0 -0
- {tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/helpers/instrument_series.py +0 -0
|
@@ -1,38 +1,36 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tm_data_types
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.1
|
|
4
4
|
Summary: Read and write common Test & Measurement data types.
|
|
5
|
-
License: Apache-2.0
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
6
|
License-File: LICENSE.md
|
|
7
7
|
Keywords: Tektronix,Test & Measurement
|
|
8
8
|
Author: Tektronix
|
|
9
9
|
Author-email: opensource@tektronix.com
|
|
10
10
|
Maintainer: Tektronix
|
|
11
11
|
Maintainer-email: opensource@tektronix.com
|
|
12
|
-
Requires-Python: >=3.
|
|
12
|
+
Requires-Python: >=3.10,<3.14
|
|
13
13
|
Classifier: Development Status :: 4 - Beta
|
|
14
14
|
Classifier: Intended Audience :: Developers
|
|
15
15
|
Classifier: Intended Audience :: Science/Research
|
|
16
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
17
16
|
Classifier: Operating System :: OS Independent
|
|
18
17
|
Classifier: Programming Language :: Python :: 3
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.10
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.11
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.12
|
|
22
21
|
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
24
22
|
Classifier: Topic :: Scientific/Engineering
|
|
25
23
|
Classifier: Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator
|
|
26
24
|
Classifier: Topic :: System :: Hardware :: Hardware Drivers
|
|
27
25
|
Requires-Dist: bidict (>=0.23.1,<0.24.0)
|
|
28
|
-
Requires-Dist: numba (>=0.60.0,<0.61.0) ; python_version >= "3.
|
|
26
|
+
Requires-Dist: numba (>=0.60.0,<0.61.0) ; python_version >= "3.10" and python_version < "3.13"
|
|
29
27
|
Requires-Dist: numba (>=0.61.0,<0.62.0) ; python_version >= "3.13"
|
|
30
|
-
Requires-Dist: numpy (>=1.24,<2.0) ; python_version >= "3.
|
|
28
|
+
Requires-Dist: numpy (>=1.24,<2.0) ; python_version >= "3.10" and python_version < "3.13"
|
|
31
29
|
Requires-Dist: numpy (>=2.1,<3.0) ; python_version >= "3.13"
|
|
32
|
-
Requires-Dist: pydantic (>=2.7
|
|
33
|
-
Requires-Dist: python-dateutil (>=2.8
|
|
30
|
+
Requires-Dist: pydantic (>=2.7,<3.0)
|
|
31
|
+
Requires-Dist: python-dateutil (>=2.8,<3.0)
|
|
34
32
|
Requires-Dist: scipy (>=1.14,<2.0) ; python_version >= "3.13"
|
|
35
|
-
Requires-Dist: scipy (>=1.9,<2.0) ; python_version >= "3.
|
|
33
|
+
Requires-Dist: scipy (>=1.9,<2.0) ; python_version >= "3.10" and python_version < "3.13"
|
|
36
34
|
Project-URL: Bug Tracker, https://github.com/tektronix/tm_data_types/issues
|
|
37
35
|
Project-URL: Changelog, https://github.com/tektronix/tm_data_types/blob/main/CHANGELOG.md
|
|
38
36
|
Project-URL: Documentation, https://tm-data-types.readthedocs.io
|
|
@@ -1,6 +1,43 @@
|
|
|
1
1
|
[build-system]
|
|
2
2
|
build-backend = "poetry.core.masonry.api"
|
|
3
|
-
requires = ["poetry-core
|
|
3
|
+
requires = ["poetry-core~=2.2.0"]
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
authors = [
|
|
7
|
+
{email = "opensource@tektronix.com", name = "Tektronix"},
|
|
8
|
+
]
|
|
9
|
+
dependencies = [
|
|
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'",
|
|
15
|
+
"pydantic~=2.7",
|
|
16
|
+
"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'",
|
|
19
|
+
]
|
|
20
|
+
description = "Read and write common Test & Measurement data types."
|
|
21
|
+
dynamic = ["classifiers", "version"]
|
|
22
|
+
keywords = [
|
|
23
|
+
"Tektronix",
|
|
24
|
+
"Test & Measurement",
|
|
25
|
+
]
|
|
26
|
+
license = "Apache-2.0"
|
|
27
|
+
maintainers = [
|
|
28
|
+
{email = "opensource@tektronix.com", name = "Tektronix"},
|
|
29
|
+
]
|
|
30
|
+
name = "tm_data_types"
|
|
31
|
+
readme = "README.md"
|
|
32
|
+
requires-python = ">=3.10,<3.14" # PYTHON VERSION MARKER
|
|
33
|
+
|
|
34
|
+
[project.urls]
|
|
35
|
+
"Bug Tracker" = "https://github.com/tektronix/tm_data_types/issues"
|
|
36
|
+
"Changelog" = "https://github.com/tektronix/tm_data_types/blob/main/CHANGELOG.md"
|
|
37
|
+
documentation = "https://tm-data-types.readthedocs.io"
|
|
38
|
+
homepage = "https://pypi.org/project/tm_data_types/"
|
|
39
|
+
repository = "https://github.com/tektronix/tm_data_types"
|
|
40
|
+
|
|
4
41
|
|
|
5
42
|
[tool.coverage.paths]
|
|
6
43
|
source = [
|
|
@@ -31,49 +68,16 @@ wrap-descriptions = 100
|
|
|
31
68
|
wrap-summaries = 0
|
|
32
69
|
|
|
33
70
|
[tool.poetry]
|
|
34
|
-
authors = ["Tektronix <opensource@tektronix.com>"]
|
|
35
71
|
classifiers = [
|
|
36
72
|
"Development Status :: 4 - Beta",
|
|
37
73
|
"Intended Audience :: Developers",
|
|
38
74
|
"Intended Audience :: Science/Research",
|
|
39
75
|
"Operating System :: OS Independent",
|
|
40
|
-
"Programming Language :: Python :: 3.9", # manually add this classifier since Poetry won't add it automatically due to the mimimum Python version being 3.9.2 # TODO: Drop Python 3.9: Remove this classifier
|
|
41
76
|
"Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator",
|
|
42
77
|
"Topic :: Scientific/Engineering",
|
|
43
78
|
"Topic :: System :: Hardware :: Hardware Drivers",
|
|
44
79
|
]
|
|
45
|
-
|
|
46
|
-
documentation = "https://tm-data-types.readthedocs.io"
|
|
47
|
-
homepage = "https://pypi.org/project/tm_data_types/"
|
|
48
|
-
keywords = [
|
|
49
|
-
"Tektronix",
|
|
50
|
-
"Test & Measurement",
|
|
51
|
-
]
|
|
52
|
-
license = "Apache-2.0"
|
|
53
|
-
maintainers = ["Tektronix <opensource@tektronix.com>"]
|
|
54
|
-
name = "tm_data_types"
|
|
55
|
-
readme = "README.md"
|
|
56
|
-
repository = "https://github.com/tektronix/tm_data_types"
|
|
57
|
-
version = "0.3.0"
|
|
58
|
-
|
|
59
|
-
[tool.poetry.dependencies]
|
|
60
|
-
bidict = "^0.23.1"
|
|
61
|
-
numba = [
|
|
62
|
-
{python = ">=3.9,<3.13", version = "^0.60.0"},
|
|
63
|
-
{python = ">=3.13", version = "^0.61.0"},
|
|
64
|
-
]
|
|
65
|
-
numpy = [
|
|
66
|
-
# This is required to be duplicated in the "main" and "dev" groups to ensure that the correct version is used in both cases
|
|
67
|
-
{python = ">=3.9,<3.13", version = "^1.24"},
|
|
68
|
-
{python = ">=3.13", version = "^2.1"},
|
|
69
|
-
]
|
|
70
|
-
pydantic = "^2.7.4"
|
|
71
|
-
python = ">=3.9.2,<3.14" # This is the main Python version requirement
|
|
72
|
-
python-dateutil = "^2.8.2"
|
|
73
|
-
scipy = [
|
|
74
|
-
{python = ">=3.9,<3.13", version = "^1.9"},
|
|
75
|
-
{python = ">=3.13", version = "^1.14"},
|
|
76
|
-
]
|
|
80
|
+
version = "0.4.1"
|
|
77
81
|
|
|
78
82
|
[tool.poetry.group.dev.dependencies]
|
|
79
83
|
docutils-stubs = "^0.0.22"
|
|
@@ -84,14 +88,14 @@ numpy = [
|
|
|
84
88
|
{python = ">=3.9,<3.13", version = "^1.24"},
|
|
85
89
|
{python = ">=3.13", version = "^2.1"},
|
|
86
90
|
]
|
|
87
|
-
pip = "^
|
|
88
|
-
poetry = "^
|
|
89
|
-
poetry-audit-plugin = "^0.
|
|
91
|
+
pip = "^26.0"
|
|
92
|
+
poetry = "^2.2.0"
|
|
93
|
+
poetry-audit-plugin = "^1.0.0"
|
|
90
94
|
poetry-plugin-export = "^1.7.1"
|
|
91
95
|
poetry-pre-commit-plugin = "^0.2.2"
|
|
92
96
|
pre-commit = "^4.2"
|
|
93
|
-
pylint = "
|
|
94
|
-
pyright = {extras = ["nodejs"], version = "1.1.
|
|
97
|
+
pylint = "4.0.5"
|
|
98
|
+
pyright = {extras = ["nodejs"], version = "1.1.409"}
|
|
95
99
|
pyroma = "^5.0"
|
|
96
100
|
tox = "^4.0"
|
|
97
101
|
tox-gh-actions = "^3.1.0"
|
|
@@ -99,25 +103,26 @@ twine = "^6.0.1"
|
|
|
99
103
|
types-python-dateutil = "^2.9"
|
|
100
104
|
types-pyyaml = "^6.0"
|
|
101
105
|
types-requests = "^2.31"
|
|
102
|
-
wheel = "^0.
|
|
106
|
+
wheel = "^0.47.0"
|
|
103
107
|
|
|
104
108
|
[tool.poetry.group.docs.dependencies]
|
|
105
|
-
black = "^
|
|
109
|
+
black = "^26.1.0"
|
|
106
110
|
codespell = "^2.2.6"
|
|
107
|
-
griffe = "^
|
|
108
|
-
mkdocs = "^1.6.
|
|
109
|
-
mkdocs-ezglossary-plugin = "^2.
|
|
110
|
-
mkdocs-gen-files = "^0.
|
|
111
|
-
mkdocs-include-markdown-plugin = "^7.1
|
|
112
|
-
mkdocs-literate-nav = "^0.6.
|
|
113
|
-
mkdocs-macros-plugin = "^1.0
|
|
114
|
-
mkdocs-mermaid2-plugin = "^1.
|
|
115
|
-
mkdocs-section-index = "^0.3.
|
|
116
|
-
mkdocs-spellcheck = "^1.
|
|
117
|
-
mkdocstrings = "^0.
|
|
118
|
-
mkdocstrings-python = "^
|
|
111
|
+
griffe = "^2.0.0"
|
|
112
|
+
mkdocs = "^1.6.1"
|
|
113
|
+
mkdocs-ezglossary-plugin = "^2.1.0"
|
|
114
|
+
mkdocs-gen-files = "^0.6.0"
|
|
115
|
+
mkdocs-include-markdown-plugin = "^7.2.1"
|
|
116
|
+
mkdocs-literate-nav = "^0.6.2"
|
|
117
|
+
mkdocs-macros-plugin = "^1.5.0"
|
|
118
|
+
mkdocs-mermaid2-plugin = "^1.2.3"
|
|
119
|
+
mkdocs-section-index = "^0.3.10"
|
|
120
|
+
mkdocs-spellcheck = "^1.2.0"
|
|
121
|
+
mkdocstrings = "^1.0.2"
|
|
122
|
+
mkdocstrings-python = "^2.0.1"
|
|
119
123
|
nodeenv = "^1.9.1"
|
|
120
|
-
packaging = "^
|
|
124
|
+
packaging = "^26.0"
|
|
125
|
+
pydantic = "^2.7.4"
|
|
121
126
|
pygments = "^2.17.2"
|
|
122
127
|
pymdown-extensions = "^10.8.1"
|
|
123
128
|
requests = "^2.31.0"
|
|
@@ -127,7 +132,7 @@ tomli = "^2.0.1"
|
|
|
127
132
|
[tool.poetry.group.tests.dependencies]
|
|
128
133
|
coverage = "^7.5.0"
|
|
129
134
|
linkchecker = "^10.0.0"
|
|
130
|
-
pytest = "^
|
|
135
|
+
pytest = "^9.0.2"
|
|
131
136
|
pytest-cov = "^7.0.0"
|
|
132
137
|
pytest-depends = "^1.0.1"
|
|
133
138
|
pytest-env = "^1.1.3"
|
|
@@ -135,10 +140,6 @@ pytest-github-report = "^0.0.1"
|
|
|
135
140
|
pytest-html = "^4.1.1"
|
|
136
141
|
pytest-order = "^1.2.1"
|
|
137
142
|
|
|
138
|
-
[tool.poetry.urls]
|
|
139
|
-
"Bug Tracker" = "https://github.com/tektronix/tm_data_types/issues"
|
|
140
|
-
"Changelog" = "https://github.com/tektronix/tm_data_types/blob/main/CHANGELOG.md"
|
|
141
|
-
|
|
142
143
|
[tool.pylint.basic]
|
|
143
144
|
good-names = ["_"]
|
|
144
145
|
|
|
@@ -175,13 +176,14 @@ pylint.extensions.set_membership,
|
|
|
175
176
|
pylint.extensions.typing,
|
|
176
177
|
pylint.extensions.while_used
|
|
177
178
|
"""
|
|
178
|
-
py-version = "3.
|
|
179
|
+
py-version = "3.10" # PYTHON VERSION MARKER
|
|
179
180
|
recursive = true
|
|
180
181
|
|
|
181
182
|
[tool.pylint."messages control"]
|
|
182
183
|
enable = ["all"]
|
|
183
184
|
disable = [
|
|
184
185
|
"broad-exception-caught", # caught by ruff
|
|
186
|
+
"consider-alternative-union-syntax", # caught by ruff
|
|
185
187
|
"deprecated-typing-alias", # caught by ruff
|
|
186
188
|
"duplicate-code",
|
|
187
189
|
"fixme", # caught by ruff
|
|
@@ -227,7 +229,7 @@ ignore = [
|
|
|
227
229
|
"temp_*.py",
|
|
228
230
|
]
|
|
229
231
|
pythonPlatform = "All"
|
|
230
|
-
pythonVersion = "3.
|
|
232
|
+
pythonVersion = "3.10" # PYTHON VERSION MARKER
|
|
231
233
|
reportCallInDefaultInitializer = "error"
|
|
232
234
|
reportImplicitOverride = "error"
|
|
233
235
|
reportImplicitStringConcatenation = "error"
|
|
@@ -264,7 +266,7 @@ line-length = 100
|
|
|
264
266
|
namespace-packages = ["docs/**", "examples/**", "scripts/**", "tests/**"]
|
|
265
267
|
output-format = "concise"
|
|
266
268
|
src = ["docs", "examples", "scripts", "src", "tests"]
|
|
267
|
-
target-version = "
|
|
269
|
+
target-version = "py310" # always generate Python 3.10 compatible code # PYTHON VERSION MARKER
|
|
268
270
|
|
|
269
271
|
[tool.ruff.lint]
|
|
270
272
|
allowed-confusables = []
|
|
@@ -272,27 +274,19 @@ fixable = ["ALL"]
|
|
|
272
274
|
flake8-pytest-style = {mark-parentheses = false}
|
|
273
275
|
flake8-quotes = {docstring-quotes = "double"}
|
|
274
276
|
ignore = [
|
|
275
|
-
"
|
|
276
|
-
"
|
|
277
|
-
"
|
|
278
|
-
"
|
|
279
|
-
"
|
|
280
|
-
"FA100", # Missing `from __future__ import annotations`, but uses ... # TODO: enable this
|
|
281
|
-
"FBT", # flake8-boolean-trap # TODO: enable this
|
|
282
|
-
"FIX002", # Line contains TO DO
|
|
277
|
+
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed in *args and **kwargs (allowed in this package)
|
|
278
|
+
"COM812", # Trailing comma missing (allowed in this package)
|
|
279
|
+
"FA100", # Missing `from __future__ import annotations`, but uses ... (allowed in this package)
|
|
280
|
+
"FBT", # flake8-boolean-trap (allowed in this package)
|
|
281
|
+
"FIX002", # Line contains TO DO (allowed in this package)
|
|
283
282
|
"ISC001", # single-line-implicit-string-concatenation (handled by formatter)
|
|
284
283
|
"PTH", # flake8-use-pathlib # TODO: enable this
|
|
285
|
-
"
|
|
286
|
-
"
|
|
287
|
-
"
|
|
288
|
-
"
|
|
289
|
-
"
|
|
290
|
-
"
|
|
291
|
-
"UP024", # Replace aliased errors with `OSError`
|
|
292
|
-
"UP035", # Use `X | Y` for type annotations # TODO: Drop Python 3.9: enable this check
|
|
293
|
-
"UP036", # Use `X | Y | None` for type annotations # TODO: Drop Python 3.9: enable this check
|
|
294
|
-
"UP037", # Remove quotes from type annotation # TODO: Drop Python 3.9: enable this check
|
|
295
|
-
"UP045", # Use `X | None` for type annotations # TODO: Drop Python 3.9: enable this check
|
|
284
|
+
"TD002", # Missing author in TO DO (allowed in this package)
|
|
285
|
+
"TD003", # Missing issue link on the line following this TO DO (allowed in this package)
|
|
286
|
+
"UP006", # Use `type` instead of `Type` for type annotation # TODO: enable this check (will require updating code handling data types)
|
|
287
|
+
"UP024", # Replace aliased errors with `OSError` (allowed in this package)
|
|
288
|
+
"UP035", # Use `X | Y` for type annotations # TODO: enable this check (will require updating code handling data types)
|
|
289
|
+
"UP045", # Use `X | None` for type annotations # TODO: enable this check (will require updating code handling data types)
|
|
296
290
|
]
|
|
297
291
|
pydocstyle = {convention = "google"}
|
|
298
292
|
pylint = {max-args = 7}
|
|
@@ -356,15 +350,14 @@ legacy_tox_ini = """
|
|
|
356
350
|
[tox]
|
|
357
351
|
requires = tox>4
|
|
358
352
|
isolated_build = True
|
|
359
|
-
envlist =
|
|
353
|
+
envlist = py310,py311,py312,py313,tests,docs,doctests # PYTHON VERSION MARKER
|
|
360
354
|
skip_missing_interpreters = True
|
|
361
355
|
labels =
|
|
362
|
-
basic =
|
|
356
|
+
basic = py310,py311,py312,py313,tests # PYTHON VERSION MARKER
|
|
363
357
|
documentation = docs,doctests
|
|
364
358
|
|
|
365
359
|
[gh-actions]
|
|
366
|
-
python =
|
|
367
|
-
3.9: py39
|
|
360
|
+
python = # PYTHON VERSION MARKER
|
|
368
361
|
3.10: py310
|
|
369
362
|
3.11: py311
|
|
370
363
|
3.12: py312
|
|
@@ -407,27 +400,21 @@ commands_pre =
|
|
|
407
400
|
|
|
408
401
|
[testenv:docs]
|
|
409
402
|
basepython = {env:DOC_PYTHON_VERSION}
|
|
410
|
-
passenv =
|
|
411
|
-
GITHUB_PAT
|
|
412
403
|
deps =
|
|
413
404
|
-rdocs/requirements.txt
|
|
414
405
|
commands_pre =
|
|
415
406
|
nodeenv --python-virtualenv --clean-src
|
|
416
|
-
python scripts/install_insiders_packages.py
|
|
417
407
|
commands =
|
|
418
408
|
python -c "import shutil; shutil.rmtree('.results_{envname}', ignore_errors=True)"
|
|
419
409
|
mkdocs --verbose build --site-dir .results_{envname}
|
|
420
410
|
|
|
421
411
|
[testenv:doctests]
|
|
422
412
|
basepython = {env:DOC_PYTHON_VERSION}
|
|
423
|
-
passenv =
|
|
424
|
-
GITHUB_PAT
|
|
425
413
|
deps =
|
|
426
414
|
-rdocs/requirements.txt
|
|
427
415
|
-rtests/requirements.txt
|
|
428
416
|
commands_pre =
|
|
429
417
|
nodeenv --python-virtualenv --clean-src
|
|
430
|
-
python scripts/install_insiders_packages.py
|
|
431
418
|
commands =
|
|
432
419
|
pytest -v -k "test_docs" --showlocals --junitxml={tox_root}/.results_{envname}/results.xml --self-contained-html --html={tox_root}/.results_{envname}/results.html
|
|
433
420
|
|
|
@@ -7,16 +7,17 @@ from typing import Any, List, Optional, Type, Union
|
|
|
7
7
|
import numpy as np
|
|
8
8
|
|
|
9
9
|
from numpy.typing import NDArray
|
|
10
|
+
from typing_extensions import Self
|
|
10
11
|
|
|
11
12
|
from tm_data_types.helpers.byte_data_types import ByteData, Double
|
|
12
13
|
|
|
13
|
-
PossibleTypes =
|
|
14
|
+
PossibleTypes = np.integer[Any] | np.floating[Any]
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
def _check_type(
|
|
17
|
-
as_type: Optional[
|
|
18
|
+
as_type: Optional[Type[ByteData] | PossibleTypes | Type[PossibleTypes]],
|
|
18
19
|
measured_data: Optional[
|
|
19
|
-
Union[NDArray[PossibleTypes], "MeasuredData", List[
|
|
20
|
+
Union[NDArray[PossibleTypes], "MeasuredData", List[float | int]]
|
|
20
21
|
] = None,
|
|
21
22
|
) -> PossibleTypes:
|
|
22
23
|
"""Convert types to np dtype, or grab the measured data dtype.
|
|
@@ -39,7 +40,8 @@ def _check_type(
|
|
|
39
40
|
elif as_type is not None and isinstance(ByteData, type(as_type)) and as_type.np_repr: # pyright: ignore [reportAttributeAccessIssue]
|
|
40
41
|
dtype = np.dtype(as_type.np_repr) # pyright: ignore [reportAttributeAccessIssue]
|
|
41
42
|
else:
|
|
42
|
-
|
|
43
|
+
msg = "No type can be gotten from the passed parameters."
|
|
44
|
+
raise TypeError(msg)
|
|
43
45
|
return dtype
|
|
44
46
|
|
|
45
47
|
|
|
@@ -62,8 +64,8 @@ def type_ratio(dtype_from: PossibleTypes, dtype_to: PossibleTypes) -> float:
|
|
|
62
64
|
|
|
63
65
|
|
|
64
66
|
def type_max(
|
|
65
|
-
data_format:
|
|
66
|
-
) ->
|
|
67
|
+
data_format: Type[ByteData] | PossibleTypes | Type[PossibleTypes],
|
|
68
|
+
) -> float | int:
|
|
67
69
|
"""Get the maximum extent of a dtype.
|
|
68
70
|
|
|
69
71
|
Args:
|
|
@@ -77,12 +79,13 @@ def type_max(
|
|
|
77
79
|
return int(np.iinfo(dtype).max)
|
|
78
80
|
if issubclass(dtype.type, np.floating):
|
|
79
81
|
return float(np.finfo(dtype).max)
|
|
80
|
-
|
|
82
|
+
msg = "Invalid type for maximum possible value."
|
|
83
|
+
raise TypeError(msg)
|
|
81
84
|
|
|
82
85
|
|
|
83
86
|
def type_min(
|
|
84
|
-
data_format:
|
|
85
|
-
) ->
|
|
87
|
+
data_format: Type[ByteData] | PossibleTypes | Type[PossibleTypes],
|
|
88
|
+
) -> float | int:
|
|
86
89
|
"""Get the minimum extent of a dtype.
|
|
87
90
|
|
|
88
91
|
Args:
|
|
@@ -93,7 +96,8 @@ def type_min(
|
|
|
93
96
|
return int(np.iinfo(dtype).min)
|
|
94
97
|
if issubclass(dtype.type, np.floating):
|
|
95
98
|
return float(np.finfo(dtype).min)
|
|
96
|
-
|
|
99
|
+
msg = "Invalid type for minimum possible value."
|
|
100
|
+
raise TypeError(msg)
|
|
97
101
|
|
|
98
102
|
|
|
99
103
|
class MeasuredData(np.ndarray):
|
|
@@ -105,9 +109,9 @@ class MeasuredData(np.ndarray):
|
|
|
105
109
|
|
|
106
110
|
def __new__(
|
|
107
111
|
cls,
|
|
108
|
-
measured_data: Union["MeasuredData", NDArray[PossibleTypes], List[
|
|
109
|
-
as_type: Optional[
|
|
110
|
-
) ->
|
|
112
|
+
measured_data: Union["MeasuredData", NDArray[PossibleTypes], List[int | float]],
|
|
113
|
+
as_type: Optional[Type[ByteData] | PossibleTypes | Type[PossibleTypes]] = None,
|
|
114
|
+
) -> Self:
|
|
111
115
|
"""When a new instance of MeasuredData is created, retype it.
|
|
112
116
|
|
|
113
117
|
Args:
|
|
@@ -119,20 +123,20 @@ class MeasuredData(np.ndarray):
|
|
|
119
123
|
"""
|
|
120
124
|
# if the provided data is a list but no conversion type is provided, error out
|
|
121
125
|
if isinstance(measured_data, List) and as_type is None:
|
|
122
|
-
|
|
126
|
+
msg = "No type specified for data."
|
|
127
|
+
raise TypeError(msg)
|
|
123
128
|
|
|
124
129
|
dtype = _check_type(as_type, measured_data)
|
|
125
130
|
|
|
126
131
|
# if the previous type is a MeasuredData, retype it to whatever the current class is
|
|
127
132
|
if isinstance(measured_data, MeasuredData):
|
|
128
133
|
our_type_array = cls._convert_data_to_type(measured_data, dtype=dtype)
|
|
129
|
-
|
|
134
|
+
return super().__new__(
|
|
130
135
|
cls,
|
|
131
136
|
buffer=our_type_array,
|
|
132
137
|
shape=our_type_array.shape,
|
|
133
138
|
dtype=our_type_array.dtype,
|
|
134
139
|
)
|
|
135
|
-
return obj
|
|
136
140
|
# otherwise assume that the type is correct and use that without conversion
|
|
137
141
|
if isinstance(measured_data, List):
|
|
138
142
|
shape = len(measured_data)
|
|
@@ -140,8 +144,7 @@ class MeasuredData(np.ndarray):
|
|
|
140
144
|
else:
|
|
141
145
|
shape = measured_data.shape
|
|
142
146
|
# needs astype, __new__ does some strange things converting from float64 to float32
|
|
143
|
-
|
|
144
|
-
return obj
|
|
147
|
+
return super().__new__(cls, buffer=measured_data.astype(dtype), shape=shape, dtype=dtype)
|
|
145
148
|
|
|
146
149
|
################################################################################################
|
|
147
150
|
# Public Methods
|
|
@@ -358,8 +361,7 @@ class FeatureScaled(MeasuredData):
|
|
|
358
361
|
measured_data: Information provided through measurement of a device.
|
|
359
362
|
dtype: The dtype to convert to.
|
|
360
363
|
"""
|
|
361
|
-
|
|
362
|
-
return raw_sample_data
|
|
364
|
+
return (measured_data * type_max(dtype)).astype(dtype)
|
|
363
365
|
|
|
364
366
|
@classmethod
|
|
365
367
|
def _raw_sample_format_to_this_format(
|
|
@@ -373,9 +375,7 @@ class FeatureScaled(MeasuredData):
|
|
|
373
375
|
"""
|
|
374
376
|
np_dtype = np.dtype(Double.np_repr)
|
|
375
377
|
current_dtype: PossibleTypes = np.dtype(raw_sample_data.dtype)
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
return measured_data
|
|
378
|
+
return (raw_sample_data / type_max(current_dtype)).astype(np_dtype)
|
|
379
379
|
|
|
380
380
|
|
|
381
381
|
class Normalized(MeasuredData):
|
|
@@ -394,11 +394,11 @@ class Normalized(MeasuredData):
|
|
|
394
394
|
|
|
395
395
|
def __new__(
|
|
396
396
|
cls,
|
|
397
|
-
measured_data:
|
|
397
|
+
measured_data: MeasuredData | NDArray[PossibleTypes] | List[float | int],
|
|
398
398
|
spacing: Optional[float] = None,
|
|
399
399
|
offset: Optional[float] = None,
|
|
400
|
-
as_type: Optional[
|
|
401
|
-
) ->
|
|
400
|
+
as_type: Optional[Type[ByteData] | Type[PossibleTypes] | PossibleTypes] = None,
|
|
401
|
+
) -> Self:
|
|
402
402
|
"""Override the base new, utilizing the offset and spacing class variables temporarily.
|
|
403
403
|
|
|
404
404
|
Args:
|
{tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/datum/waveforms/analog_waveform.py
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""Handles information pertaining to analog waveforms."""
|
|
2
2
|
|
|
3
3
|
from functools import cached_property
|
|
4
|
-
from typing import Any, Optional, Type
|
|
4
|
+
from typing import Any, Optional, Type
|
|
5
5
|
|
|
6
6
|
import numpy as np
|
|
7
7
|
|
|
@@ -126,7 +126,7 @@ class AnalogWaveform(Waveform):
|
|
|
126
126
|
|
|
127
127
|
def transform_to_type(
|
|
128
128
|
self,
|
|
129
|
-
as_type:
|
|
129
|
+
as_type: Type[ByteData] | Type[PossibleTypes] | PossibleTypes,
|
|
130
130
|
) -> "AnalogWaveform":
|
|
131
131
|
"""Convert the waveform to a new type.
|
|
132
132
|
|
|
@@ -174,8 +174,7 @@ class AnalogWaveform(Waveform):
|
|
|
174
174
|
by the waveform.
|
|
175
175
|
"""
|
|
176
176
|
# FOILed to support float64
|
|
177
|
-
|
|
178
|
-
return extent
|
|
177
|
+
return self.y_axis_spacing / self.y_axis_values.calculate_spacing()
|
|
179
178
|
|
|
180
179
|
@y_axis_extent_magnitude.setter
|
|
181
180
|
def y_axis_extent_magnitude(self, extent_magnitude: float) -> None:
|
{tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/datum/waveforms/digital_waveform.py
RENAMED
|
@@ -59,7 +59,7 @@ class DigitalWaveform(Waveform):
|
|
|
59
59
|
# Dunder Methods
|
|
60
60
|
################################################################################################
|
|
61
61
|
|
|
62
|
-
def __str__(self):
|
|
62
|
+
def __str__(self) -> str:
|
|
63
63
|
"""Returns a string representation of the class.
|
|
64
64
|
|
|
65
65
|
Returns:
|
{tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/datum/waveforms/iq_waveform.py
RENAMED
|
@@ -85,7 +85,7 @@ class IQWaveform(Waveform):
|
|
|
85
85
|
# Dunder Methods
|
|
86
86
|
################################################################################################
|
|
87
87
|
|
|
88
|
-
def __str__(self):
|
|
88
|
+
def __str__(self) -> str:
|
|
89
89
|
"""Returns a string representation of the class.
|
|
90
90
|
|
|
91
91
|
Returns:
|
|
@@ -93,7 +93,7 @@ class IQWaveform(Waveform):
|
|
|
93
93
|
"""
|
|
94
94
|
return "iq"
|
|
95
95
|
|
|
96
|
-
def __init__(self):
|
|
96
|
+
def __init__(self) -> None:
|
|
97
97
|
"""Initialize the iq waveform class with the raw data."""
|
|
98
98
|
super().__init__()
|
|
99
99
|
self.meta_info: Optional[IQWaveformMetaInfo]
|
|
@@ -199,7 +199,7 @@ class IQWaveform(Waveform):
|
|
|
199
199
|
return self.iq_axis_spacing * type_extent
|
|
200
200
|
|
|
201
201
|
@iq_axis_extent_magnitude.setter
|
|
202
|
-
def iq_axis_extent_magnitude(self, extent_magnitude: float):
|
|
202
|
+
def iq_axis_extent_magnitude(self, extent_magnitude: float) -> None:
|
|
203
203
|
"""Set the magnitude extent of values that can be represented in the y-axis units.
|
|
204
204
|
|
|
205
205
|
Args:
|
|
@@ -107,12 +107,11 @@ class WaveformMetaInfo(ExclusiveMetaInfo):
|
|
|
107
107
|
This method is used internally to separate tekmeta-specific fields from
|
|
108
108
|
standard waveform metadata fields.
|
|
109
109
|
"""
|
|
110
|
-
|
|
110
|
+
return {
|
|
111
111
|
key: value
|
|
112
112
|
for key, value in self.__dict__.items()
|
|
113
113
|
if value is not None and key not in ExclusiveMetaInfo.__annotations__
|
|
114
114
|
}
|
|
115
|
-
return data
|
|
116
115
|
|
|
117
116
|
def set_custom_metadata(self, **kwargs: Any) -> None:
|
|
118
117
|
"""Set custom metadata fields in extended_metadata.
|
|
@@ -260,19 +259,22 @@ class WaveformMetaInfo(ExclusiveMetaInfo):
|
|
|
260
259
|
|
|
261
260
|
# Provide more helpful error message
|
|
262
261
|
if self.extended_metadata is None:
|
|
263
|
-
|
|
262
|
+
msg = (
|
|
264
263
|
f"{type(self).__name__} object has no attribute {name!r}. "
|
|
265
264
|
f"To add custom metadata, set extended_metadata first: "
|
|
266
265
|
f"meta_info.extended_metadata = {{'{name}': your_value}}"
|
|
267
266
|
)
|
|
267
|
+
raise AttributeError(msg)
|
|
268
268
|
if name not in self.extended_metadata:
|
|
269
269
|
available_keys = list(self.extended_metadata.keys()) if self.extended_metadata else []
|
|
270
|
-
|
|
270
|
+
msg = (
|
|
271
271
|
f"{type(self).__name__} object has no attribute {name!r}. "
|
|
272
272
|
f"Available custom metadata keys: {available_keys}. "
|
|
273
273
|
f"To add this field use: meta_info.extended_metadata['{name}'] = your_value"
|
|
274
274
|
)
|
|
275
|
-
|
|
275
|
+
raise AttributeError(msg)
|
|
276
|
+
msg = f"{type(self).__name__} object has no attribute {name!r}"
|
|
277
|
+
raise AttributeError(msg)
|
|
276
278
|
|
|
277
279
|
|
|
278
280
|
class Waveform(Datum, ABC):
|
|
@@ -308,14 +310,13 @@ class Waveform(Datum, ABC):
|
|
|
308
310
|
"""
|
|
309
311
|
trigger_location = self.trigger_index * self.x_axis_spacing
|
|
310
312
|
# create an array with pre-applied ranges, spacing based on x_axis_spacing
|
|
311
|
-
|
|
313
|
+
return np.arange(
|
|
312
314
|
0 - trigger_location,
|
|
313
315
|
(self.record_length * self.x_axis_spacing)
|
|
314
316
|
- (self.x_axis_spacing / 2)
|
|
315
317
|
- trigger_location,
|
|
316
318
|
self.x_axis_spacing,
|
|
317
319
|
)
|
|
318
|
-
return x_axis_values
|
|
319
320
|
|
|
320
321
|
@property
|
|
321
322
|
def record_length(self) -> int:
|
{tm_data_types-0.3.0 → tm_data_types-0.4.1}/src/tm_data_types/files_and_formats/abstracted_file.py
RENAMED
|
@@ -4,6 +4,7 @@ from abc import ABC, abstractmethod
|
|
|
4
4
|
from typing import Dict, Generic, Optional, TextIO, TypeVar
|
|
5
5
|
|
|
6
6
|
from bidict import bidict
|
|
7
|
+
from typing_extensions import Self
|
|
7
8
|
|
|
8
9
|
from tm_data_types.datum.datum import Datum
|
|
9
10
|
from tm_data_types.helpers.instrument_series import InstrumentSeries
|
|
@@ -36,7 +37,7 @@ class AbstractedFile(ABC, Generic[DATUM_TYPE_VAR]):
|
|
|
36
37
|
self.product = product
|
|
37
38
|
self.fd: TextIO
|
|
38
39
|
|
|
39
|
-
def __enter__(self) ->
|
|
40
|
+
def __enter__(self) -> Self:
|
|
40
41
|
"""Open a filestream for the file when entering a with statement.
|
|
41
42
|
|
|
42
43
|
Returns:
|
|
@@ -45,7 +46,7 @@ class AbstractedFile(ABC, Generic[DATUM_TYPE_VAR]):
|
|
|
45
46
|
self.fd = open(self.file_path, self.io_type) # pylint: disable=unspecified-encoding
|
|
46
47
|
return self
|
|
47
48
|
|
|
48
|
-
def __exit__(self, *args) -> None:
|
|
49
|
+
def __exit__(self, *args: object) -> None:
|
|
49
50
|
"""Close the filestream when exiting a with statement."""
|
|
50
51
|
self.fd.close()
|
|
51
52
|
|
|
@@ -82,11 +82,13 @@ class CSVFile(AbstractedFile, Generic[DATUM_TYPE_VAR]):
|
|
|
82
82
|
if values_matrix is None:
|
|
83
83
|
float(row[0])
|
|
84
84
|
if not record_length:
|
|
85
|
-
|
|
85
|
+
msg = "No Record Length Provided in csv."
|
|
86
|
+
raise IOError(msg)
|
|
86
87
|
values_matrix = np.empty((record_length, len(row)))
|
|
87
88
|
for index, item in enumerate(row):
|
|
88
89
|
if len(row) != values_matrix.shape[1]:
|
|
89
|
-
|
|
90
|
+
msg = "CSV data not parseable."
|
|
91
|
+
raise IOError(msg)
|
|
90
92
|
values_matrix[values_row][index] = float(item)
|
|
91
93
|
values_row += 1
|
|
92
94
|
except ValueError:
|