pyibis-ami 7.2.2__py3-none-any.whl → 7.2.4__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.
@@ -1,9 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyibis-ami
3
- Version: 7.2.2
3
+ Version: 7.2.4
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
- License-Expression: BSD-3-Clause
7
6
  Project-URL: Documentation, https://pyibis-ami.readthedocs.io/en/latest/
8
7
  Project-URL: Wiki, https://github.com/capn-freako/PyAMI/wiki
9
8
  Project-URL: GitHub, https://github.com/capn-freako/PyAMI
@@ -1,4 +1,4 @@
1
- pyibis_ami-7.2.2.dist-info/licenses/LICENSE,sha256=iUtKhGdFJ8yC7IpQuUiwjveBUd6Uxk4tZ68yKfStPrM,1293
1
+ pyibis_ami-7.2.4.dist-info/licenses/LICENSE,sha256=iUtKhGdFJ8yC7IpQuUiwjveBUd6Uxk4tZ68yKfStPrM,1293
2
2
  pyibisami/IBIS_AMI_Checker.ipynb,sha256=3LwppSqwVuPD85kVKdXOdtXdDKr9ba8fib1_IJ1jjMc,1390165
3
3
  pyibisami/IBIS_AMI_Tester.ipynb,sha256=ywuwhAChAZXmk_Q1fkmS8scN6ZuV6gLteG_KfQa8NQ8,784499
4
4
  pyibisami/__init__.py,sha256=DxWwWtfpqEKhGY9tdQqjjnEYR7tTC7OyPSfnKH-g0Qs,668
@@ -7,21 +7,21 @@ pyibisami/common.py,sha256=T3FMCHYx10f0-16U092l_xDHaaJmkIuZ-FiHJ0mnM6A,1182
7
7
  pyibisami/ami/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  pyibisami/ami/config.py,sha256=fXfROquueeUX5larasZ8ia_FuvfAyuvmyW67fBOQA5I,10804
9
9
  pyibisami/ami/generic.ami.em,sha256=EZpswZid-iRDDBnUuR3lL0fd1M6o6SCaoJKGeGALwZI,499
10
- pyibisami/ami/generic.ibs.em,sha256=7kwwe1vSoV6p-ZCMbrUGniwTs1hLpDOBa6TfxQJbX7Q,5791
11
- pyibisami/ami/model.py,sha256=sZuAWDTHafok89PEOlnAn1qBxHAfTnxgGvFHrCr-Bhs,24914
12
- pyibisami/ami/parameter.py,sha256=Fk_qibbVGxK6hifYAzhyp-zgMUvOewrv-CjkiaCYZbM,10992
13
- pyibisami/ami/parser.py,sha256=EXa57w-4KA77wZAvyBf4mhEdpa2s92zG0nqAP8Xg_kU,25681
14
- pyibisami/ami/reserved_parameter_names.py,sha256=hOIDREU_TbXaZHbGQaBv98CJB_8z2mzPiBlLa1_IjIQ,1781
10
+ pyibisami/ami/generic.ibs.em,sha256=Zz1kW6_nkMVFKBUa-Rfz5qFy7qmc3I6NDMYSK1NQd9M,7677
11
+ pyibisami/ami/model.py,sha256=5ibgvCZ2H-Xf8AWQwHJQPIsevcesHRWWHJTeI4vrFuE,24982
12
+ pyibisami/ami/parameter.py,sha256=3io5qHvWPUzCo8dqM-AzOusjdsJbMgNT3we4qD68adE,11365
13
+ pyibisami/ami/parser.py,sha256=X0vEZAU6jisG8agDTj5YksnYBXcq0nhHh97qslb5vU8,25872
14
+ pyibisami/ami/reserved_parameter_names.py,sha256=aPBBVqmSQW3ysyNlOtn8Z1P8dt8qNTrXnJW97Pfm5HE,1786
15
15
  pyibisami/ibis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  pyibisami/ibis/file.py,sha256=U1T0P-HveRgK5T7csNIJHV9ddi40PqDdOnBnoQcKimI,12064
