-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathwrite_cells.py
68 lines (49 loc) · 1.31 KB
/
write_cells.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import inspect
from gvtt import cells
from gvtt.config import PATH
filepath = PATH.repo / "docs" / "cells.rst"
skip: set[str] = set()
skip_plot: tuple[str, ...] = ("add_fiber_array_siepic",)
skip_settings: tuple[str, ...] = ("flatten", "safe_cell_names")
with open(filepath, "w+") as f:
f.write(
"""
Here are the components available in the PDK
Cells
=============================
"""
)
for name in sorted(cells.keys()):
if name in skip or name.startswith("_"):
continue
print(name)
sig = inspect.signature(cells[name])
kwargs = ", ".join(
[
f"{p}={repr(sig.parameters[p].default)}"
for p in sig.parameters
if isinstance(sig.parameters[p].default, int | float | str | tuple)
and p not in skip_settings
]
)
if name in skip_plot:
f.write(
f"""
{name}
----------------------------------------------------
.. autofunction:: gvtt.components.{name}
"""
)
else:
f.write(
f"""
{name}
----------------------------------------------------
.. autofunction:: gvtt.components.{name}
.. plot::
:include-source:
import gvtt
c = gvtt.components.{name}({kwargs})
c.plot()
"""
)