PyIBIS-AMI 6.2.1__tar.gz → 7.1.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.
- {pyibis_ami-6.2.1/src/PyIBIS_AMI.egg-info → pyibis_ami-7.1.0}/PKG-INFO +4 -4
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/docs/source/ami.rst +4 -1
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/docs/source/conf.py +6 -2
- pyibis_ami-7.1.0/docs/source/ibis.rst +22 -0
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/pyproject.toml +5 -5
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0/src/PyIBIS_AMI.egg-info}/PKG-INFO +4 -4
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/src/PyIBIS_AMI.egg-info/SOURCES.txt +6 -0
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/src/pyibisami/IBIS_AMI_Tester.ipynb +7 -2
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/src/pyibisami/ami/config.py +70 -30
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/src/pyibisami/ami/model.py +37 -45
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/src/pyibisami/ami/parameter.py +4 -7
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/src/pyibisami/ami/parser.py +157 -96
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/src/pyibisami/common.py +0 -1
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/src/pyibisami/ibis/file.py +1 -0
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/src/pyibisami/ibis/model.py +40 -27
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/src/pyibisami/ibis/parser.py +32 -30
- pyibis_ami-6.2.1/docs/source/ibis.rst +0 -19
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/LICENSE +0 -0
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/MANIFEST.in +0 -0
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/README.md +0 -0
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/docs/source/index.rst +0 -0
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/docs/source/install.rst +0 -0
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/docs/source/modules.rst +0 -0
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/docs/source/tools.rst +0 -0
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/examples/all_taps.run +0 -0
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/examples/bandwidth.run +0 -0
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/examples/dummy.em +0 -0
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/examples/examples.md +0 -0
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/examples/freq_resp.em +0 -0
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/examples/impulse.em +0 -0
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/examples/impulse_response_8ma.txt +0 -0
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/examples/mode.run +0 -0
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/examples/stratix4_ami_tx_runs/all_taps.run +0 -0
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/examples/stratix4_ami_tx_runs/test_results.xml +0 -0
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/examples/test_results/test_results.xsl +0 -0
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/setup.cfg +0 -0
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/src/PyIBIS_AMI.egg-info/dependency_links.txt +0 -0
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/src/PyIBIS_AMI.egg-info/entry_points.txt +0 -0
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/src/PyIBIS_AMI.egg-info/requires.txt +0 -0
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/src/PyIBIS_AMI.egg-info/top_level.txt +0 -0
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/src/pyibisami/IBIS_AMI_Checker.ipynb +0 -0
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/src/pyibisami/__init__.py +0 -0
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/src/pyibisami/__main__.py +0 -0
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/src/pyibisami/ami/__init__.py +0 -0
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/src/pyibisami/ami/generic.ami.em +0 -0
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/src/pyibisami/ami/generic.ibs.em +0 -0
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/src/pyibisami/ibis/__init__.py +0 -0
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/src/pyibisami/tools/__init__.py +0 -0
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/src/pyibisami/tools/run_notebook.py +0 -0
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/src/pyibisami/tools/run_tests.py +0 -0
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/src/pyibisami/tools/test_results.xsl +0 -0
- {pyibis_ami-6.2.1 → pyibis_ami-7.1.0}/tests/test_run_tests.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
|
-
Name:
|
|
3
|
-
Version:
|
|
2
|
+
Name: pyibis-ami
|
|
3
|
+
Version: 7.1.0
|
|
4
4
|
Summary: Facilitates working directly with IBIS-AMI DLLs from the Python command prompt.
|
|
5
5
|
Author-email: David Banas <capn.freako@gmail.com>
|
|
6
6
|
License: BSD
|
|
@@ -16,13 +16,13 @@ Classifier: License :: OSI Approved :: BSD License
|
|
|
16
16
|
Classifier: Operating System :: OS Independent
|
|
17
17
|
Classifier: Programming Language :: Python
|
|
18
18
|
Classifier: Programming Language :: Python :: 3
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.10
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
22
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
23
23
|
Classifier: Topic :: System :: Emulators
|
|
24
24
|
Classifier: Topic :: Utilities
|
|
25
|
-
Requires-Python: <3.13,>=3.
|
|
25
|
+
Requires-Python: <3.13,>=3.10
|
|
26
26
|
Description-Content-Type: text/markdown
|
|
27
27
|
License-File: LICENSE
|
|
28
28
|
Requires-Dist: chaco>=6.0.0
|
|
@@ -21,4 +21,7 @@ parameter
|
|
|
21
21
|
parser
|
|
22
22
|
------
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
Sorry, the code in this module breaks the *Sphinx* ``autodoc`` processor.
|
|
25
|
+
So, we have to exclude it from these docs.
|
|
26
|
+
You'll have to peruse the comments in the code, manually.
|
|
27
|
+
See the ``pyibisami/ami/parser.py`` file.
|
|
@@ -51,6 +51,10 @@ autodoc_mock_imports = [
|
|
|
51
51
|
"enable",
|
|
52
52
|
"matplotlib",
|
|
53
53
|
"numpy",
|
|
54
|
+
"parsec",
|
|
55
|
+
"pyibisami.ami.parser",
|
|
56
|
+
"pyibisami.ibis.parser",
|
|
57
|
+
"scipy",
|
|
54
58
|
"traits",
|
|
55
59
|
"traitsui",
|
|
56
60
|
]
|
|
@@ -80,9 +84,9 @@ author = "David Banas"
|
|
|
80
84
|
# built documents.
|
|
81
85
|
#
|
|
82
86
|
# The short X.Y version.
|
|
83
|
-
version = "
|
|
87
|
+
version = "7.1"
|
|
84
88
|
# The full version, including alpha/beta/rc tags.
|
|
85
|
-
release = "
|
|
89
|
+
release = "7.1.0"
|
|
86
90
|
|
|
87
91
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
|
88
92
|
# for a list of supported languages.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
pyibisami.ibis
|
|
2
|
+
==============
|
|
3
|
+
|
|
4
|
+
IBIS related submodules in the *PyIBIS-AMI* package.
|
|
5
|
+
|
|
6
|
+
file
|
|
7
|
+
----
|
|
8
|
+
|
|
9
|
+
.. automodule:: pyibisami.ibis.file
|
|
10
|
+
|
|
11
|
+
model
|
|
12
|
+
-----
|
|
13
|
+
|
|
14
|
+
.. automodule:: pyibisami.ibis.model
|
|
15
|
+
|
|
16
|
+
parser
|
|
17
|
+
------
|
|
18
|
+
|
|
19
|
+
Sorry, the code in this module breaks the *Sphinx* ``autodoc`` processor.
|
|
20
|
+
So, we have to exclude it from these docs.
|
|
21
|
+
You'll have to peruse the comments in the code, manually.
|
|
22
|
+
See the ``pyibisami/ibis/parser.py`` file.
|
|
@@ -3,13 +3,13 @@ requires = ["setuptools>=61.0"]
|
|
|
3
3
|
build-backend = "setuptools.build_meta"
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
|
-
name = "
|
|
6
|
+
name = "pyibis-ami"
|
|
7
7
|
description = "Facilitates working directly with IBIS-AMI DLLs from the Python command prompt."
|
|
8
|
-
version = "
|
|
8
|
+
version = "7.1.0"
|
|
9
9
|
authors = [ {name = "David Banas", email = "capn.freako@gmail.com"}
|
|
10
10
|
]
|
|
11
11
|
readme = "README.md"
|
|
12
|
-
requires-python = ">=3.
|
|
12
|
+
requires-python = ">=3.10,<3.13"
|
|
13
13
|
license = {text = "BSD"}
|
|
14
14
|
dependencies = [
|
|
15
15
|
"chaco>=6.0.0",
|
|
@@ -31,9 +31,9 @@ classifiers=[
|
|
|
31
31
|
"Operating System :: OS Independent",
|
|
32
32
|
"Programming Language :: Python",
|
|
33
33
|
"Programming Language :: Python :: 3",
|
|
34
|
-
"Programming Language :: Python :: 3.9",
|
|
35
34
|
"Programming Language :: Python :: 3.10",
|
|
36
35
|
"Programming Language :: Python :: 3.11",
|
|
36
|
+
"Programming Language :: Python :: 3.12",
|
|
37
37
|
"Programming Language :: Python :: Implementation :: CPython",
|
|
38
38
|
"Topic :: System :: Emulators",
|
|
39
39
|
"Topic :: Utilities",
|
|
@@ -54,7 +54,7 @@ run-notebook = "pyibisami.tools.run_notebook:main"
|
|
|
54
54
|
where = ["src"]
|
|
55
55
|
|
|
56
56
|
[tool.setuptools.package-data]
|
|
57
|
-
"pyibisami" = ['*.ipynb']
|
|
57
|
+
"pyibisami" = ['*.ipynb']
|
|
58
58
|
|
|
59
59
|
[tool.black]
|
|
60
60
|
line-length = 119
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
|
-
Name:
|
|
3
|
-
Version:
|
|
2
|
+
Name: pyibis-ami
|
|
3
|
+
Version: 7.1.0
|
|
4
4
|
Summary: Facilitates working directly with IBIS-AMI DLLs from the Python command prompt.
|
|
5
5
|
Author-email: David Banas <capn.freako@gmail.com>
|
|
6
6
|
License: BSD
|
|
@@ -16,13 +16,13 @@ Classifier: License :: OSI Approved :: BSD License
|
|
|
16
16
|
Classifier: Operating System :: OS Independent
|
|
17
17
|
Classifier: Programming Language :: Python
|
|
18
18
|
Classifier: Programming Language :: Python :: 3
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.10
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
22
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
23
23
|
Classifier: Topic :: System :: Emulators
|
|
24
24
|
Classifier: Topic :: Utilities
|
|
25
|
-
Requires-Python: <3.13,>=3.
|
|
25
|
+
Requires-Python: <3.13,>=3.10
|
|
26
26
|
Description-Content-Type: text/markdown
|
|
27
27
|
License-File: LICENSE
|
|
28
28
|
Requires-Dist: chaco>=6.0.0
|
|
@@ -26,6 +26,12 @@ src/PyIBIS_AMI.egg-info/dependency_links.txt
|
|
|
26
26
|
src/PyIBIS_AMI.egg-info/entry_points.txt
|
|
27
27
|
src/PyIBIS_AMI.egg-info/requires.txt
|
|
28
28
|
src/PyIBIS_AMI.egg-info/top_level.txt
|
|
29
|
+
src/pyibis_ami.egg-info/PKG-INFO
|
|
30
|
+
src/pyibis_ami.egg-info/SOURCES.txt
|
|
31
|
+
src/pyibis_ami.egg-info/dependency_links.txt
|
|
32
|
+
src/pyibis_ami.egg-info/entry_points.txt
|
|
33
|
+
src/pyibis_ami.egg-info/requires.txt
|
|
34
|
+
src/pyibis_ami.egg-info/top_level.txt
|
|
29
35
|
src/pyibisami/IBIS_AMI_Checker.ipynb
|
|
30
36
|
src/pyibisami/IBIS_AMI_Tester.ipynb
|
|
31
37
|
src/pyibisami/__init__.py
|
|
@@ -488,7 +488,12 @@
|
|
|
488
488
|
"\n",
|
|
489
489
|
" print(f\"Running sweep `{cfg_name}`: {description}...\")\n",
|
|
490
490
|
" fig = plt.figure(figsize=(fig_x, fig_y))\n",
|
|
491
|
-
" for color, (label, (ami_params, sim_params), _) in zip(colors, cfg_list):\n",
|
|
491
|
+
" # for color, (label, (ami_params, sim_params), _) in zip(colors, cfg_list):\n",
|
|
492
|
+
" # Accommodating both new and old style IBIS-AMI model configuration:\n",
|
|
493
|
+
" for color, fields in zip(colors, cfg_list):\n",
|
|
494
|
+
" label = fields[0]\n",
|
|
495
|
+
" ami_params = fields[1][0]\n",
|
|
496
|
+
" sim_params = fields[1][1]\n",
|
|
492
497
|
" func(fig, color, label, ami_params, sim_params)\n",
|
|
493
498
|
"\n",
|
|
494
499
|
" plt.subplot(131)\n",
|
|
@@ -1444,7 +1449,7 @@
|
|
|
1444
1449
|
"name": "python",
|
|
1445
1450
|
"nbconvert_exporter": "python",
|
|
1446
1451
|
"pygments_lexer": "ipython3",
|
|
1447
|
-
"version": "3.10.
|
|
1452
|
+
"version": "3.10.16"
|
|
1448
1453
|
}
|
|
1449
1454
|
},
|
|
1450
1455
|
"nbformat": 4,
|
|
@@ -8,6 +8,10 @@ Original date: February 26, 2016
|
|
|
8
8
|
|
|
9
9
|
Copyright (c) 2016 David Banas; all rights reserved World wide.
|
|
10
10
|
|
|
11
|
+
**Note:** The following use model has been deprecated!
|
|
12
|
+
The preferred approach is to make *executable* model configurators,
|
|
13
|
+
which draw what they need from this module.
|
|
14
|
+
|
|
11
15
|
This script gets called from a makefile, when any of the following need rebuilding:
|
|
12
16
|
|
|
13
17
|
* a C++ source code file
|
|
@@ -28,13 +32,19 @@ The idea here is that the ``*.IBS`` file, the ``*.AMI`` file, the C++ source fil
|
|
|
28
32
|
and the test run configuration files should be configured from a common model
|
|
29
33
|
configuration file, so as to ensure consistency between them all.
|
|
30
34
|
"""
|
|
35
|
+
|
|
31
36
|
import importlib.util
|
|
32
37
|
from datetime import date
|
|
33
38
|
from pathlib import Path
|
|
39
|
+
from typing import Any, NewType
|
|
34
40
|
|
|
35
41
|
import click
|
|
36
42
|
import em
|
|
37
43
|
|
|
44
|
+
ParamDict = NewType("ParamDict", dict[str, Any])
|
|
45
|
+
NamedParamDict = NewType("NamedParamDict", tuple[str, ParamDict])
|
|
46
|
+
TestDefinition = NewType("TestDefinition", tuple[str, NamedParamDict, NamedParamDict, str])
|
|
47
|
+
|
|
38
48
|
param_types = {
|
|
39
49
|
"INT": {"c_type": "int", "ami_type": "Integer", "getter": "get_param_int"},
|
|
40
50
|
"FLOAT": {"c_type": "double", "ami_type": "Float", "getter": "get_param_float"},
|
|
@@ -117,10 +127,26 @@ def print_code(pname, param):
|
|
|
117
127
|
print(" ", "node_names.pop_back();")
|
|
118
128
|
|
|
119
129
|
|
|
120
|
-
def mk_model(
|
|
130
|
+
def mk_model(
|
|
131
|
+
ibis_params: ParamDict,
|
|
132
|
+
ami_params: ParamDict,
|
|
133
|
+
model_name: str,
|
|
134
|
+
description: str,
|
|
135
|
+
out_dir: str = "."
|
|
136
|
+
) -> None:
|
|
121
137
|
"""
|
|
122
138
|
Generate ibis, ami, and cpp files, by merging the
|
|
123
139
|
device specific parameterization with the templates.
|
|
140
|
+
|
|
141
|
+
Args:
|
|
142
|
+
ibis_params: Dictionary of IBIS model parameter definitions.
|
|
143
|
+
ami_params: Dictionary of AMI parameter definitions.
|
|
144
|
+
model_name: Name given to IBIS model.
|
|
145
|
+
description: Model description.
|
|
146
|
+
|
|
147
|
+
Keyword Args:
|
|
148
|
+
out_dir: Directory in which to place created files.
|
|
149
|
+
Default: "."
|
|
124
150
|
"""
|
|
125
151
|
|
|
126
152
|
py_file = (Path(out_dir).resolve() / model_name).with_suffix(".py")
|
|
@@ -135,9 +161,9 @@ def mk_model(ibis_params, ami_params, model_name, description, out_dir="."):
|
|
|
135
161
|
em_file = out_file.with_suffix(".cpp.em")
|
|
136
162
|
|
|
137
163
|
print(f"Building '{out_file}' from '{em_file}'...")
|
|
138
|
-
with open(out_file, "w", encoding="utf-8") as
|
|
164
|
+
with open(out_file, "w", encoding="utf-8") as o_file:
|
|
139
165
|
interpreter = em.Interpreter(
|
|
140
|
-
output=
|
|
166
|
+
output=o_file,
|
|
141
167
|
globals={
|
|
142
168
|
"ami_params": ami_params,
|
|
143
169
|
"ibis_params": ibis_params,
|
|
@@ -156,8 +182,14 @@ def mk_model(ibis_params, ami_params, model_name, description, out_dir="."):
|
|
|
156
182
|
|
|
157
183
|
def ami_config(py_file):
|
|
158
184
|
"""
|
|
159
|
-
Read in
|
|
160
|
-
|
|
185
|
+
Read in ``py_file`` and cpp.em files, then generate: ibis, ami, and cpp files.
|
|
186
|
+
|
|
187
|
+
Args:
|
|
188
|
+
py_file: name of model configuration file (<stem>.py)
|
|
189
|
+
|
|
190
|
+
Notes:
|
|
191
|
+
1. This function is deprecated! Instead, make your model configurator executable
|
|
192
|
+
and import what you need from this module. This is much cleaner.
|
|
161
193
|
"""
|
|
162
194
|
|
|
163
195
|
file_base_name = Path(py_file).stem
|
|
@@ -171,15 +203,16 @@ def ami_config(py_file):
|
|
|
171
203
|
mk_model(cfg.ibis_params, cfg.ami_params, cfg.kFileBaseName, cfg.kDescription, out_dir=Path(py_file).parent)
|
|
172
204
|
|
|
173
205
|
|
|
174
|
-
def mk_combs(dict_items):
|
|
175
|
-
"""
|
|
206
|
+
def mk_combs(dict_items: list[tuple[str, Any]]) -> list[list[tuple[str, Any]]]:
|
|
207
|
+
"""
|
|
208
|
+
Make all combinations possible from a list of dictionary items.
|
|
176
209
|
|
|
177
210
|
Args:
|
|
178
|
-
dict_items
|
|
211
|
+
dict_items: List of dictionary key/value pairs.
|
|
179
212
|
The values are lists.
|
|
180
213
|
|
|
181
214
|
Return:
|
|
182
|
-
|
|
215
|
+
List of all possible combinations of key values.
|
|
183
216
|
"""
|
|
184
217
|
if not dict_items:
|
|
185
218
|
return [
|
|
@@ -191,8 +224,22 @@ def mk_combs(dict_items):
|
|
|
191
224
|
return [[kval] + rest for kval in kvals for rest in mk_combs(tail)]
|
|
192
225
|
|
|
193
226
|
|
|
194
|
-
def mk_tests(
|
|
195
|
-
|
|
227
|
+
def mk_tests( # pylint: disable=too-many-locals
|
|
228
|
+
test_defs: dict[str, TestDefinition],
|
|
229
|
+
file_base_name: str,
|
|
230
|
+
test_dir: str = "test_runs"
|
|
231
|
+
) -> None:
|
|
232
|
+
"""
|
|
233
|
+
Make the test run configuration files.
|
|
234
|
+
|
|
235
|
+
Args:
|
|
236
|
+
test_defs: Dictionary of test sweep definitions.
|
|
237
|
+
file_base_name: Stem name for test run definition files.
|
|
238
|
+
|
|
239
|
+
Keyword Args:
|
|
240
|
+
test_dir: Directory in which to place the created test run definition files.
|
|
241
|
+
Default: "test_runs/"
|
|
242
|
+
"""
|
|
196
243
|
|
|
197
244
|
pname = Path(test_dir).resolve()
|
|
198
245
|
pname.mkdir(exist_ok=True)
|
|
@@ -204,18 +251,11 @@ def mk_tests(test_defs, file_base_name, test_dir="test_runs"): # pylint: disabl
|
|
|
204
251
|
sim_str, sim_dict = sim_defs
|
|
205
252
|
with open((pname / fname).with_suffix(".run"), "w", encoding="utf-8") as f:
|
|
206
253
|
f.write(desc + "\n")
|
|
207
|
-
for ami_comb in mk_combs(ami_dict.items()):
|
|
208
|
-
for sim_comb in mk_combs(sim_dict.items()):
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
f.write(f"\n('{ami_str.format(pdict=pdict)}_{sim_str.format(pdict=pdict)}', \\\n")
|
|
213
|
-
except Exception as err:
|
|
214
|
-
print(f"{err}")
|
|
215
|
-
print(f"ami_str: {ami_str}")
|
|
216
|
-
print(f"sim_str: {sim_str}")
|
|
217
|
-
print(f"pdict: {pdict}")
|
|
218
|
-
raise
|
|
254
|
+
for ami_comb in mk_combs(list(ami_dict.items())):
|
|
255
|
+
for sim_comb in mk_combs(list(sim_dict.items())):
|
|
256
|
+
pdict = dict(ami_comb)
|
|
257
|
+
pdict.update(dict(sim_comb))
|
|
258
|
+
f.write(f"\n('{ami_str.format(pdict=pdict)}_{sim_str.format(pdict=pdict)}', \\\n")
|
|
219
259
|
f.write(f" ({{'root_name': '{file_base_name}', \\\n")
|
|
220
260
|
for k, v in ami_comb:
|
|
221
261
|
f.write(f" '{k}': {v}, \\\n")
|
|
@@ -233,22 +273,22 @@ def mk_tests(test_defs, file_base_name, test_dir="test_runs"): # pylint: disabl
|
|
|
233
273
|
f.write(")\n")
|
|
234
274
|
|
|
235
275
|
|
|
236
|
-
# NOTE: The following is deprecated! Instead, make your model configurator executable
|
|
237
|
-
# and import what you need from this module. This is much cleaner.
|
|
238
276
|
@click.command(context_settings={"help_option_names": ["-h", "--help"]})
|
|
239
277
|
@click.argument("py_file", type=click.Path(exists=True, resolve_path=True))
|
|
240
|
-
# @click.option(
|
|
241
|
-
# "-d", "--test_dir", show_default=True, default="test_runs", help="Output directory for test run generation."
|
|
242
|
-
# )
|
|
243
278
|
@click.version_option()
|
|
244
279
|
def main(py_file):
|
|
245
|
-
"""
|
|
246
|
-
|
|
280
|
+
"""
|
|
281
|
+
Configure IBIS-AMI model C++ source code, IBIS model, and AMI file.
|
|
247
282
|
This command generates three files based off the input config file.
|
|
248
283
|
It expects a .cpp.em file to be located in the same directory so that it can
|
|
249
284
|
generate a cpp file from the config file and template file.
|
|
250
285
|
|
|
286
|
+
Args:
|
|
251
287
|
py_file: name of model configuration file (*.py)
|
|
288
|
+
|
|
289
|
+
Notes:
|
|
290
|
+
1. This command is deprecated! Instead, make your model configurator executable
|
|
291
|
+
and import what you need from this module. This is much cleaner.
|
|
252
292
|
"""
|
|
253
293
|
ami_config(py_file)
|
|
254
294
|
|
|
@@ -16,11 +16,12 @@ from typing import Any, Optional
|
|
|
16
16
|
import numpy as np
|
|
17
17
|
from numpy.random import default_rng
|
|
18
18
|
|
|
19
|
-
from pyibisami.common import
|
|
19
|
+
from pyibisami.common import Rvec, deconv_same
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
def loadWave(filename):
|
|
23
|
-
"""
|
|
22
|
+
def loadWave(filename: str) -> tuple[Rvec, Rvec]:
|
|
23
|
+
"""
|
|
24
|
+
Load a waveform file.
|
|
24
25
|
|
|
25
26
|
The file should consist of any number of lines, where each line
|
|
26
27
|
contains, first, a time value and, second, a voltage value.
|
|
@@ -30,11 +31,10 @@ def loadWave(filename):
|
|
|
30
31
|
saved from *CosmosScope*.
|
|
31
32
|
|
|
32
33
|
Args:
|
|
33
|
-
filename
|
|
34
|
+
filename: Name of waveform file to read in.
|
|
34
35
|
|
|
35
36
|
Returns:
|
|
36
|
-
|
|
37
|
-
and voltage values, respectively.
|
|
37
|
+
A pair of *NumPy* arrays containing the time and voltage values, respectively.
|
|
38
38
|
"""
|
|
39
39
|
|
|
40
40
|
with open(filename, "r", encoding="utf-8") as theFile:
|
|
@@ -48,16 +48,17 @@ def loadWave(filename):
|
|
|
48
48
|
return (np.array(time), np.array(voltage))
|
|
49
49
|
|
|
50
50
|
|
|
51
|
-
def interpFile(filename, sample_per):
|
|
52
|
-
"""
|
|
51
|
+
def interpFile(filename: str, sample_per: float) -> Rvec:
|
|
52
|
+
"""
|
|
53
|
+
Read in a waveform from a file, and convert it to the given sample rate,
|
|
53
54
|
using linear interpolation.
|
|
54
55
|
|
|
55
56
|
Args:
|
|
56
|
-
filename
|
|
57
|
-
sample_per
|
|
57
|
+
filename: Name of waveform file to read in.
|
|
58
|
+
sample_per: New sample interval, in seconds.
|
|
58
59
|
|
|
59
60
|
Returns:
|
|
60
|
-
|
|
61
|
+
A *NumPy* array containing the resampled waveform.
|
|
61
62
|
"""
|
|
62
63
|
|
|
63
64
|
impulse = loadWave(filename)
|
|
@@ -106,9 +107,9 @@ class AMIModelInitializer:
|
|
|
106
107
|
def __init__(self, ami_params: dict, info_params: Optional[dict] = None, **optional_args):
|
|
107
108
|
"""
|
|
108
109
|
Constructor accepts a mandatory dictionary containing the AMI
|
|
109
|
-
parameters, as well as optional
|
|
110
|
-
|
|
111
|
-
data structures.
|
|
110
|
+
parameters, as well as optional information parameter dictionary
|
|
111
|
+
and initialization data overrides, and validates them, before
|
|
112
|
+
using them to update the local initialization data structures.
|
|
112
113
|
|
|
113
114
|
Valid names of optional initialization data overrides:
|
|
114
115
|
|
|
@@ -219,7 +220,7 @@ class AMIModel: # pylint: disable=too-many-instance-attributes
|
|
|
219
220
|
|
|
220
221
|
Notes:
|
|
221
222
|
1. Makes the calling of ``AMI_Close()`` automagic,
|
|
222
|
-
|
|
223
|
+
by calling it from the destructor.
|
|
223
224
|
"""
|
|
224
225
|
|
|
225
226
|
def __init__(self, filename: str):
|
|
@@ -262,10 +263,10 @@ class AMIModel: # pylint: disable=too-many-instance-attributes
|
|
|
262
263
|
init_object: The model initialization data.
|
|
263
264
|
|
|
264
265
|
Notes:
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
266
|
+
1. Takes an instance of ``AMIModelInitializer`` as its only argument.
|
|
267
|
+
This allows model initialization data to be constructed once,
|
|
268
|
+
and modified incrementally in between multiple calls of
|
|
269
|
+
``initialize``. This is useful for *PyLab* command prompt testing.
|
|
269
270
|
|
|
270
271
|
ToDo:
|
|
271
272
|
1. Allow for non-integral number of samples per unit interval.
|
|
@@ -375,8 +376,7 @@ class AMIModel: # pylint: disable=too-many-instance-attributes
|
|
|
375
376
|
|
|
376
377
|
def getWave(self, wave: Rvec, bits_per_call: int = 0) -> tuple[Rvec, Rvec, list[str]]: # noqa: F405
|
|
377
378
|
"""
|
|
378
|
-
Performs time domain processing of input waveform, using the
|
|
379
|
-
``AMI_GetWave()`` function.
|
|
379
|
+
Performs time domain processing of input waveform, using the ``AMI_GetWave()`` function.
|
|
380
380
|
|
|
381
381
|
Args:
|
|
382
382
|
wave: Waveform to be processed.
|
|
@@ -386,14 +386,15 @@ class AMIModel: # pylint: disable=too-many-instance-attributes
|
|
|
386
386
|
Default: 0 (Means "Use existing value.")
|
|
387
387
|
|
|
388
388
|
Returns:
|
|
389
|
-
|
|
389
|
+
A tuple containing
|
|
390
|
+
|
|
390
391
|
- the processed waveform,
|
|
391
392
|
- the recovered slicer sampling instants, and
|
|
392
393
|
- the list of output parameter strings received from each call to ``AMI_GetWave()``.
|
|
393
394
|
|
|
394
395
|
Notes:
|
|
395
396
|
1. The returned clock times are given in "pre-edge-aligned" fashion,
|
|
396
|
-
|
|
397
|
+
which means their values are: sampling instant - ui/2.
|
|
397
398
|
"""
|
|
398
399
|
|
|
399
400
|
if bits_per_call:
|
|
@@ -432,7 +433,6 @@ class AMIModel: # pylint: disable=too-many-instance-attributes
|
|
|
432
433
|
def get_responses( # pylint: disable=too-many-locals
|
|
433
434
|
self,
|
|
434
435
|
bits_per_call: int = 0,
|
|
435
|
-
# bit_gen: Optional[Iterator[int]] = None,
|
|
436
436
|
pad_bits: int = 10,
|
|
437
437
|
nbits: int = 200,
|
|
438
438
|
calc_getw: bool = True
|
|
@@ -443,9 +443,6 @@ class AMIModel: # pylint: disable=too-many-instance-attributes
|
|
|
443
443
|
Keyword Args:
|
|
444
444
|
bits_per_call: Number of bits to include in the input to `GetWave()`.
|
|
445
445
|
Default: 0 (Means "use model's existing value".)
|
|
446
|
-
bit_gen: The bit generator to use for `GetWave()` input data generation.
|
|
447
|
-
Should produce integers from the set: {0,1}.
|
|
448
|
-
Default: None (Means "use randint(2)".)
|
|
449
446
|
pad_bits: Number of bits to pad leading edge with when calling `GetWave()`,
|
|
450
447
|
to protect from initial garbage in `GetWave()` output.
|
|
451
448
|
Default: 10
|
|
@@ -455,19 +452,22 @@ class AMIModel: # pylint: disable=too-many-instance-attributes
|
|
|
455
452
|
Default: True
|
|
456
453
|
|
|
457
454
|
Returns:
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
"
|
|
461
|
-
"
|
|
462
|
-
"
|
|
455
|
+
Dictionary containing the responses under the following keys
|
|
456
|
+
|
|
457
|
+
- "imp_resp_init": The model's impulse response, from its `AMI_Init()` function (V/sample).
|
|
458
|
+
- "out_resp_init": `imp_resp_init` convolved with the channel.
|
|
459
|
+
- "imp_resp_getw": The model's impulse response, from its `AMI_GetWave()` function (V/sample).
|
|
460
|
+
- "out_resp_getw": `imp_resp_getw` convolved with the channel.
|
|
463
461
|
|
|
464
462
|
Notes:
|
|
465
463
|
1. If either set of keys (i.e. - "..._init" or "..._getw")
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
464
|
+
is missing from the returned dictionary, it means that
|
|
465
|
+
that mode of operation (`AMI_Init()` or `AMI_GetWave()`)
|
|
466
|
+
was not available in the given model.
|
|
467
|
+
|
|
469
468
|
2. An empty dictionary implies that neither the `Init_Returns_Impulse`
|
|
470
|
-
|
|
469
|
+
nor the `GetWave_Exists` AMI reserved parameter was True.
|
|
470
|
+
|
|
471
471
|
3. Note that impulse responses are returned with units: (V/sample), not (V/s).
|
|
472
472
|
|
|
473
473
|
ToDo:
|
|
@@ -499,7 +499,6 @@ class AMIModel: # pylint: disable=too-many-instance-attributes
|
|
|
499
499
|
h_model = deconv_same(out_imp, chnl_imp) # noqa: F405
|
|
500
500
|
rslt["imp_resp_init"] = np.roll(h_model, -len(h_model) // 2 + 3 * nspui)
|
|
501
501
|
|
|
502
|
-
# h_init = np.roll(self.initOut, pad_samps) * ts
|
|
503
502
|
h_init = np.roll(out_imp, pad_samps)
|
|
504
503
|
s_init = np.cumsum(h_init) # Step response.
|
|
505
504
|
p_init = s_init - np.pad(s_init[:-nspui], (nspui, 0), mode='constant', constant_values=0)
|
|
@@ -525,15 +524,8 @@ class AMIModel: # pylint: disable=too-many-instance-attributes
|
|
|
525
524
|
# Match the d.c. offset of Init() output, for easier comparison of Init() & GetWave() outputs.
|
|
526
525
|
s_getw -= s_getw[pad_samps - 1]
|
|
527
526
|
p_getw = s_getw - np.pad(s_getw[:-nspui], (nspui, 0), mode='constant', constant_values=0)
|
|
528
|
-
# h_getw = diff(s_getw[pad_samps-1:])[:len(t)]
|
|
529
527
|
_s = s_getw[pad_samps:]
|
|
530
|
-
|
|
531
|
-
h_getw = np.insert(np.diff(_s), 0, _s[0])
|
|
532
|
-
except Exception:
|
|
533
|
-
print(f"_s: {_s}")
|
|
534
|
-
print(f"len(s_getw): {len(s_getw)}")
|
|
535
|
-
print(f"pad_samps: {pad_samps}")
|
|
536
|
-
raise
|
|
528
|
+
h_getw = np.insert(np.diff(_s), 0, _s[0])
|
|
537
529
|
len_hgw = len(h_getw)
|
|
538
530
|
if len_hgw > len_h:
|
|
539
531
|
h_getw = h_getw[:len_h]
|
|
@@ -136,8 +136,6 @@ class AMIParameter: # pylint: disable=too-many-instance-attributes,too-few-publ
|
|
|
136
136
|
"Process *Format* tag."
|
|
137
137
|
|
|
138
138
|
form = values[0]
|
|
139
|
-
# if(not form in ['Value', 'Range', 'List']):
|
|
140
|
-
# raise AMIParamError ("Unrecognized format value: '{}'.".format(form))
|
|
141
139
|
if len(values) < 2:
|
|
142
140
|
raise AMIParamError(f"No values provided for: '{form}'.")
|
|
143
141
|
self._format = form
|
|
@@ -259,13 +257,12 @@ class AMIParameter: # pylint: disable=too-many-instance-attributes,too-few-publ
|
|
|
259
257
|
"""
|
|
260
258
|
Args:
|
|
261
259
|
name (str): The name of the AMI parameter being created.
|
|
262
|
-
tags ([(str, [a])]): A list of pairs, each containing
|
|
260
|
+
tags ([(str, [a])]): A list of pairs, each containing
|
|
263
261
|
|
|
264
262
|
- a parameter definition tag name
|
|
265
|
-
(Must be one of the keys from the
|
|
266
|
-
'_param_def_tag_procs' dictionary.)
|
|
267
|
-
- a list of values to be associated with that tag.
|
|
263
|
+
(Must be one of the keys from the '_param_def_tag_procs' dictionary.)
|
|
268
264
|
|
|
265
|
+
- a list of values to be associated with that tag.
|
|
269
266
|
"""
|
|
270
267
|
# Initialization
|
|
271
268
|
self._usage = None
|
|
@@ -343,7 +340,7 @@ class AMIParameter: # pylint: disable=too-many-instance-attributes,too-few-publ
|
|
|
343
340
|
raise AMIParamError(f"Illegal type, '{param_type}', for use with Range.\n")
|
|
344
341
|
if len(vals) < 3:
|
|
345
342
|
raise AMIParamError(f"Insufficient number of values, {len(vals)}, provided for Range.\n")
|
|
346
|
-
if param_type in ("Float", "UI"):
|
|
343
|
+
if param_type in ("Float", "UI", "Tap"):
|
|
347
344
|
try:
|
|
348
345
|
temp_vals = list(map(float, vals[:3]))
|
|
349
346
|
except (ValueError, TypeError) as exc:
|