17
17
  pyibisami/ibis/model.py,sha256=DaAn35OhWkPkIuTQMwNIHZ5f1-s4Xb0H21UMAKFBE4I,16349
18
18
  pyibisami/ibis/parser.py,sha256=sADLkQgbIp0oLNIUCLlNN5FvHnM4-Q5gQSH1_dYpJhU,13611
19
19
  pyibisami/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
- pyibisami/tools/run_notebook.py,sha256=vVDccARwVnpu1EH50G8gKatt6pdPFqsNycxk-LsZzK8,5440
20
+ pyibisami/tools/run_notebook.py,sha256=p4FRdvEGWwjylHjgoeCXrbK2viqo_466Jfm3FG4UlCM,5450
21
21
  pyibisami/tools/run_tests.py,sha256=Kaopc0a3XxSuatRtPgvgT5JukIB-My4Gfxwn5ASEZh4,9344
22
22
  pyibisami/tools/test_results.xsl,sha256=RQv9oiu6XQ8Q_swO0ak1FGdL28h3ucJr_FAWsgD001I,1662
23
- pyibis_ami-7.2.2.dist-info/METADATA,sha256=AZfdnTFMXiRyb6JDp6Xk8ug2huFqp2PJZ7c2VamNOz4,5273
24
- pyibis_ami-7.2.2.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
25
- pyibis_ami-7.2.2.dist-info/entry_points.txt,sha256=x2QobJi2Pu25LgUeWg60XZzOWH8j2R60oWGN-1Z7uVA,149
26
- pyibis_ami-7.2.2.dist-info/top_level.txt,sha256=k2KfR4t4tJ47HrnzvSh77w9N2Xyz8_uUusJLbqXK0g4,10
27
- pyibis_ami-7.2.2.dist-info/RECORD,,
23
+ pyibis_ami-7.2.4.dist-info/METADATA,sha256=8rccRiJ__e7fWX0a5WyhVHT1YCS63b8C5_bBHBypShM,5240
24
+ pyibis_ami-7.2.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
25
+ pyibis_ami-7.2.4.dist-info/entry_points.txt,sha256=x2QobJi2Pu25LgUeWg60XZzOWH8j2R60oWGN-1Z7uVA,149
26
+ pyibis_ami-7.2.4.dist-info/top_level.txt,sha256=k2KfR4t4tJ47HrnzvSh77w9N2Xyz8_uUusJLbqXK0g4,10
27
+ pyibis_ami-7.2.4.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (78.1.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -48,6 +48,7 @@ OF THIS MODEL, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
48
48
  This IBIS file was generated using the template file: "generic.ibs.em".
49
49
 
50
50
  [Copyright] @(copyright)
51
+
51
52
  [Component] @(component)
52
53
  [Manufacturer] @(manufacturer)
53
54
 
@@ -60,80 +61,116 @@ print("C_pkg %5.2fp %5.2fp %5.2fp" % (c_pkg[0] * 1.e12, c_pkg[1] * 1.e12,
60
61
  }
61
62
 
62
63
  [Pin] signal_name model_name R_pin L_pin C_pin
63
- 1p Tx_1_P @(model_name)
64
- 1n Tx_1_N @(model_name)
65
- 2p Tx_2_P @(model_name)
66
- 2n Tx_2_N @(model_name)
67
- 3p Tx_3_P @(model_name)
68
- 3n Tx_3_N @(model_name)
64
+ @{
65
+ if model_type.startswith("Output") or model_type == "Repeater":
66
+ for n in range(3):
67
+ print(f"{n + 1}p Tx_{n + 1}_P {model_name}_Tx")
68
+ print(f"{n + 1}n Tx_{n + 1}_N {model_name}_Tx")
69
+ if model_type.startswith("Input") or model_type == "Repeater":
70
+ for n in range(3):
71
+ print(f"{n + 4}p Rx_{n + 4}_P {model_name}_Rx")
72
+ print(f"{n + 4}n Rx_{n + 4}_N {model_name}_Rx")
73
+ }
69
74
 
70
75
  [Diff_Pin] inv_pin vdiff tdelay_typ tdelay_min tdelay_max
71
- 1p 1n 0.1V NA NA NA
72
- 2p 2n 0.1V NA NA NA
73
- 3p 3n 0.1V NA NA NA
74
-
75
- [Model] @(model_name)
76
- Model_type @(model_type)
77
-
78
76
  @{
79
- print("C_comp %5.2fp %5.2fp %5.2fp" % (c_comp[0] * 1.e12, c_comp[1] * 1.e12, c_comp[2] * 1.e12))
80
- if(model_type == 'Output'):
81
- print("Cref = {}".format(c_ref))
82
- print("Vref = {}".format(v_ref))
83
- print("Vmeas = {}".format(v_meas))
84
- print("Rref = {}".format(r_ref))
85
- else:
86
- print("Vinl = {}".format(voltage_range[0] / 2. - 0.025))
87
- print("Vinh = {}".format(voltage_range[0] / 2. + 0.025))
77
+ if model_type.startswith("Output") or model_type == "Repeater":
78
+ for n in range(3):
79
+ print(f"{n + 1}p {n + 1}n 0.1V NA NA NA")
80
+ if model_type.startswith("Input") or model_type == "Repeater":
81
+ for n in range(3):
82
+ print(f"{n + 4}p {n + 4}n 0.1V NA NA NA")
88
83
  }
89
84
 
90
- [Algorithmic Model]
91
- Executable linux_gcc4.1.2_32 @(model_name)_x86.so @(model_name).ami
92
- Executable linux_gcc4.1.2_64 @(model_name)_x86_amd64.so @(model_name).ami
93
- Executable Windows_VisualStudio_32 @(model_name)_x86.dll @(model_name).ami
94
- Executable Windows_VisualStudio_64 @(model_name)_x86_amd64.dll @(model_name).ami
95
- [End Algorithmic Model]
96
-
97
85
  @{
98
- print("[Temperature_Range] %5.1f %5.1f %5.1f" % (temperature_range[0], temperature_range[1], temperature_range[2]))
99
- print("[Voltage_Range] %5.2f %5.2f %5.2f" % (voltage_range[0], voltage_range[1], voltage_range[2]))
86
+ if model_type == "Repeater":
87
+ print("[Repeater Pin] tx_non_inv_pin")
88
+ for n in range(3):
89
+ print(f" {n + 4}p {n + 1}p")
100
90
  }
101
91
 
102
92
  @{
103
- if(model_type == 'Output'):
93
+ if model_type.startswith("Output") or model_type == "Repeater":
94
+ print(f"[Model] {model_name}_Tx")
95
+ print("Model_type Output")
96
+ print(f"C_comp {c_comp[0]*1.e12:5.2f}p {c_comp[1]*1.e12:5.2f}p {c_comp[2]*1.e12:5.2f}p")
97
+ print(f"Cref = {c_ref}")
98
+ print(f"Vref = {v_ref}")
99
+ print(f"Vmeas = {v_meas}")
100
+ print(f"Rref = {r_ref}")
101
+ print("")
102
+ print("[Algorithmic Model]")
103
+ print(f"Executable linux_gcc4.1.2_32 {model_name}_tx_x86.so {model_name}_tx.ami")
104
+ print(f"Executable linux_gcc4.1.2_64 {model_name}_tx_x86_amd64.so {model_name}_tx.ami")
105
+ print(f"Executable Windows_VisualStudio_32 {model_name}_tx_x86.dll {model_name}_tx.ami")
106
+ print(f"Executable Windows_VisualStudio_64 {model_name}_tx_x86_amd64.dll {model_name}_tx.ami")
107
+ print("[End Algorithmic Model]")
108
+ print("")
104
109
  print("[Pulldown]")
105
- print("%-5.2f %-10.3e %-10.3e %-10.3e" % (-1. * voltage_range[0], -10., -10., -10.))
110
+ print(f"{-1.*voltage_range[0]:-5.2f} -10.0 -10.0 -10.0")
106
111
  for v in [k * voltage_range[0] for k in range(2)]:
107
112
  i = v / array(impedance)
108
- print("%-5.2f %-10.3e %-10.3e %-10.3e" % (v, i[0], i[1], i[2]))
109
- print("%-5.2f %-10.3e %-10.3e %-10.3e" % (2. * voltage_range[0], 10., 10., 10.))
113
+ print(f"{v:-5.2f} {i[0]:-10.3e} {i[1]:-10.3e} {i[2]:-10.3e}")
114
+ print(f"{2.*voltage_range[0]:-5.2f} 10.0 10.0 10.0")
110
115
 
111
116
  print("[Pullup]")
112
- print("%-5.2f %-10.3e %-10.3e %-10.3e" % (-1. * voltage_range[0], 10., 10., 10.))
117
+ print(f"{-1.*voltage_range[0]:-5.2f} 10.0 10.0 10.0")
113
118
  for v in [k * voltage_range[0] for k in range(2)]:
114
119
  i = -1. * v / array(impedance)
115
- print("%-5.2f %-10.3e %-10.3e %-10.3e" % (v, i[0], i[1], i[2]))
116
- print("%-5.2f %-10.3e %-10.3e %-10.3e" % (2. * voltage_range[0], -10., -10., -10.))
120
+ print(f"{v:-5.2f} {i[0]:-10.3e} {i[1]:-10.3e} {i[2]:-10.3e}")
121
+ print(f"{2.*voltage_range[0]:-5.2f} -10.0 -10.0 -10.0")
117
122
 
118
123
  print("[Ramp]")
119
124
  dv = 0.6 * array([v * 50. / (50. + z) for (v, z) in zip(voltage_range, impedance)])
120
125
  dt = 1.e12 * dv / array(slew_rate)
121
- print("dV/dt_r %5.3f/%5.2fp %5.3f/%5.2fp %5.3f/%5.2fp" % (dv[0], dt[0], dv[1], dt[1], dv[2], dt[2]))
122
- print("dV/dt_f %5.3f/%5.2fp %5.3f/%5.2fp %5.3f/%5.2fp" % (dv[0], dt[0], dv[1], dt[1], dv[2], dt[2]))
126
+ print(f"dV/dt_r {dv[0]:5.3f}/{dt[0]:05.2f}p {dv[1]:5.3f}/{dt[1]:05.2f}p {dv[2]:5.3f}/{dt[2]:05.2f}p")
127
+ print(f"dV/dt_f {dv[0]:5.3f}/{dt[0]:05.2f}p {dv[1]:5.3f}/{dt[1]:05.2f}p {dv[2]:5.3f}/{dt[2]:05.2f}p")
128
+ print("")
129
+ print("[GND Clamp]")
130
+ print(f"{-1.*voltage_range[0]:-5.2f} 0.0 0.0 0.0")
131
+ for v in [k * voltage_range[0] for k in range(3)]:
132
+ i = v / array(impedance) / 2
133
+ print(f"{v:-5.2f} 0.0 0.0 0.0")
134
+ print("")
135
+ print("[Power Clamp]")
136
+ print(f"{-1.*voltage_range[0]:-5.2f} 0.0 0.0 0.0")
137
+ for v in [k * voltage_range[0] for k in range(3)]:
138
+ i = v / array(impedance) / 2
139
+ print(f"{v:-5.2f} 0.0 0.0 0.0")
140
+ print("")
141
+ print(f"[Temperature_Range] {temperature_range[0]:5.1f} {temperature_range[1]:5.1f} {temperature_range[2]:5.1f}")
142
+ print(f"[Voltage_Range] {voltage_range[0]:5.2f} {voltage_range[1]:5.2f} {voltage_range[2]:5.2f}")
143
+ }
144
+
145
+ @{
146
+ if model_type.startswith("Input") or model_type == "Repeater":
147
+ print(f"[Model] {model_name}_Rx")
148
+ print("Model_type Input")
149
+ print(f"C_comp {c_comp[0]*1.e12:5.2f}p {c_comp[1]*1.e12:5.2f}p {c_comp[2]*1.e12:5.2f}p")
150
+ print(f"Vinl = {voltage_range[0]/2.-0.025}")
151
+ print(f"Vinh = {voltage_range[0]/2.+0.025}")
152
+ print("")
153
+ print("[Algorithmic Model]")
154
+ print(f"Executable linux_gcc4.1.2_32 {model_name}_rx_x86.so {model_name}_rx.ami")
155
+ print(f"Executable linux_gcc4.1.2_64 {model_name}_rx_x86_amd64.so {model_name}_rx.ami")
156
+ print(f"Executable Windows_VisualStudio_32 {model_name}_rx_x86.dll {model_name}_rx.ami")
157
+ print(f"Executable Windows_VisualStudio_64 {model_name}_rx_x86_amd64.dll {model_name}_rx.ami")
158
+ print("[End Algorithmic Model]")
123
159
  print("")
124
- else:
125
160
  print("[GND Clamp]")
126
- print("%-5.2f %-10.3e %-10.3e %-10.3e" % (-1. * voltage_range[0], -10., -10., -10.))
161
+ print(f"{-1.*voltage_range[0]:-5.2f} -10.0 -10.0 -10.0")
127
162
  for v in [k * voltage_range[0] for k in range(3)]:
128
163
  i = v / array(impedance) / 2
129
- print("%-5.2f %-10.3e %-10.3e %-10.3e" % (v, i[0], i[1], i[2]))
164
+ print(f"{v:-5.2f} {i[0]:-10.3e} {i[1]:-10.3e} {i[2]:-10.3e}")
130
165
  print("")
131
166
  print("[Power Clamp]")
132
- print("%-5.2f %-10.3e %-10.3e %-10.3e" % (-1. * voltage_range[0], 10., 10., 10.))
167
+ print(f"{-1.*voltage_range[0]:-5.2f} 10.0 10.0 10.0")
133
168
  for v in [k * voltage_range[0] for k in range(3)]:
134
169
  i = v / array(impedance) / 2
135
- print("%-5.2f %-10.3e %-10.3e %-10.3e" % (v, -i[0], -i[1], -i[2]))
170
+ print(f"{v:-5.2f} {-i[0]:-10.3e} {-i[1]:-10.3e} {-i[2]:-10.3e}")
136
171
  print("")
172
+ print(f"[Temperature_Range] {temperature_range[0]:5.1f} {temperature_range[1]:5.1f} {temperature_range[2]:5.1f}")
173
+ print(f"[Voltage_Range] {voltage_range[0]:5.2f} {voltage_range[1]:5.2f} {voltage_range[2]:5.2f}")
137
174
  }
138
175
 
139
176
  [END]
pyibisami/ami/model.py CHANGED
@@ -161,10 +161,9 @@ class AMIModelInitializer:
161
161
 
162
162
  def __str__(self):
163
163
  return "\n\t".join([
164
- f"AMIModelInitializer instance:",
164
+ "AMIModelInitializer instance:",
165
165
  f"`ami_params`: {self.ami_params}",
166
- f"`info_params`: {self.ami_params}",
167
- ])
166
+ f"`info_params`: {self.ami_params}"])
168
167
 
169
168
  def _getChannelResponse(self):
170
169
  return list(map(float, self._init_data["channel_response"]))
@@ -336,6 +335,8 @@ class AMIModel: # pylint: disable=too-many-instance-attributes
336
335
  def sexpr(pname, pval):
337
336
  """Create an S-expression from a parameter name/value pair, calling
338
337
  recursively as needed to elaborate sub-parameter dictionaries."""
338
+ if isinstance(pval, str):
339
+ return f'({pname} "{pval}")'
339
340
  if isinstance(pval, dict):
340
341
  subs = []
341
342
  for sname in pval:
@@ -248,9 +248,18 @@ class AMIParameter: # pylint: disable=too-many-instance-attributes,too-few-publ
248
248
  # Check for mutual exclusivity of 'Format Value' and 'Default'.
249
249
  elif (param_format == "Value") and (param_default is not None):
250
250
  self._msg += "'Format Value' and 'Default' both found! (They are mutually exclusive.)\n"
251
+ # Canonicalize Boolean if necessary.
252
+ elif (param_format == "List") and (param_type == "Boolean"):
253
+ if param_default:
254
+ self._value = param_default
255
+ else:
256
+ self._value = "False"
257
+ param_format = "Value"
258
+ self._format_rem = [self._value]
259
+ self._format = param_format
251
260
 
252
261
  # Check for 'Default' used with parameter type 'Out'.
253
- if (param_type == "Out") and (param_default is not None):
262
+ if (param_usage == "Out") and (param_default is not None):
254
263
  raise AMIParamError("'Default' may not be used with parameter type 'Out'!\n")
255
264
 
256
265
  # Complete the instance.
@@ -274,7 +283,7 @@ class AMIParameter: # pylint: disable=too-many-instance-attributes,too-few-publ
274
283
  self._value = False
275
284
  else:
276
285
  raise AMIParamError(f"Couldn't read Boolean from '{value_str}'.\n")
277
- else:
286
+ else: # `String`
278
287
  self._value = value_str.strip('"')
279
288
  elif param_format == "Range":
280
289
  if param_type not in ("Float", "Integer", "UI", "Tap"):
pyibisami/ami/parser.py CHANGED
@@ -28,12 +28,12 @@ from .reserved_parameter_names import AmiReservedParameterName, RESERVED_PARAM_
28
28
  # See: https://stackoverflow.com/questions/70894567/using-mypy-newtype-with-type-aliases-or-protocols
29
29
  ParamName = NewType("ParamName", str)
30
30
  ParamValue: TypeAlias = int | float | str | list["ParamValue"]
31
- Parameters: TypeAlias = dict[ParamName, "AMIParameter | 'Parameters'"]
32
- ParamValues: TypeAlias = dict[ParamName, "ParamValue | 'ParamValues'"]
31
+ Parameters: TypeAlias = dict[ParamName, "'AMIParameter' | 'Parameters'"]
32
+ ParamValues: TypeAlias = dict[ParamName, "'ParamValue' | 'ParamValues'"]
33
33
 
34
34
  AmiName = NewType("AmiName", str)
35
35
  AmiAtom: TypeAlias = bool | int | float | str
36
- AmiExpr: TypeAlias = "AmiAtom | 'AmiNode'"
36
+ AmiExpr: TypeAlias = "'AmiAtom' | 'AmiNode'"
37
37
  AmiNode: TypeAlias = tuple[AmiName, list[AmiExpr]]
38
38
  AmiNodeParser: TypeAlias = Callable[[str], AmiNode]
39
39
  AmiParser: TypeAlias = Callable[[str], tuple[AmiName, list[AmiNode]]] # Atoms may not exist at the root level.
@@ -41,7 +41,7 @@ AmiParser: TypeAlias = Callable[[str], tuple[AmiName, list[AmiNode]]] # Ato
41
41
  ParseErrMsg = NewType("ParseErrMsg", str)
42
42
  AmiRootName = NewType("AmiRootName", str)
43
43
  ReservedParamDict: TypeAlias = dict[AmiReservedParameterName, AMIParameter]
44
- ModelSpecificDict: TypeAlias = dict[ParamName, "AMIParameter | 'ModelSpecificDict'"]
44
+ ModelSpecificDict: TypeAlias = dict[ParamName, "'AMIParameter' | 'ModelSpecificDict'"]
45
45
 
46
46
  __all__ = [
47
47
  "ParamName", "ParamValue", "Parameters", "ParamValues",
@@ -97,17 +97,23 @@ class AMIParamConfigurator(HasTraits):
97
97
  super().__init__()
98
98
 
99
99
  # Parse the AMI file contents, storing any errors or warnings, and customize the view accordingly.
100
- err_str, root_name, description, reserved_param_dict, model_specific_dict = parse_ami_file_contents(ami_file_contents_str)
101
- assert reserved_param_dict, ValueError(
102
- "\n".join([
103
- "No 'Reserved_Parameters' section found!",
104
- err_str
105
- ]))
106
- assert model_specific_dict, ValueError(
107
- "\n".join([
108
- "No 'Model_Specific' section found!",
109
- err_str
110
- ]))
100
+ (err_str,
101
+ root_name,
102
+ description,
103
+ reserved_param_dict,
104
+ model_specific_dict) = parse_ami_file_contents(ami_file_contents_str)
105
+ if not reserved_param_dict:
106
+ raise ValueError(
107
+ "\n".join([
108
+ "No 'Reserved_Parameters' section found!",
109
+ err_str
110
+ ]))
111
+ if not model_specific_dict:
112
+ raise ValueError(
113
+ "\n".join([
114
+ "No 'Model_Specific' section found!",
115
+ err_str
116
+ ]))
111
117
  gui_items, new_traits = make_gui(model_specific_dict)
112
118
  trait_names = []
113
119
  for trait in new_traits:
@@ -501,8 +507,8 @@ def parse_ami_file_contents( # pylint: disable=too-many-locals,too-many-branche
501
507
  err_str, param_dict = proc_branch(res)
502
508
  if err_str:
503
509
  return (err_str, AmiRootName(""), "", {}, {})
504
- assert len(param_dict.keys()) == 1, ValueError(
505
- f"Malformed AMI parameter S-exp has top-level keys: {param_dict.keys()}!")
510
+ if len(param_dict.keys()) != 1:
511
+ raise ValueError(f"Malformed AMI parameter S-exp has top-level keys: {param_dict.keys()}!")
506
512
 
507
513
  reserved_found = False
508
514
  init_returns_impulse_found = False
@@ -645,7 +651,7 @@ def make_gui_items( # pylint: disable=too-many-locals,too-many-branches
645
651
  val = default if default else param.pvalue[0]
646
652
  the_trait = Enum([val] + param.pvalue)
647
653
  case _:
648
- raise ValueError(f"Unrecognized AMI parameter format: {pformat}!")
654
+ raise ValueError(f"Unrecognized AMI parameter format: {pformat}, for parameter `{pname}` of type `{param.ptype}` and usage `{param.pusage}`!")
649
655
  if the_trait.metadata:
650
656
  the_trait.metadata.update({"transient": False}) # Required to support modal dialogs.
651
657
  else:
@@ -20,8 +20,8 @@ class AmiReservedParameterName():
20
20
  def __post_init__(self):
21
21
  "Validate parameter name."
22
22
 
23
- assert self.pname in RESERVED_PARAM_NAMES, ValueError(
24
- f"Parameter name: {self.pname}, is not an IBIS-AMI reserved parameter name!")
23
+ if self.pname not in RESERVED_PARAM_NAMES:
24
+ raise ValueError(f"Parameter name: {self.pname}, is not an IBIS-AMI reserved parameter name!")
25
25
 
26
26
 
27
27
  RESERVED_PARAM_NAMES = [
@@ -45,10 +45,10 @@ def run_notebook(
45
45
  start_time = time()
46
46
 
47
47
  # Validate input.
48
- assert ibis_file.exists(), RuntimeError(
49
- f"Can't find IBIS-AMI model file, {ibis_file}!")
50
- assert notebook.exists(), RuntimeError(
51
- f"Can't find notebook file, {notebook}!")
48
+ if not ibis_file.exists():
49
+ raise RuntimeError(f"Can't find IBIS-AMI model file, {ibis_file}!")
50
+ if not notebook.exists():
51
+ raise RuntimeError(f"Can't find notebook file, {notebook}!")
52
52
 
53
53
  # Define temp. (i.e. - parameterized) notebook and output file locations.
54
54
  tmp_dir = (