diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3948dca --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +# Python cache directories and files +__pycache__/ +*.py[cod] +*$py.class + +# Custom files to ignore +*.syc \ No newline at end of file diff --git a/README.md b/README.md index bc49e8a..9aedd71 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,19 @@ This is the fast-track guide to contributing to **mxPIC**. Adherence to these ru ### 0. Installation dependencies - python 3.10.1 -- nazca 0.6.1 -- numpy 1.12.0 -- pandas 0.12.0 -- +- nazca 0.5.13 +- gdstk 1.0.0 +- numpy 1.22.3 +- pandas 1.3.3 +- matplotlib 3.4.3 +- Cython 3.2.4 +- Sphnix 7.4.7 + - myst-parser 3.0.1 + - sphinx-rtd-theme 3.1.0 + +``` +pip install sphinx myst-parser sphinx-rtd-theme gdstk==1.0.0 +``` ## 1. File & architecture The repository have an archtecture like this. @@ -97,11 +106,11 @@ The basic routing algorthium is based the information between nodes, which is th |Catagory| Prefix | name | index | expample | device instance |---|---|---|---|---|---| -| Optical| opt_ | a | 1~x | opt_a1 | direction_coupler -| Optical (Sinlge IO to waveguide)| opt_ | a | 1~x | opt_a1 |grating_coupler -| Electrical| ele_ | a | 1~x | ele_a1 | heater/resistor -| PN diodes| ele_ | ka/an | 1~x | ele_an1 | modulator/p-i-n waveuigde -| Transistors (BJT)| ele_ | ba/em/cl | 1~x | ele_cl1 | BJT +| Optical| opt_ | a | 1~x | opt_a_1 | direction_coupler +| Optical (Sinlge IO to waveguide)| opt_ | a_ | 1~x | opt_a_1 |grating_coupler +| Electrical| ele_ | a | 1~x | ele_a_1 | heater/resistor +| PN diodes| ele_ | cathode/anode | 1~x | ele_anode_1 | modulator/p-i-n waveuigde +| Transistors (BJT)| ele_ | base/em/collector | 1~x | ele_colloctor_1 | BJT | Transistors (MOS)| ele_ | gt/su/dr | 1~x | ele_gt1 | MOSFET @@ -113,3 +122,4 @@ nazca.add_layer_to_xsection("WG_HM",growx=2,growy=2) nazca.add_layer_to_xsection("WG_STRIP",growx=2,growy=2) ``` + diff --git a/README.pdf b/README.pdf deleted file mode 100644 index 353d600..0000000 Binary files a/README.pdf and /dev/null differ diff --git a/_test_.py b/_test_.py new file mode 100644 index 0000000..1915d51 --- /dev/null +++ b/_test_.py @@ -0,0 +1,9 @@ +# import mxpic as mx +import mxpic_release.mxpic as mx + +EC = mx.EC_dual_layer_px3(name="xxx",w_in=0.5,L_in=10,Ltp1=10,Ltp2=10,Ltp3=10) + +# import uuid +# mac = uuid.getnode() +# mc_addr = ':'.join(("%012X" % mac)[i:i+2] for i in range(0, 12, 2)) +# print(mc_addr) \ No newline at end of file diff --git a/build/temp.win-amd64-cpython-39/Release/mxpic/basic.cp39-win_amd64.exp b/build/temp.win-amd64-cpython-39/Release/mxpic/basic.cp39-win_amd64.exp new file mode 100644 index 0000000..8a90129 Binary files /dev/null and b/build/temp.win-amd64-cpython-39/Release/mxpic/basic.cp39-win_amd64.exp differ diff --git a/build/temp.win-amd64-cpython-39/Release/mxpic/basic.cp39-win_amd64.lib b/build/temp.win-amd64-cpython-39/Release/mxpic/basic.cp39-win_amd64.lib new file mode 100644 index 0000000..84a4998 Binary files /dev/null and b/build/temp.win-amd64-cpython-39/Release/mxpic/basic.cp39-win_amd64.lib differ diff --git a/build/temp.win-amd64-cpython-39/Release/mxpic/basic.obj b/build/temp.win-amd64-cpython-39/Release/mxpic/basic.obj new file mode 100644 index 0000000..8228b3e Binary files /dev/null and b/build/temp.win-amd64-cpython-39/Release/mxpic/basic.obj differ diff --git a/build/temp.win-amd64-cpython-39/Release/mxpic/components/primitives/directional_couplers/directional_couplers.cp39-win_amd64.exp b/build/temp.win-amd64-cpython-39/Release/mxpic/components/primitives/directional_couplers/directional_couplers.cp39-win_amd64.exp new file mode 100644 index 0000000..396c5fa Binary files /dev/null and b/build/temp.win-amd64-cpython-39/Release/mxpic/components/primitives/directional_couplers/directional_couplers.cp39-win_amd64.exp differ diff --git a/build/temp.win-amd64-cpython-39/Release/mxpic/components/primitives/directional_couplers/directional_couplers.cp39-win_amd64.lib b/build/temp.win-amd64-cpython-39/Release/mxpic/components/primitives/directional_couplers/directional_couplers.cp39-win_amd64.lib new file mode 100644 index 0000000..a47fa35 Binary files /dev/null and b/build/temp.win-amd64-cpython-39/Release/mxpic/components/primitives/directional_couplers/directional_couplers.cp39-win_amd64.lib differ diff --git a/build/temp.win-amd64-cpython-39/Release/mxpic/components/primitives/directional_couplers/directional_couplers.obj b/build/temp.win-amd64-cpython-39/Release/mxpic/components/primitives/directional_couplers/directional_couplers.obj new file mode 100644 index 0000000..6f812b5 Binary files /dev/null and b/build/temp.win-amd64-cpython-39/Release/mxpic/components/primitives/directional_couplers/directional_couplers.obj differ diff --git a/build/temp.win-amd64-cpython-39/Release/mxpic/components/primitives/edge_couplers/EC_dual_layer_px3.cp39-win_amd64.exp b/build/temp.win-amd64-cpython-39/Release/mxpic/components/primitives/edge_couplers/EC_dual_layer_px3.cp39-win_amd64.exp new file mode 100644 index 0000000..2e28ff4 Binary files /dev/null and b/build/temp.win-amd64-cpython-39/Release/mxpic/components/primitives/edge_couplers/EC_dual_layer_px3.cp39-win_amd64.exp differ diff --git a/build/temp.win-amd64-cpython-39/Release/mxpic/components/primitives/edge_couplers/EC_dual_layer_px3.cp39-win_amd64.lib b/build/temp.win-amd64-cpython-39/Release/mxpic/components/primitives/edge_couplers/EC_dual_layer_px3.cp39-win_amd64.lib new file mode 100644 index 0000000..4c74f0e Binary files /dev/null and b/build/temp.win-amd64-cpython-39/Release/mxpic/components/primitives/edge_couplers/EC_dual_layer_px3.cp39-win_amd64.lib differ diff --git a/build/temp.win-amd64-cpython-39/Release/mxpic/components/primitives/edge_couplers/EC_dual_layer_px3.obj b/build/temp.win-amd64-cpython-39/Release/mxpic/components/primitives/edge_couplers/EC_dual_layer_px3.obj new file mode 100644 index 0000000..3ce4bbe Binary files /dev/null and b/build/temp.win-amd64-cpython-39/Release/mxpic/components/primitives/edge_couplers/EC_dual_layer_px3.obj differ diff --git a/build/temp.win-amd64-cpython-39/Release/mxpic/components/primitives/grating_couplers/grating_couplers.cp39-win_amd64.exp b/build/temp.win-amd64-cpython-39/Release/mxpic/components/primitives/grating_couplers/grating_couplers.cp39-win_amd64.exp new file mode 100644 index 0000000..e665c88 Binary files /dev/null and b/build/temp.win-amd64-cpython-39/Release/mxpic/components/primitives/grating_couplers/grating_couplers.cp39-win_amd64.exp differ diff --git a/build/temp.win-amd64-cpython-39/Release/mxpic/components/primitives/grating_couplers/grating_couplers.cp39-win_amd64.lib b/build/temp.win-amd64-cpython-39/Release/mxpic/components/primitives/grating_couplers/grating_couplers.cp39-win_amd64.lib new file mode 100644 index 0000000..9ac0e24 Binary files /dev/null and b/build/temp.win-amd64-cpython-39/Release/mxpic/components/primitives/grating_couplers/grating_couplers.cp39-win_amd64.lib differ diff --git a/build/temp.win-amd64-cpython-39/Release/mxpic/components/primitives/grating_couplers/grating_couplers.obj b/build/temp.win-amd64-cpython-39/Release/mxpic/components/primitives/grating_couplers/grating_couplers.obj new file mode 100644 index 0000000..b2b1cf0 Binary files /dev/null and b/build/temp.win-amd64-cpython-39/Release/mxpic/components/primitives/grating_couplers/grating_couplers.obj differ diff --git a/build/temp.win-amd64-cpython-39/Release/mxpic/core/generate_license.cp39-win_amd64.exp b/build/temp.win-amd64-cpython-39/Release/mxpic/core/generate_license.cp39-win_amd64.exp new file mode 100644 index 0000000..a8d8b78 Binary files /dev/null and b/build/temp.win-amd64-cpython-39/Release/mxpic/core/generate_license.cp39-win_amd64.exp differ diff --git a/build/temp.win-amd64-cpython-39/Release/mxpic/core/generate_license.cp39-win_amd64.lib b/build/temp.win-amd64-cpython-39/Release/mxpic/core/generate_license.cp39-win_amd64.lib new file mode 100644 index 0000000..2a554f8 Binary files /dev/null and b/build/temp.win-amd64-cpython-39/Release/mxpic/core/generate_license.cp39-win_amd64.lib differ diff --git a/build/temp.win-amd64-cpython-39/Release/mxpic/core/generate_license.obj b/build/temp.win-amd64-cpython-39/Release/mxpic/core/generate_license.obj new file mode 100644 index 0000000..abcb628 Binary files /dev/null and b/build/temp.win-amd64-cpython-39/Release/mxpic/core/generate_license.obj differ diff --git a/build/temp.win-amd64-cpython-39/Release/mxpic/core/license_check.cp39-win_amd64.exp b/build/temp.win-amd64-cpython-39/Release/mxpic/core/license_check.cp39-win_amd64.exp new file mode 100644 index 0000000..d2821e7 Binary files /dev/null and b/build/temp.win-amd64-cpython-39/Release/mxpic/core/license_check.cp39-win_amd64.exp differ diff --git a/build/temp.win-amd64-cpython-39/Release/mxpic/core/license_check.cp39-win_amd64.lib b/build/temp.win-amd64-cpython-39/Release/mxpic/core/license_check.cp39-win_amd64.lib new file mode 100644 index 0000000..c692579 Binary files /dev/null and b/build/temp.win-amd64-cpython-39/Release/mxpic/core/license_check.cp39-win_amd64.lib differ diff --git a/build/temp.win-amd64-cpython-39/Release/mxpic/core/license_check.obj b/build/temp.win-amd64-cpython-39/Release/mxpic/core/license_check.obj new file mode 100644 index 0000000..2869689 Binary files /dev/null and b/build/temp.win-amd64-cpython-39/Release/mxpic/core/license_check.obj differ diff --git a/build/temp.win-amd64-cpython-39/Release/mxpic/foundries/AMF.cp39-win_amd64.exp b/build/temp.win-amd64-cpython-39/Release/mxpic/foundries/AMF.cp39-win_amd64.exp new file mode 100644 index 0000000..eb1a690 Binary files /dev/null and b/build/temp.win-amd64-cpython-39/Release/mxpic/foundries/AMF.cp39-win_amd64.exp differ diff --git a/build/temp.win-amd64-cpython-39/Release/mxpic/foundries/AMF.cp39-win_amd64.lib b/build/temp.win-amd64-cpython-39/Release/mxpic/foundries/AMF.cp39-win_amd64.lib new file mode 100644 index 0000000..4a56a97 Binary files /dev/null and b/build/temp.win-amd64-cpython-39/Release/mxpic/foundries/AMF.cp39-win_amd64.lib differ diff --git a/build/temp.win-amd64-cpython-39/Release/mxpic/foundries/AMF.obj b/build/temp.win-amd64-cpython-39/Release/mxpic/foundries/AMF.obj new file mode 100644 index 0000000..fb14f43 Binary files /dev/null and b/build/temp.win-amd64-cpython-39/Release/mxpic/foundries/AMF.obj differ diff --git a/build/temp.win-amd64-cpython-39/Release/mxpic/foundries/Silterra.cp39-win_amd64.exp b/build/temp.win-amd64-cpython-39/Release/mxpic/foundries/Silterra.cp39-win_amd64.exp new file mode 100644 index 0000000..8dd3fe6 Binary files /dev/null and b/build/temp.win-amd64-cpython-39/Release/mxpic/foundries/Silterra.cp39-win_amd64.exp differ diff --git a/build/temp.win-amd64-cpython-39/Release/mxpic/foundries/Silterra.cp39-win_amd64.lib b/build/temp.win-amd64-cpython-39/Release/mxpic/foundries/Silterra.cp39-win_amd64.lib new file mode 100644 index 0000000..4dd3394 Binary files /dev/null and b/build/temp.win-amd64-cpython-39/Release/mxpic/foundries/Silterra.cp39-win_amd64.lib differ diff --git a/build/temp.win-amd64-cpython-39/Release/mxpic/foundries/Silterra.obj b/build/temp.win-amd64-cpython-39/Release/mxpic/foundries/Silterra.obj new file mode 100644 index 0000000..5584395 Binary files /dev/null and b/build/temp.win-amd64-cpython-39/Release/mxpic/foundries/Silterra.obj differ diff --git a/build/temp.win-amd64-cpython-39/Release/mxpic/routing/routing.cp39-win_amd64.exp b/build/temp.win-amd64-cpython-39/Release/mxpic/routing/routing.cp39-win_amd64.exp new file mode 100644 index 0000000..bb7abc4 Binary files /dev/null and b/build/temp.win-amd64-cpython-39/Release/mxpic/routing/routing.cp39-win_amd64.exp differ diff --git a/build/temp.win-amd64-cpython-39/Release/mxpic/routing/routing.cp39-win_amd64.lib b/build/temp.win-amd64-cpython-39/Release/mxpic/routing/routing.cp39-win_amd64.lib new file mode 100644 index 0000000..bdc1455 Binary files /dev/null and b/build/temp.win-amd64-cpython-39/Release/mxpic/routing/routing.cp39-win_amd64.lib differ diff --git a/build/temp.win-amd64-cpython-39/Release/mxpic/routing/routing.obj b/build/temp.win-amd64-cpython-39/Release/mxpic/routing/routing.obj new file mode 100644 index 0000000..4bb2547 Binary files /dev/null and b/build/temp.win-amd64-cpython-39/Release/mxpic/routing/routing.obj differ diff --git a/build/temp.win-amd64-cpython-39/Release/mxpic/structures.cp39-win_amd64.exp b/build/temp.win-amd64-cpython-39/Release/mxpic/structures.cp39-win_amd64.exp new file mode 100644 index 0000000..cf773ae Binary files /dev/null and b/build/temp.win-amd64-cpython-39/Release/mxpic/structures.cp39-win_amd64.exp differ diff --git a/build/temp.win-amd64-cpython-39/Release/mxpic/structures.cp39-win_amd64.lib b/build/temp.win-amd64-cpython-39/Release/mxpic/structures.cp39-win_amd64.lib new file mode 100644 index 0000000..824be02 Binary files /dev/null and b/build/temp.win-amd64-cpython-39/Release/mxpic/structures.cp39-win_amd64.lib differ diff --git a/build/temp.win-amd64-cpython-39/Release/mxpic/structures.obj b/build/temp.win-amd64-cpython-39/Release/mxpic/structures.obj new file mode 100644 index 0000000..b45efa5 Binary files /dev/null and b/build/temp.win-amd64-cpython-39/Release/mxpic/structures.obj differ diff --git a/build_release.py b/build_release.py new file mode 100644 index 0000000..08e0b05 --- /dev/null +++ b/build_release.py @@ -0,0 +1,56 @@ +import os +import shutil +import subprocess +from pathlib import Path + +def build_and_harvest(): + src_dir = Path("mxpic") + release_dir = Path("mxpic_release/mxpic") + + print("🧹 Cleaning old builds...") + if release_dir.parent.exists(): + shutil.rmtree(release_dir.parent) + + print("🔨 Compiling C-Extensions with Cython...") + # Run the setup.py build command in-place + subprocess.run(["python", "setup.py", "build_ext", "--inplace"], check=True) + + print("📦 Harvesting compiled files into release package...") + release_dir.mkdir(parents=True, exist_ok=True) + + # Walk through the original source directory + for root, dirs, files in os.walk(src_dir): + # Skip docs folder + if 'docs' in dirs: + dirs.remove('docs') + + current_root = Path(root) + rel_path = current_root.relative_to(src_dir) + target_dir = release_dir / rel_path + + # Ensure the mirrored directory exists + target_dir.mkdir(parents=True, exist_ok=True) + + for file in files: + file_path = current_root / file + + # Copy compiled binaries (.so for Linux/WSL, .pyd for Windows) + if file.endswith((".so", ".pyd")): + shutil.move(file_path, target_dir / file) + + # Copy __init__.py files so Python recognizes the packages + elif file == "__init__.py": + shutil.copy2(file_path, target_dir / file) + + # (Optional) Copy non-code assets like config files or templates + elif file.endswith((".json", ".yaml", ".yml")): + shutil.copy2(file_path, target_dir / file) + + print("✨ Cleanup: Removing intermediate .c files from source...") + for c_file in src_dir.rglob("*.c"): + c_file.unlink() + + print(f"\n🚀 Success! Your secure package is ready in: {release_dir.parent.resolve()}") + +if __name__ == "__main__": + build_and_harvest() \ No newline at end of file diff --git a/docs/build/doctrees/environment.pickle b/docs/build/doctrees/environment.pickle deleted file mode 100644 index f7d0887..0000000 Binary files a/docs/build/doctrees/environment.pickle and /dev/null differ diff --git a/docs/build/doctrees/index.doctree b/docs/build/doctrees/index.doctree deleted file mode 100644 index f3f2f0e..0000000 Binary files a/docs/build/doctrees/index.doctree and /dev/null differ diff --git a/docs/build/doctrees/primitives/edge_couplers/edge_couplers.doctree b/docs/build/doctrees/primitives/edge_couplers/edge_couplers.doctree deleted file mode 100644 index 69a766d..0000000 Binary files a/docs/build/doctrees/primitives/edge_couplers/edge_couplers.doctree and /dev/null differ diff --git a/docs/build/html/_sources/index.md.txt b/docs/build/html/_sources/index.md.txt deleted file mode 100644 index d525823..0000000 --- a/docs/build/html/_sources/index.md.txt +++ /dev/null @@ -1,18 +0,0 @@ -.. mxpic_handbook documentation master file, created by - sphinx-quickstart on Sun May 3 16:05:57 2026. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - -# mxpic_handbook documentation -============================ - -Add your content using ``reStructuredText`` syntax. See the -`reStructuredText `_ -documentation for details. - -Welcome to the automated documentation for the mxPIC silicon photonics library. -```{toctree} - :maxdepth: 2 - :caption: Components: - -primitives/edge_couplers/edge_couplers \ No newline at end of file diff --git a/docs/build/html/_sources/primitives/edge_couplers/edge_couplers.md.txt b/docs/build/html/_sources/primitives/edge_couplers/edge_couplers.md.txt deleted file mode 100644 index 70e7b38..0000000 --- a/docs/build/html/_sources/primitives/edge_couplers/edge_couplers.md.txt +++ /dev/null @@ -1,25 +0,0 @@ -# Edge Coupler Reference - -This section covers the dual-layer edge coupler designs used for fiber-to-chip interfacing. - -## Dual Layer PX3 -The `EC_dual_layer_px3` is our standard spot-size converter. -```{eval-rst} -.. autoclass:: mxpic_forge.primitives.edge_couplers.EC_dual_layer_px3.EC_dual_layer_px3 - :members: - :undoc-members: - :show-inheritance: - -``` -```{figure} ../../_static/images/ec_px3_layout.png -:width: 600px -:align: center -:alt: GDS layout of the dual-layer edge coupler - -Figure 1: GDS layout of the EC_dual_layer_px3 showing the SiN-to-SOI taper transition. -``` - -## Design Notes -- Tapers: Ensure Ltp1, Ltp2, and Ltp3 provide enough length for adiabatic mode expansion. - -- Alignment: The angle_tile parameter (default 8°) is critical for reducing back-reflections. \ No newline at end of file diff --git a/docs/build/html/objects.inv b/docs/build/html/objects.inv deleted file mode 100644 index ac5b188..0000000 Binary files a/docs/build/html/objects.inv and /dev/null differ diff --git a/docs/build/html/searchindex.js b/docs/build/html/searchindex.js deleted file mode 100644 index d705958..0000000 --- a/docs/build/html/searchindex.js +++ /dev/null @@ -1 +0,0 @@ -Search.setIndex({"alltitles": {"Components:": [[0, null]], "Design Notes": [[1, "design-notes"]], "Dual Layer PX3": [[1, "dual-layer-px3"]], "Edge Coupler Reference": [[1, null]], "mxpic_handbook documentation": [[0, null]]}, "docnames": ["index", "primitives/edge_couplers/edge_couplers"], "envversion": {"sphinx": 62, "sphinx.domains.c": 3, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 9, "sphinx.domains.index": 1, "sphinx.domains.javascript": 3, "sphinx.domains.math": 2, "sphinx.domains.python": 4, "sphinx.domains.rst": 2, "sphinx.domains.std": 2}, "filenames": ["index.md", "primitives/edge_couplers/edge_couplers.md"], "indexentries": {"ec_dual_layer_px3 (class in mxpic_forge.primitives.edge_couplers.ec_dual_layer_px3)": [[1, "mxpic_forge.primitives.edge_couplers.EC_dual_layer_px3.EC_dual_layer_px3", false]], "generate_gds() (mxpic_forge.primitives.edge_couplers.ec_dual_layer_px3.ec_dual_layer_px3 method)": [[1, "mxpic_forge.primitives.edge_couplers.EC_dual_layer_px3.EC_dual_layer_px3.generate_gds", false]]}, "objects": {"mxpic_forge.primitives.edge_couplers.EC_dual_layer_px3": [[1, 0, 1, "", "EC_dual_layer_px3"]], "mxpic_forge.primitives.edge_couplers.EC_dual_layer_px3.EC_dual_layer_px3": [[1, 1, 1, "", "generate_gds"]]}, "objnames": {"0": ["py", "class", "Python class"], "1": ["py", "method", "Python method"]}, "objtypes": {"0": "py:class", "1": "py:method"}, "terms": {"0": 1, "05": 0, "1": 1, "12": 1, "16": 0, "2": 1, "2026": 0, "3": 0, "45": 1, "50": 1, "57": 0, "6": 1, "8": 1, "The": 1, "_": 0, "adapt": 0, "add": 0, "adiabat": 1, "air": 1, "air_trench": 1, "align": 1, "angl": 1, "angle_til": 1, "associ": 1, "autom": 0, "back": 1, "base": 1, "bend": 1, "beol": 1, "between": 1, "box": 1, "can": 0, "cell": 1, "central": 1, "chip": 1, "clad": 1, "class": 1, "clear": 1, "complet": 0, "compon": 1, "contain": 0, "content": 0, "contrast": 1, "convert": 1, "core": 1, "coupl": 1, "coupler": 0, "cover": 1, "creat": 0, "critic": 1, "cross": 1, "curvatur": 1, "deep": 1, "default": 1, "degre": 1, "design": 0, "detail": 0, "devic": 1, "dimens": 1, "direct": 0, "doc": 0, "dual": 0, "dummi": 1, "e": 1, "ec_dual_layer_px3": 1, "edg": 0, "edge_coupl": 1, "en": 0, "enough": 1, "ensur": 1, "exclus": 1, "expans": 1, "extens": 1, "facet": 1, "fiber": 1, "figur": 1, "file": 0, "final": 1, "first": 1, "float": 1, "g": 1, "gd": 1, "generate_gd": 1, "high": 1, "html": 0, "http": 0, "i": 1, "identifi": 1, "index": [0, 1], "initi": 1, "input": 1, "interfac": 1, "l_box_end": 1, "l_end": 1, "l_in": 1, "layer": 0, "layer_dt": 1, "layer_dum_exl_b": 1, "layer_sin_slab": 1, "layer_top_cov": 1, "layout": 1, "least": 0, "length": 1, "librari": 0, "like": 0, "ltp1": 1, "ltp2": 1, "ltp3": 1, "mai": 0, "manag": 1, "master": 0, "micron": 1, "midpoint": 1, "mode": 1, "mxpic": 0, "mxpic_forg": 1, "name": 1, "nitrid": 1, "none": 1, "note": 0, "object": 1, "open": 1, "optic": 1, "option": 1, "org": 0, "our": 1, "oxid": 1, "oxide_facet": 1, "pad": 1, "pad_opt": 1, "paramet": 1, "photon": 0, "primit": 1, "provid": 1, "px3": 0, "quickstart": 0, "r_bend": 1, "radiu": 1, "reduc": 1, "refer": 0, "reflect": 1, "respect": 1, "restructuredtext": 0, "root": 0, "rout": 1, "second": 1, "secondari": 1, "section": 1, "see": 0, "should": 0, "show": 1, "silicon": 0, "sin": 1, "sin_rib_wg": 1, "size": 1, "slab": 1, "soi": 1, "sphinx": 0, "spot": 1, "standard": 1, "str": 1, "sun": 0, "syntax": 0, "taper": 1, "thi": [0, 1], "third": 1, "tilt": 1, "tip": 1, "toctre": 0, "top": 1, "transit": 1, "trench": 1, "uniqu": 1, "us": [0, 1], "usag": 0, "w1_slab": 1, "w_box": 1, "w_box_end": 1, "w_dt": 1, "w_in": 1, "w_mid_slab": 1, "w_tip_cor": 1, "w_tip_slab": 1, "waveguid": 1, "welcom": 0, "width": 1, "www": 0, "xs_sin": 1, "xs_trench": 1, "you": 0, "your": 0}, "titles": ["mxpic_handbook documentation", "Edge Coupler Reference"], "titleterms": {"compon": 0, "coupler": 1, "design": 1, "document": 0, "dual": 1, "edg": 1, "layer": 1, "mxpic_handbook": 0, "note": 1, "px3": 1, "refer": 1}}) \ No newline at end of file diff --git a/docs/source/_static/images/ec_px3_layout.png b/docs/source/_static/images/ec_px3_layout.png deleted file mode 100644 index 6d8ff7a..0000000 Binary files a/docs/source/_static/images/ec_px3_layout.png and /dev/null differ diff --git a/docs/source/index.md b/docs/source/index.md deleted file mode 100644 index d525823..0000000 --- a/docs/source/index.md +++ /dev/null @@ -1,18 +0,0 @@ -.. mxpic_handbook documentation master file, created by - sphinx-quickstart on Sun May 3 16:05:57 2026. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - -# mxpic_handbook documentation -============================ - -Add your content using ``reStructuredText`` syntax. See the -`reStructuredText `_ -documentation for details. - -Welcome to the automated documentation for the mxPIC silicon photonics library. -```{toctree} - :maxdepth: 2 - :caption: Components: - -primitives/edge_couplers/edge_couplers \ No newline at end of file diff --git a/docs/source/primitives/edge_couplers/edge_couplers.md b/docs/source/primitives/edge_couplers/edge_couplers.md deleted file mode 100644 index 70e7b38..0000000 --- a/docs/source/primitives/edge_couplers/edge_couplers.md +++ /dev/null @@ -1,25 +0,0 @@ -# Edge Coupler Reference - -This section covers the dual-layer edge coupler designs used for fiber-to-chip interfacing. - -## Dual Layer PX3 -The `EC_dual_layer_px3` is our standard spot-size converter. -```{eval-rst} -.. autoclass:: mxpic_forge.primitives.edge_couplers.EC_dual_layer_px3.EC_dual_layer_px3 - :members: - :undoc-members: - :show-inheritance: - -``` -```{figure} ../../_static/images/ec_px3_layout.png -:width: 600px -:align: center -:alt: GDS layout of the dual-layer edge coupler - -Figure 1: GDS layout of the EC_dual_layer_px3 showing the SiN-to-SOI taper transition. -``` - -## Design Notes -- Tapers: Ensure Ltp1, Ltp2, and Ltp3 provide enough length for adiabatic mode expansion. - -- Alignment: The angle_tile parameter (default 8°) is critical for reducing back-reflections. \ No newline at end of file diff --git a/md_doc_gen.py b/md_doc_gen.py new file mode 100644 index 0000000..db169b8 --- /dev/null +++ b/md_doc_gen.py @@ -0,0 +1,80 @@ +import os +import shutil +from pathlib import Path + +basic_md_info = "\ +.. mxpic_handbook documentation master file, created by\n\ +sphinx-quickstart on Sun May 3 16:05:57 2026.\n\ +You can adapt this file completely to your liking, but it should at least\n\ +contain the root `toctree` directive.\n\n\ +# Welcome to the automated documentation for the mxPIC silicon photonics library.\n\ +```{toctree}\n\ + :maxdepth: 2\n\ + :caption: Components:\n\n\ +" + +def generate_myst_docs(src_dir: str, docs_api_dir: str) -> None: + """ + Scans a Python package and generates MyST Markdown files for Sphinx autodoc. + """ + src_path = Path(src_dir).resolve() + api_path = Path(docs_api_dir).resolve() + + # Clean the old api directory to prevent dead links from deleted files + if api_path.exists(): + # shutil.rmtree(api_path) + pass + else : + api_path.mkdir(parents=True, exist_ok=True) + + package_name = src_path.name + generated_files = [] + + print(f"Scanning {package_name} for Python modules...") + + index_info = basic_md_info + # Recursively find all .py files + for py_file in src_path.rglob("*.py"): + # Skip init files and private/internal scripts if desired + if py_file.name == "__init__.py" or py_file.name.startswith("_"): + continue + + # Convert file path to Python module format (e.g., mxpic.primitives.mzm) + rel_path = py_file.relative_to(src_path.parent.parent) + class_name = str(rel_path.with_suffix("")).replace(os.sep, ".") + module_name = str(rel_path.with_suffix("")).replace(os.sep, "\\") + index_md_name = str(rel_path.with_suffix("")).replace(os.sep, "/") + + # Create the markdown file + md_filename = api_path / f"{module_name}.md" + + # MyST Markdown format using Sphinx autodoc directives + content = f"# {module_name}\n \ +```{{eval-rst}}\n \ +.. automodule:: {class_name}\n\ + :members:\n\ + :undoc-members:\n\ + :show-inheritance:\n\ +```\n\ +" + ## Building .md file for each .py file + try : + try : os.makedirs(name=str(md_filename.parent.resolve())) + except : pass + + with open(file=str(md_filename.resolve()),mode="w") as md_file: + md_file.write(content) + print(f"Generated: {docs_api_dir}{module_name}.md") + except Exception as e: + print(e) + + ## Writing information into the index.md file + index_info = index_info + f"{index_md_name}\n" + + with open(file=docs_api_dir+"index.md",mode="w") as md_file: + md_file.write(index_info) + +if __name__ == "__main__": + generate_myst_docs(src_dir="mxpic\\components\\",docs_api_dir="mxpic\\docs\\source\\") + + \ No newline at end of file diff --git a/mxpic.lic b/mxpic.lic new file mode 100644 index 0000000..0c2eb0e --- /dev/null +++ b/mxpic.lic @@ -0,0 +1,5 @@ +{ + "mac_address": "D4:54:8B:F1:46:49", + "expiration": "2027-05-07", + "signature": "844002ba44b83a6bc5ddb9889db72fc614b1232ed980cc7e13dd02c2f8de25f2" +} \ No newline at end of file diff --git a/mxpic/__init__.py b/mxpic/__init__.py new file mode 100644 index 0000000..a991874 --- /dev/null +++ b/mxpic/__init__.py @@ -0,0 +1,12 @@ +# mxpic/__init__.py + +from .core.license_check import verify_license + +# Run the check immediately upon import +verify_license() + +# If the check passes, the rest of the library loads +from .components import EC_dual_layer_px3 +from .routing import Route + +from .components.primitives import * \ No newline at end of file diff --git a/mxpic/basic.py b/mxpic/basic.py new file mode 100644 index 0000000..8f7f272 --- /dev/null +++ b/mxpic/basic.py @@ -0,0 +1,45 @@ +import nazca as nd +import numpy as np + +def __cell_arg__(arg,arg_name,func_name): + if (isinstance(arg,nd.Cell)): + return arg + elif (hasattr(arg,'cell')): + return arg.cell + else : + raise Exception("ERROR: In <"+func_name+">, <"+arg_name+"> not a [cell] argument") + + +def __list_convert__(var,name,func_name): + if (isinstance(var,str)): + var = [var] + elif (isinstance(var,list)): + var = var + else : raise Exception("ERROR: in <"+func_name+">, <"+name+"> not defined properly, please input <"+type+"> or ") + + return var + +def __array_convert__(var,name,func_name,num=1): + if (isinstance(var,int) or isinstance(var,float)): + var = var*np.ones(num) + elif (isinstance(var,list) or isinstance(var,np.ndarray)): + var = np.array(var) + else : raise Exception("ERROR: in <"+func_name+">, <"+name+"> not defined properly, please input <"+type+"> or or ") + + return var + + +## Small revision in 2023.1.31 +def __xs_exist__(xs,para_name,func_name): + if (xs!=None): + try: + nd.get_xsection(xs) + except: + print("WARNING: In <"+func_name+">, <"+para_name+"> not defined in tapeout") + + xs=None + return xs + else : + return None + + diff --git a/mxpic/components/__init__.py b/mxpic/components/__init__.py new file mode 100644 index 0000000..f5d6a2d --- /dev/null +++ b/mxpic/components/__init__.py @@ -0,0 +1 @@ +from .primitives import * \ No newline at end of file diff --git a/mxpic/components/primitives/__init__.py b/mxpic/components/primitives/__init__.py new file mode 100644 index 0000000..c7dc1c3 --- /dev/null +++ b/mxpic/components/primitives/__init__.py @@ -0,0 +1,2 @@ +from .directional_couplers.directional_couplers import * +from .edge_couplers.EC_dual_layer_px3 import * \ No newline at end of file diff --git a/mxpic/components/primitives/directional_couplers/__init__.py b/mxpic/components/primitives/directional_couplers/__init__.py new file mode 100644 index 0000000..88513f7 --- /dev/null +++ b/mxpic/components/primitives/directional_couplers/__init__.py @@ -0,0 +1 @@ +from .directional_couplers import * \ No newline at end of file diff --git a/primitives/directional_couplers/directional_couplers.py b/mxpic/components/primitives/directional_couplers/directional_couplers.py similarity index 77% rename from primitives/directional_couplers/directional_couplers.py rename to mxpic/components/primitives/directional_couplers/directional_couplers.py index 0b97e4a..3247dbd 100644 --- a/primitives/directional_couplers/directional_couplers.py +++ b/mxpic/components/primitives/directional_couplers/directional_couplers.py @@ -1,23 +1,68 @@ import nazca as nd import numpy as np +from numpy import pi -from ..pic import taper +from ....routing import Route +from ....structures import _my_polygon,circle,Clothoid +from ....basic import __cell_arg__ -from ..structures import * - -from ..routing import Route -# import nazca.interconnects as IC -# class Route(IC.Interconnect): -# pass - -from ..structures import _my_polygon - -from ..basic import __cell_arg__ - -class ring_bus_wg : +class ring_bus_wg: ## two types: ## DC, BDC + """ + Initialize ring-bus waveguide coupler settings. + + Parameters + ---------- + xs : str, optional + Waveguide cross-section name (default is "strip"). + R_cp : int, optional + Coupling waveguide bend radius in microns for BDC mode (default is 20). + w_bus : float, optional + Coupling waveguide width in microns (default is 0.5). + w_wg : float, optional + Port waveguide width in microns (default is 0.5). + bend_DC : bool, optional + Use bend directional coupler (True) or straight DC (False, default is True). + dLc : int, optional + Straight coupling length in microns for DC mode (default is 10). + dAc : int, optional + Coupling angle in degrees for BDC mode (default is 10). + euler_transistion : bool, optional + Enable Euler transition segments before/after the coupling arc (default is False). + dL_trans : int, optional + Straight transition length in microns when Euler transition is enabled (default is 10). + dA_trans : int, optional + Transition bend angle in degrees for the Euler segment (default is 30). + R_max_trans : int, optional + Maximum radius in microns for the transition segment (default is 100). + w_trans : float, optional + Waveguide width in microns inside the transition (default is 0.5). + euler_anti_bend : bool, optional + Enable Euler anti-bend routing after the coupling section (default is False). + R_max_anti : int, optional + Maximum radius in microns for the anti-bend segment (default is 100). + R_min_anti : int, optional + Minimum radius in microns for the anti-bend segment (default is 10). + A_anti : float, optional + Anti-bend angle in degrees (default is None, meaning auto-calculated). + res : float, optional + Geometry discretization step in microns (default is 0.1). + wg_Ltp : int, optional + Port taper length in microns (default is 5). + dL_p2p : float, optional + Target horizontal spacing in microns between input/output ports (default is None). + sharp_patch : bool, optional + Insert chamfer polygons to avoid sharp corners (default is True). + show_pins : bool, optional + Draw Nazca stub markers for debugging (default is False). + end_patch : bool, optional + Force small straight fillers at the end of Euler segments (default is False). + clothoid_order : int, optional + Order of the spiral section used inside :class:`Clothoid` transitions (default is 1). + """ + def __init__(self, xs='strip', R_cp = 20, @@ -45,33 +90,7 @@ class ring_bus_wg : end_patch = False, clothoid_order = 1, ) -> None: - """_summary_ - - Args: - xs (str, optional): waveguide xsection. Defaults to 'strip'. - R_cp (int, optional): coupling waveguide radius, for bend coupling . Defaults to 20. - w_bus (float, optional): coupling waveguide width. Defaults to 0.5. - w_wg (float, optional): waveugide port width. Defaults to 0.5. - bend_DC (bool, optional): BDC or DC. Defaults to True. - dLc (int, optional): for DC, the coupling length. Defaults to 10. - dAc (int, optional): for BDC, the coupling angle. Defaults to 10. - n_points (int, optional): _description_. Defaults to 512. - euler_transistion (bool, optional): _description_. Defaults to False. - dL_trans (int, optional): _description_. Defaults to 10. - dA_trans (int, optional): _description_. Defaults to 30. - R_max_trans (int, optional): _description_. Defaults to 100. - w_trans (float, optional): _description_. Defaults to 0.5. - euler_anti_bend (bool, optional): _description_. Defaults to False. - R_max_anti (int, optional): _description_. Defaults to 100. - R_min_anti (int, optional): _description_. Defaults to 10. - A_anti (_type_, optional): _description_. Defaults to None. - res (float, optional): _description_. Defaults to 0.1. - wg_Ltp (int, optional): _description_. Defaults to 5. - dL_p2p (_type_, optional): _description_. Defaults to None. - sharp_patch (bool, optional): _description_. Defaults to True. - show_pins (bool, optional): _description_. Defaults to False. - """ - + self.xs = xs self.R_cp = R_cp self.w_bus = w_bus @@ -182,6 +201,67 @@ class ring_bus_wg : class ADC_STD_2x2: + """ + General-purpose 2×2 adiabatic directional coupler scaffold. + + Parameters + ---------- + name : str, optional + Unique cell identifier (default is None, meaning no instantiation). + xs : str, optional + Registered Nazca cross-section name (default is "strip"). + wu0 : float, optional + Upper waveguide width at the input plane in microns (default is 0.45). + wu1 : float, optional + Upper waveguide width at the output plane in microns (default is 0.61). + wu_in : float, optional + Upper input port width in microns (default is 0.45). + wu_out : float, optional + Upper output port width in microns (default is 0.8). + wd0 : float, optional + Lower waveguide width at the input plane in microns (default is 0.33). + wd1 : float, optional + Lower waveguide width at the output plane in microns (default is 0.2). + wd_in : float, optional + Lower input port width in microns (default is 0.45). + wd_out : float, optional + Lower output port width in microns (default is 0.8). + Lu : int, optional + Interaction length of the upper core in microns (default is 33). + Ld : int, optional + Interaction length of the lower core in microns (default is 33). + angle : int, optional + Sbend deflection angle in degrees (default is 20). + g0 : float, optional + Gap between the two cores at the input plane in microns (default is 0.2). + g1 : float, optional + Gap between the two cores at the output plane in microns (default is 0.2). + sbend_type : str, optional + Type of IO transition ("euler" or "circular", default is "euler"). + Rmax : optional + Maximum Euler bend radius in microns (default is None, meaning auto). + Rmin : int, optional + Minimum Euler bend radius in microns (default is 5). + Ru0 : int, optional + Upper input bend radius in microns (default is 0). + Ru1 : int, optional + Upper output bend radius in microns (default is 20). + Rd0 : int, optional + Lower input bend radius in microns (default is 20). + Rd1 : int, optional + Lower output bend radius in microns (default is 0). + tp_angle : int, optional + Half-angle of straight tapers in degrees when Euler bends are disabled (default is 2). + sharp_patch : bool, optional + Insert chamfer polygons to reduce acute corners (default is True). + show_pins : bool, optional + Draw Nazca stub markers for debugging (default is False). + euler_points : int, optional + Number of sampling points for Euler/Clothoid evaluation (default is 64). + res : float, optional + Geometry discretization step in microns (default is 0.1). + """ + def __init__ (self, name = None, xs='strip', @@ -210,34 +290,6 @@ class ADC_STD_2x2: show_pins=False, euler_points = 64, res = 0.1): - """_summary_ - - Args: - tapeout (_type_): _description_ - xs (str, optional): _description_. Defaults to 'strip'. - wu0 (float, optional): _description_. Defaults to 0.45. - wu1 (float, optional): _description_. Defaults to 0.61. - wu_in (float, optional): _description_. Defaults to 0.45. - wu_out (float, optional): _description_. Defaults to 0.8. - wd0 (float, optional): _description_. Defaults to 0.33. - wd1 (float, optional): _description_. Defaults to 0.20. - wd_in (float, optional): _description_. Defaults to 0.45. - wd_out (float, optional): _description_. Defaults to 0.8. - Lu (int, optional): _description_. Defaults to 33. - Ld (int, optional): _description_. Defaults to 33. - angle (int, optional): _description_. Defaults to 20. - g0 (float, optional): _description_. Defaults to 0.2. - g1 (float, optional): _description_. Defaults to 0.2. - sbend_type (str, optional): _description_. Defaults to 'euler'. - Rmax (_type_, optional): _description_. Defaults to None. - Rmin (int, optional): _description_. Defaults to 5. - Ru0 (int, optional): _description_. Defaults to 0. - Ru1 (int, optional): _description_. Defaults to 20. - Rd0 (int, optional): _description_. Defaults to 20. - Rd1 (int, optional): _description_. Defaults to 0. - tp_angle (int, optional): _description_. Defaults to 2. - sharp_patch (bool, optional): _description_. Defaults to True. - """ self.name = name if (self.name==None): @@ -364,7 +416,7 @@ class ADC_STD_2x2: _dX_ = abs(pin_b2.x - self.Ld) else : - Ltp = np.max([_dX_-5,np.abs(self.wd1+err-self.wd_out)/np.tan(self.tp_angle/180*pi)]) + Ltp = np.abs(self.wd1+err-self.wd_out)/np.tan(self.tp_angle/180*pi) Ltp = int(Ltp*20)*0.05 ## keep it in integer temp = nd.strt(xs=self.xs,length=5,width=self.wd1+err).put(self.Ld,vtx_lower_y[1]/2+vtx_lower_y[-2]/2,0,flip=0) @@ -503,6 +555,40 @@ class ADC_STD_2x2: class DC(ADC_STD_2x2): + """ + Standard symmetric directional coupler wrapper built on ``ADC_STD_2x2``. + + Parameters + ---------- + name : str, optional + Unique cell identifier (default is None, meaning no instantiation). + xs : str, optional + Nazca cross-section key for both guides (default is "strip"). + w_cp : float, optional + Coupling-section core width in microns (default is 0.45). + w_wg : float, optional + IO port width in microns (default is 0.45). + L_cp : float, optional + Coupling-section length in microns (default is 30). + angle : float, optional + Port bend deflection angle in degrees (default is 20). + gap : float, optional + Gap between the two cores in microns (default is 0.2). + sbend_type : str, optional + Type of the IO bend ("euler" or "circular", default is "circular"). + Rmax : float, optional + Maximum Euler radius in microns when "sbend_type" is "euler" (default is None). + Rmin : int, optional + Minimum Euler radius in microns (default is 5). + R0 : int, optional + Circular bend radius in microns applied to both ports (default is 10). + tp_angle : int, optional + Straight taper half-angle in degrees when Euler bends are disabled (default is 2). + sharp_patch : bool, optional + Insert chamfer polygons to avoid acute corners (default is True). + show_pins : bool, optional + Draw Nazca stub markers for debugging (default is False). + """ def __init__(self, name = None, xs:str='strip', @@ -518,23 +604,7 @@ class DC(ADC_STD_2x2): tp_angle:float=2, sharp_patch:bool=True, show_pins:bool=False): - """_summary_ - - Args: - tapeout (_type_): _description_ - xs (str, 'strip' | 'rib' | ...): Nazca xsection of the waveguide. Defaults to 'strip'. - w_cp (float): Width of the coupling area. Defaults to 0.45. - w_wg (float): Width of the port waveguide. Defaults to 0.45. - L_cp (float): Length of the coupling area. Defaults to 30. - angle (float): Bned angle of the port. Defaults to 20. - gap (float): Gap width of the coupling area. Defaults to 0.2. - sbend_type (str, 'euler' | 'circular'): Bend type of the ouput port. Defaults to 'euler'. - Rmax (_type_, optional): Max bending radius of euler. Defaults to None. - Rmin (int, optional): Mini bending radius of euler. Defaults to 5. - R0 (int, optional): Bending radius. Defaults to 10. - tp_angle (int, optional): Taper angle of the w_cp to w_wg tapering. Defaults to 2. - sharp_patch (bool, optional): Add patch to avoid sharp angle. Defaults to True. - """ + super().__init__(name, xs, wu0=w_cp, wu1=w_cp, wu_in=w_wg, wu_out=w_wg, wd0=w_cp, wd1=w_cp, @@ -579,6 +649,36 @@ class DC(ADC_STD_2x2): return C class BS_tdc(ADC_STD_2x2): + """ + Balanced splitter based on asymmetric taper-directional-coupler sections. + + Parameters + ---------- + name : str, optional + Nazca cell name (default is None). + xs : str, optional + Nazca cross-section for both guides (default is "strip"). + wa0 : float, optional + Upper input width in microns (default is 0.35). + wa1 : float, optional + Upper output width in microns (default is 0.45). + wb0 : float, optional + Lower input width in microns (default is 0.55). + wb1 : float, optional + Lower output width in microns (default is 0.45). + w_wg : float, optional + External IO width in microns (default is 0.45). + gap : float, optional + Coupling gap in microns (default is 0.2). + Lt : float, optional + Coupling/taper length in microns (default is 20). + R0 : float, optional + Port bend radius in microns (default is 30). + angle : float, optional + Port bend angle in degrees (default is 15). + sbend_type : str, optional + IO bend type ("circle" or "euler", default is "circle"). + """ def __init__(self, name=None, xs:str ='strip', @@ -593,22 +693,7 @@ class BS_tdc(ADC_STD_2x2): angle:float =15, sbend_type:str ='circle', ): - """_summary_ - - Args: - tapeout (class): foundry used in your design - xs (str, optional): nazca xsection used for the coupler. Defaults to 'strip'. - wa0 (float, optional): Upper waveguide input port width. Defaults to 0.35. - wa1 (float, optional): Upper waveguide ouput port width. Defaults to 0.45. - wb0 (float, optional): Lower waveguide input port width. Defaults to 0.55. - wb1 (float, optional): Lower waveguide ouput port width. Defaults to 0.45. - w_wg (float, optional): The width of the waveguide interface. Defaults to 0.45. - gap (float, optional): Gap width between two waveguides. Defaults to 0.2. - Lt (int, optional): Taper Length of the coupler. Defaults to 20. - R0 (int, optional): The bending radius of the output/input port. Defaults to 30. - angle (int, optional): The angle of the bending of the output/input port. Defaults to 15. - sbend_type (str, optional): The type of the output/input bending, Euler or Circular. Defaults to 'circle'. - """ + super().__init__(name = name, xs=xs, wu0=wa0,wu1=wa1,wu_in=w_wg,wu_out=w_wg, @@ -621,6 +706,50 @@ class BS_tdc(ADC_STD_2x2): class MDM(ADC_STD_2x2): + """ + Mode-division-multiplexing directional coupler derived from ``ADC_STD_2x2``. + + Parameters + ---------- + name : str, optional + Nazca cell name (default is None). + xs : str, optional + Device cross-section key (default is "strip"). + wb0 : float, optional + BUS waveguide width at the input plane in microns (default is 0.45). + wb1 : float, optional + BUS waveguide width at the output plane in microns (default is 0.61). + wb_in : float, optional + BUS input port width in microns (default is 0.45). + wb_out : float, optional + BUS output port width in microns (default is 0.88). + w_wg : float, optional + Coupler-waveguide IO width in microns (default is 0.45). + w0 : float, optional + Coupler waveguide width at the input plane in microns (default is 0.33). + w1 : float, optional + Coupler waveguide width at the output plane in microns (default is 0.2). + gap0 : float, optional + Initial BUS–coupler gap in microns (default is 0.2). + Lt_bus : float, optional + BUS taper length from wb0 to wb1 in microns (default is 20). + R0 : float, optional + Lower-waveguide bend radius in microns (default is 40). + angle : float, optional + Bend deflection angle in degrees (default is 22.5). + Lt_cp : float, optional + Coupler taper length from w0 to w1 in microns (default is None, meaning ``Lt_bus``). + gap1 : float, optional + Final BUS–coupler gap in microns (default is None, meaning ``gap0``). + Lb0 : float, optional + Reserved for future BUS offsets (default is None). + symmetric_BUS : bool, optional + Whether BUS geometry is mirrored (default is True). + single_end : bool, optional + Keep single-ended termination on the coupler arm (default is True). + Rmin : float, optional + Minimum Euler radius in microns for bends (default is 8). + """ def __init__(self, name = None, xs:str='strip', @@ -642,30 +771,6 @@ class MDM(ADC_STD_2x2): single_end:bool =True, Rmin:float =8 ): - """_summary_ - - Args: - tapeout (_type_): _description_ - xs (str): Device waveguide xsection. Defaults to 'strip'. - wb0 (float): Coupling region, **BUS** waveguide starting width. Defaults to 0.45. - wb1 (float): Coupling region, **BUS** waveguide ending width. Defaults to 0.61. - wb_in (float): **BUS** waveguide input width. Defaults to 0.45. - wb_out (float): **BUS** waveguide output width. Defaults to 0.88. - w_wg (float): **coupler** waveguide input width. Defaults to 0.45. - w0 (float): Coupling region, **coupler** waveguide starting width. Defaults to 0.33. - w1 (float): Coupling region, **coupler** waveguide ending width. Defaults to 0.2. - gap0 (float): Gap width at starting. Defaults to 0.2. - Lt_bus (float): Taper length for **BUS** from stating to ending. Defaults to 20. - R0 (float): _description_. Defaults to 40. - angle (float): _description_. Defaults to 22.5. - Lt_cp (float | None): Taper length for **coupler** from stating to ending. Defaults to None. - gap1 (float | None): Gap width at ending, usually not used. Defaults to None. - name (_type_ | None): _description_. Defaults to None. - Lb0 (_type_ | None): _description_. Defaults to None. - symmetric_BUS (bool): **BUS** waveguide type selection, symmetric or not. Defaults to True. - single_end (bool): _description_. Defaults to True. - Rmin (int): For euler bend, the minimum radius. Defaults to 8. - """ self.wb0=wb0 ## BUS waveguide width on the input @@ -753,6 +858,36 @@ class DC_bend : Written by HU GAOLEI at 2022.5.15. ''' + """ + Bend-based directional coupler for broadband, fabrication-tolerant splitting. + + Parameters + ---------- + name : str, optional + Nazca cell name (default is None). + w_in : float, optional + Inner (tight) waveguide width in the coupling region, in microns (default is 0.45). + w_out : float, optional + Outer waveguide width in the coupling region, in microns (default is 0.45). + gap : float, optional + Separation between waveguides in microns (default is 0.2). + r_in : float, optional + Bend radius of the inner waveguide in microns (default is 40). + theta_arc : float, optional + Coupling-arc angle in degrees (default is 30). + w_wg : float, optional + IO waveguide width in microns (default is 0.45). + theta_ext : float, optional + Extra bend angle used to align IO planes in degrees (default is 15). + xs_wg : str, optional + Nazca cross-section for both waveguides (default is "strip"). + sharp_patch : bool, optional + Insert chamfer polygons to smooth acute corners (default is True). + show_pins : bool, optional + Draw Nazca stub markers for debugging (default is False). + """ + + def __init__( self, name = None, @@ -768,18 +903,7 @@ class DC_bend : sharp_patch=True, show_pins=False ): - ''' - Initilization bend directional coupler. - Args: - - w_in [um] Width of the inner waveguide in the coupling region - - w2 [um] Width of the outer waveguide in the coupling region - - gap [um] Gap between two waveguide in the coupling region - - r_in [um] Bend radius of the inner waveguide - - theta_arc [degree] Angle of the coupling region - - w_wg [um] Width of input and output waveguide - ''' - self.name = name if (self.name==None): self.instantiate = False @@ -902,6 +1026,43 @@ class DC_bend : class DC_pX_3sg: + """ + Three-segment phase-tunable directional coupler (pX) generator. + + Parameters + ---------- + name : str, optional + Nazca cell name (default is None). + xs_wg : str, optional + Cross-section key for all segments (default is "strip"). + Lc1 : float, optional + Length of the first coupling segment in microns (default is 10). + Lp1 : float, optional + Phase-shifter length in microns (default is 5). + Lc2 : float, optional + Length of the second coupling segment in microns (default is 10). + Lt : float, optional + Taper length between coupling and phase sections in microns (default is 1). + w_cp : float, optional + Nominal coupling width in microns (default is 0.5). + dw : float, optional + Width offset applied to the phase section in microns (default is 0.1). + gap : float, optional + Vertical spacing between the two cores in microns (default is 0.2). + R0 : float, optional + Bend radius in microns for port transitions (default is 10). + A : float, optional + Bend angle in degrees for port transitions (default is 15). + w_wg : float, optional + External IO width in microns (default is 0.45). + pX_type : str, optional + Phase-section topology ("symmetric" or "asymmetric", default is "symmetric"). + port_symmetric : bool, optional + Use mirrored port routing for both arms (default is True). + sharp_patch : bool, optional + Insert chamfer polygons to mitigate sharp tips (default is True). + """ + def __init__(self, name = None, xs_wg:str='strip', diff --git a/primitives/edge_couplers/EC_dual_layer_px3.py b/mxpic/components/primitives/edge_couplers/EC_dual_layer_px3.py similarity index 99% rename from primitives/edge_couplers/EC_dual_layer_px3.py rename to mxpic/components/primitives/edge_couplers/EC_dual_layer_px3.py index 497bf6d..794d5a0 100644 --- a/primitives/edge_couplers/EC_dual_layer_px3.py +++ b/mxpic/components/primitives/edge_couplers/EC_dual_layer_px3.py @@ -1,7 +1,8 @@ import nazca as nd import numpy as np -from ...strurctures import _my_polygon +from mxpic.structures import _my_polygon +# from ....structures import _my_polygon class EC_dual_layer_px3(): """ diff --git a/primitives/grating_couplers/grating_couplers.py b/mxpic/components/primitives/grating_couplers/grating_couplers.py similarity index 81% rename from primitives/grating_couplers/grating_couplers.py rename to mxpic/components/primitives/grating_couplers/grating_couplers.py index 02c7fc3..ecfc2f8 100644 --- a/primitives/grating_couplers/grating_couplers.py +++ b/mxpic/components/primitives/grating_couplers/grating_couplers.py @@ -1,38 +1,48 @@ import nazca as nd import numpy as np import math - -from ..structures import * -from ..structures import _my_polygon -from ..basic import __cell_arg__ -from ..routing import Route - import pandas as pd +from ....routing import Route +from ....structures import _my_polygon,circle,Clothoid,hole +from ....basic import __cell_arg__ + + ''' Class for nanoantenna ''' class Nano_ant(): - - """Class of nanoantenna for optical phased array. - - This is the class of nanoantenna for optical phased array. GDS cell can be generated using this class. Simulation structure generation and simulation results analysis is going to be added in the future. - - Args: - - tapeout [class] (Default: CUMEC_CSiP130Cu) - - w_wg [um] (Default: 0.5um) - Width of input waveguide - - vector [um] (Default: [0.5,..,0.5]]) - Vectors to define the length of each teeth - - taper_length [um] (Default: 1um) - Length of the linear taper region - - width [um] (Default: 3um) - Width of the nanoantenna - - max_theta [degree](Default: 110) - Open degree of linear taper - - define_type [str] (Default: non-periodic) - Way to define the antenna, including: "non-periodic", "periodic" - - etch_depth [str] (Default: "DETCH") - Define the etch depth, including: "FETCH", "METCH", "SETCH" """ + Configure a nano-antenna for optical phased-array grating couplers. + + This is the class of nanoantenna for optical phased array. GDS cell can be generated using this class. Simulation structure generation and simulation results analysis is going to be added in the future. + + Parameters + ---------- + w_wg : float, optional + Input waveguide width in microns (default is 0.41). + xs_wg : str, optional + Nazca cross-section key for the feed waveguide (default is "strip"). + define_type : str, optional + Antenna definition scheme, either "non-periodic" or "periodic" (default is "non-periodic"). + vector : Sequence[float], optional + Alternating etched/filled segment lengths (µm) when ``define_type`` is "non-periodic" + (default is ``[0.5, 0.5, 0.5, 0.5, 0.5, 0.5]``). + taper_length : float, optional + Linear taper length preceding the teeth region in microns (default is 3). + width : float, optional + Maximum aperture width in microns (default is 6). + max_theta : float, optional + Fan-out opening angle in degrees (default is 110). + pitch : float or Sequence[float], optional + Tooth pitch (µm) when ``define_type`` is "periodic"; scalar applies to all periods (default is 0.6). + duty_cycle : float or Sequence[float], optional + Etched fraction per period for periodic antennas; scalar or dual-entry list for dual-etch (default is 0.3). + teeth_number : int, optional + Number of etched teeth when periodic mode is used (default is 6). + etch_depth : Sequence[str], optional + List of etch-depth identifiers ("FETCH", "METCH", "SETCH"); length determines single/dual etch (default is ["METCH"]). + show_pins : bool, optional + Draw Nazca stub markers on exported pins (default is True). + """ def __init__( self, @@ -40,15 +50,15 @@ class Nano_ant(): xs_wg: str = "strip", define_type: str = "non-periodic", - vector: float = [0.5, 0.5, 0.5, 0.5, 0.5, 0.5], + vector: 'float|list' = [0.5, 0.5, 0.5, 0.5, 0.5, 0.5], taper_length: float = 3, width: float = 6, max_theta: float = 110, - pitch: float = 0.6, - duty_cycle: float = 0.3, + pitch: 'float|list' = 0.6, + duty_cycle: 'float|list' = 0.3, teeth_number: float = 6, - etch_depth: str = ["METCH"], + etch_depth: 'str|list' = ["METCH"], show_pins: bool = True ): # Init and save the input parameters @@ -191,7 +201,22 @@ class Nano_ant(): ''' Class for 2D antenna array for FMF grating ''' class Taper() : + """ + Create a stand-alone planar taper cell for 2D antenna feeds. + Parameters + ---------- + width1 : float, optional + Input width in microns (default is 4). + width2 : float, optional + Output width in microns (default is 0.45). + length : float, optional + Physical taper length in microns (default is 30). + type : str, optional + Transition profile, "linear" or "parabolic" (default is "linear"). + show_pins : bool, optional + Draw Nazca stub markers for debugging (default is False). + """ def __init__(self, width1=4, width2=0.45, length=30, type="linear", show_pins=False) -> None: self.width1 = width1 self.width2 = width2 @@ -251,9 +276,37 @@ class Taper() : class Grating_2D_Hole() : - ''' - This is a class for 2D Grating in IMEC. - ''' + """ + Define a single 2D hole-array grating (diffraction + reflector + taper). + This is a class for 2D Grating in IMEC. + + Parameters + ---------- + w_wg : float, optional + Feed waveguide width in microns (default is 0.5). + w_gt : float, optional + Square grating aperture width in microns (default is 5). + l_taper : float, optional + Taper length from grating to feed in microns (default is 30). + type_taper : str, optional + Taper profile ("linear" or "parabolic", default is "parabolic"). + gt_vector : Sequence[float], optional + Pitch list (µm) for the main etched holes (default is ``[0.5, 0.5, 0.5, 0.5, 0.5]``). + gt_diameter : float, optional + Diameter of the main holes in microns (default is 0.4). + gt_layer : str, optional + Nazca layer name used for the main holes (default is "STRIP_COR"). + polysi_vector : Sequence[float], optional + Pitch list (µm) for polysilicon holes (default is ``[0.5, 0.5, 0.5, 0.5, 0.5]``). + polysi_diameter : float, optional + Diameter of polysilicon holes in microns (default is 0.4). + polysi_layer : str, optional + Layer name for polysilicon etch (default is "FCW_TRE"). + reflector_vector : Sequence[float], optional + Alternating reflector spacing/width values in microns (default is ``[0.3, 0.3, 0.3, 0.3, 0.3, 0.3]``). + l_field_center : float, optional + Offset from the grating edge to the mode-field center in microns (default is 1). + """ def __init__( self, w_wg=0.5, @@ -342,7 +395,20 @@ class Grating_2D_Hole() : return ic class Grating_2D_Hole_4Rec() : + """ + Assemble four identical 2D hole gratings into a rectangular array. + Parameters + ---------- + grating_unit : Grating_2D_Hole + Pre-built grating instance supplying the unit cell. + mode_radius : float, optional + Radius of the target circular fiber mode in microns (default is 8). + cell_name : str or None, optional + Nazca cell name suffix; ``None`` uses "TwoD_Grating" (default is None). + show_pins : bool, optional + Draw Nazca stub markers on exported IO pins (default is False). + """ def __init__(self, grating_unit, mode_radius=8, cell_name=None, show_pins=False) -> None: self.gt_2D_class = grating_unit self.cell_unit = grating_unit.cell @@ -414,7 +480,20 @@ class Grating_2D_Hole_4Rec() : return ic class Grating_2D_Hole_3Rec() : + """ + Assemble three identical 2D hole gratings in triangular symmetry. + Parameters + ---------- + grating_unit : Grating_2D_Hole + Source grating instance providing the layout cell. + mode_radius : float, optional + Radius of the circumscribed fiber mode in microns (default is 6.5). + cell_name : str or None, optional + Custom Nazca cell name suffix (default is None). + show_pins : bool, optional + Draw Nazca stub markers on exported IO pins (default is False). + """ def __init__(self, grating_unit, mode_radius=6.5, cell_name=None, show_pins=False) -> None: self.gt_2D_class = grating_unit self.cell_unit = grating_unit.cell @@ -483,6 +562,63 @@ class Grating_2D_Hole_3Rec() : """ Renamed for simplification in 2023.04.02 """ class GC_STD_2D: + """ + General-purpose 2D grating coupler generator with rectangular or arc shapes. + + Parameters + ---------- + name : str, optional + Nazca cell name (default is None, meaning uninstantiated cell). + etch_type : str, optional + Etch depth selector: "FETCH", "METCH", or "SETCH" (default is "FETCH"). + xs_wg : str, optional + Cross-section for the grating slab and output waveguide (default is "grating"). + Dx_hole : float or Sequence[float], optional + Hole size along x (µm). Scalar applies to all columns (default is 0.3). + Dy_hole : float or Sequence[float], optional + Hole size along y (µm). Scalar applies to all rows (default is 0.3). + hole_shape : str, optional + Individual hole shape, "circle" or "rectangle" (default is "circle"). + shape : str, optional + Overall grating footprint, "circle", "arc", or "rectangle" (default is "circle"). + xs_open : str or None, optional + Optional open-area cross-section for keep-out regions (default is None). + Px : float or Sequence[float], optional + Periods along x in microns; scalar broadcasts (default is 0.57). + Py : float or Sequence[float], optional + Periods along y in microns; scalar broadcasts (default is 0.57). + num_x : int, optional + Number of periods along x when ``Px`` is scalar (default is 25). + num_y : int, optional + Number of periods along y when ``Py`` is scalar (default is 25). + Lx_taper : float, optional + Horizontal taper length to the output port in microns (default is 50). + Ly_taper : float, optional + Vertical taper length in microns (default is 0). + Lx_end : float, optional + Extra straight length appended to the positive-x end (default is 1). + Ly_end : float, optional + Extra straight length appended to the +/-y ends (default is 1). + Lx_side : float, optional + Lateral margin on the +/−x sides in microns (default is 0.5). + Ly_side : float, optional + Lateral margin on the +/−y sides in microns (default is 0.5). + Lx_port : float, optional + Straight-section length after the x-port taper in microns (default is 5). + Ly_port : float, optional + Straight-section length after the y-port taper in microns (default is 5). + w_wg : float, optional + Output waveguide width in microns (default is 0.5). + show_pins : bool, optional + Draw Nazca stub markers (default is False). + P_AR : float, optional + Anti-reflection pitch in microns (default is 0.6). + L_AR : float, optional + Anti-reflection taper length in microns (default is 1). + + Raises: + Exception: Period do not match D_hole + """ def __init__(self, name=None, etch_type :str = 'FETCH', @@ -509,33 +645,7 @@ class GC_STD_2D: P_AR: float = 0.6, L_AR: float = 1, ): - """_summary_ - - Args: - etch_type (str, optional): Three etch depth for election , full-etch = "FETCH", middle etch = "METCH", shallow etch = "ETCH". Defaults to 'FETCH'. - xs_wg (str, optional): xsection of the grating and also the output waveguide. Defaults to 'grating'. - Dx_hole (float, optional): size X of the hole, when in 'circle' hole selection ,this is the Diameter of your hole . Defaults to 0.3. - Dy_hole (float, optional): size Y of the hole, when in 'circle' hole selection ,this is the Diameter of your hole . Defaults to 0.3. - hole_shape (str, 'circle' | 'rectangel'): shape of the hole. Defaults to 'circle'. - shape (str, 'circle' | 'rectangel'): shape of the grating. Defaults to 'circle'. - Px (float, optional): Period distance X. Defaults to 0.57. - Py (float, optional): Period distance Y. Defaults to 0.57. - num_x (int, optional): number of pitches. Defaults to 25. - num_y (int, optional): number of pitches. Defaults to 25. - Lx_taper (int, optional): taper connection to the port. Defaults to 50. - Ly_taper (int, optional): taper connection to the port. Defaults to 0. - Lx_end (int, optional): length arratched to the end. Defaults to 5. - Ly_end (int, optional): length arratched to the end. Defaults to 3. - Lx_side (float, optional): side expansion. Defaults to 0.5. - Ly_side (float, optional): side expansion. Defaults to 0.5. - Lx_port (int, optional): output port length expansion. Defaults to 5. - Ly_port (int, optional): output port length expansion. Defaults to 5. - w_wg (float, optional): output port width. Defaults to 0.5. - show_pins (bool, optional): _description_. Defaults to False. - - Raises: - Exception: Period do not match D_hole - """ + self.name = name if (self.name==None): self.instantiate = False @@ -772,6 +882,44 @@ class GC_STD_2D: return C class GC_STD_1D: + """ + Versatile 1D grating coupler supporting sector and rectangular layouts. + + Parameters + ---------- + name : str, optional + Nazca cell name (default is None). + xs_wg : str, optional + Cross-section key for the slab/taper region (default is "strip"). + w_wg : float, optional + Input waveguide width in microns (default is 0.5). + etch_type : str, optional + Etch depth selector: "FETCH", "METCH", or "SETCH" (default is "FETCH"). + xs_open : str or None, optional + Optional cross-section for keep-out/open regions (default is None). + L_taper : float, optional + Length of the entrance taper in microns (default is 10). + L_end : float, optional + Terminal slab length after the grating in microns (default is 2). + A_taper : float, optional + Fan-out angle in degrees (default is 30). + Period : float or Sequence[float], optional + Grating periods in microns; scalar broadcasts (default is 0.5). + eta_etch : float or Sequence[float], optional + Etch duty (between 0 and 1) per period (default is 0.5). + num : int, optional + Number of periods when ``Period`` and ``eta_etch`` are scalars (default is 20). + sector_gc : bool, optional + Use sector (True) or rectangular (False) geometry (default is True). + show_pins : bool, optional + Draw Nazca stub markers (default is False). + L_tail : float, optional + Extra straight length added before the taper in microns (default is 2). + P_AR : float, optional + Anti-reflection pitch in microns (default is 1). + L_AR : float, optional + Anti-reflection taper length in microns (default is 2). + """ def __init__ (self, name=None, xs_wg : str = 'strip', @@ -1073,6 +1221,20 @@ class GC_STD_1D: return C class FA: + """ + Instantiate a fiber-array fanout from repeated grating/fiber couplers. + + Parameters + ---------- + fiber_coupler : nd.Cell or object + Reference coupler cell or instance exposing ``cell`` and pin ``g1``/``a0``. + pitch : float, optional + Center-to-center spacing between adjacent couplers in microns. + number : int + Total number of channels in the array. + show_pins : bool, optional + Draw Nazca stub markers on exported pins (default is False). + """ def __init__(self,fiber_coupler,pitch,number,show_pins=False): # if (isinstance(fiber_coupler,nd.Cell)): diff --git a/mxpic/core/generate_license.py b/mxpic/core/generate_license.py new file mode 100644 index 0000000..60ecd20 --- /dev/null +++ b/mxpic/core/generate_license.py @@ -0,0 +1,39 @@ +import hmac +import hashlib +import json +from datetime import datetime, timedelta + +# This is your master key. NEVER share this or put it in public code. +SECRET_KEY = b"mxPIC_Super_Secret_Master_Key_2026!" + +def generate_license(mac_address: str, days_valid: int, output_file: str = "mxpic.lic"): + """Generates a cryptographically signed license file.""" + + # Calculate the expiration date + expiration = (datetime.now() + timedelta(days=days_valid)).strftime("%Y-%m-%d") + + # Create the payload message we want to sign + message = f"{mac_address}|{expiration}".encode('utf-8') + + # Generate the unforgeable signature using HMAC + SHA256 + signature = hmac.new(SECRET_KEY, message, hashlib.sha256).hexdigest() + + # Create the license dictionary + license_data = { + "mac_address": mac_address, + "expiration": expiration, + "signature": signature + } + + # Save to file + with open(output_file, "w") as f: + json.dump(license_data, f, indent=4) + + # + print(f"✅ License generated for MAC {mac_address}") + print(f"✅ Expires on {expiration}") + print(f"✅ Saved to {output_file}") + +if __name__ == "__main__": + # Example: Customer sends MAC "A1:B2:C3:D4:E5:F6", they bought a 1-year license + generate_license("D4:54:8B:F1:46:49", days_valid=365,output_file="mxpic.lic") \ No newline at end of file diff --git a/mxpic/core/license_check.py b/mxpic/core/license_check.py new file mode 100644 index 0000000..c8cb6e8 --- /dev/null +++ b/mxpic/core/license_check.py @@ -0,0 +1,81 @@ +import uuid +import hmac +import hashlib +import json +import sys +import os +from datetime import datetime +from pathlib import Path + +# This MUST match the key in your generator exactly. +# Because this file is compiled via Cython to a .so/.pyd file, +# This MUST match the key in your generator exactly. +_SECRET_KEY = b"mxPIC_Super_Secret_Master_Key_2026!" +_ENV_VAR_NAME = "LIC_MXPIC_OPTIHK_DIR" + +def _get_local_mac() -> str: + """Retrieves the physical MAC address of the current machine.""" + mac = uuid.getnode() + return ':'.join(("%012X" % mac)[i:i+2] for i in range(0, 12, 2)) + +def _locate_license_file() -> Path: + """Intelligently resolves the path to the license file.""" + env_path_str = os.getenv(_ENV_VAR_NAME) + + if env_path_str: + path_obj = Path(env_path_str) + # If the user pointed to a directory, append the default filename + if path_obj.is_dir(): + return path_obj / "mxpic.lic" + # Otherwise, assume they pointed directly to the file itself + return path_obj + else: + # Fallback: Look in the current working directory where the script is run + return Path("mxpic.lic") + +def verify_license() -> None: + """Verifies the license file. Halts execution if invalid.""" + + lic_file = _locate_license_file() + + if not lic_file.exists(): + print(f"\n❌ mxPIC FATAL ERROR: License file not found.") + print(f"Searched at: {lic_file.resolve()}") + print(f"Please set the '{_ENV_VAR_NAME}' environment variable to point to your license file.") + sys.exit(1) + + try: + with open(lic_file, "r", encoding="utf-8") as f: + lic = json.load(f) + + local_mac = _get_local_mac() + + # 1. Check MAC match + if lic["mac_address"] != local_mac: + print(f"\n❌ mxPIC FATAL ERROR: License registered to different machine.") + print(f"Registered: {lic['mac_address']} | Local: {local_mac}") + sys.exit(1) + + # 2. Check Expiration + exp_date = datetime.strptime(lic["expiration"], "%Y-%m-%d") + if datetime.now() > exp_date: + print(f"\n❌ mxPIC FATAL ERROR: License expired on {lic['expiration']}.") + sys.exit(1) + + # 3. Verify Signature + message = f"{lic['mac_address']}|{lic['expiration']}".encode('utf-8') + expected_sig = hmac.new(_SECRET_KEY, message, hashlib.sha256).hexdigest() + + if not hmac.compare_digest(expected_sig, lic["signature"]): + print("\n❌ mxPIC FATAL ERROR: License signature is corrupted or forged.") + sys.exit(1) + + except json.JSONDecodeError: + print(f"\n❌ mxPIC FATAL ERROR: License file is corrupted (invalid JSON).") + sys.exit(1) + except KeyError as e: + print(f"\n❌ mxPIC FATAL ERROR: License file is missing required data: {e}") + sys.exit(1) + except Exception as e: + print(f"\n❌ mxPIC FATAL ERROR: Failed to read license. {e}") + sys.exit(1) \ No newline at end of file diff --git a/docs/Makefile b/mxpic/docs/Makefile similarity index 100% rename from docs/Makefile rename to mxpic/docs/Makefile diff --git a/mxpic/docs/build/doctrees/environment.pickle b/mxpic/docs/build/doctrees/environment.pickle new file mode 100644 index 0000000..ea1b745 Binary files /dev/null and b/mxpic/docs/build/doctrees/environment.pickle differ diff --git a/mxpic/docs/build/doctrees/index.doctree b/mxpic/docs/build/doctrees/index.doctree new file mode 100644 index 0000000..e93d6aa Binary files /dev/null and b/mxpic/docs/build/doctrees/index.doctree differ diff --git a/mxpic/docs/build/doctrees/mxpic/components/primitives/directional_couplers/directional_couplers.doctree b/mxpic/docs/build/doctrees/mxpic/components/primitives/directional_couplers/directional_couplers.doctree new file mode 100644 index 0000000..fb8940a Binary files /dev/null and b/mxpic/docs/build/doctrees/mxpic/components/primitives/directional_couplers/directional_couplers.doctree differ diff --git a/mxpic/docs/build/doctrees/mxpic/components/primitives/edge_couplers/EC_dual_layer_px3.doctree b/mxpic/docs/build/doctrees/mxpic/components/primitives/edge_couplers/EC_dual_layer_px3.doctree new file mode 100644 index 0000000..2be34a0 Binary files /dev/null and b/mxpic/docs/build/doctrees/mxpic/components/primitives/edge_couplers/EC_dual_layer_px3.doctree differ diff --git a/mxpic/docs/build/doctrees/mxpic/components/primitives/grating_couplers/grating_couplers.doctree b/mxpic/docs/build/doctrees/mxpic/components/primitives/grating_couplers/grating_couplers.doctree new file mode 100644 index 0000000..be9cffd Binary files /dev/null and b/mxpic/docs/build/doctrees/mxpic/components/primitives/grating_couplers/grating_couplers.doctree differ diff --git a/docs/build/html/.buildinfo b/mxpic/docs/build/html/.buildinfo similarity index 82% rename from docs/build/html/.buildinfo rename to mxpic/docs/build/html/.buildinfo index d7fe37a..a9a9598 100644 --- a/docs/build/html/.buildinfo +++ b/mxpic/docs/build/html/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: be816ea2c3cdf6e3cdbe94c30599652d +config: ec3e07af3f4b33dda3e0c115a231056a tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/mxpic/docs/build/html/_sources/index.md.txt b/mxpic/docs/build/html/_sources/index.md.txt new file mode 100644 index 0000000..61ac5c7 --- /dev/null +++ b/mxpic/docs/build/html/_sources/index.md.txt @@ -0,0 +1,13 @@ +.. mxpic_handbook documentation master file, created by +sphinx-quickstart on Sun May 3 16:05:57 2026. +You can adapt this file completely to your liking, but it should at least +contain the root `toctree` directive. + +# Welcome to the automated documentation for the mxPIC silicon photonics library. +```{toctree} + :maxdepth: 2 + :caption: Components: + +mxpic/components/primitives/directional_couplers/directional_couplers +mxpic/components/primitives/edge_couplers/EC_dual_layer_px3 +mxpic/components/primitives/grating_couplers/grating_couplers diff --git a/mxpic/docs/build/html/_sources/mxpic/components/primitives/directional_couplers/directional_couplers.md.txt b/mxpic/docs/build/html/_sources/mxpic/components/primitives/directional_couplers/directional_couplers.md.txt new file mode 100644 index 0000000..b4da1d5 --- /dev/null +++ b/mxpic/docs/build/html/_sources/mxpic/components/primitives/directional_couplers/directional_couplers.md.txt @@ -0,0 +1,7 @@ +# mxpic\components\primitives\directional_couplers\directional_couplers + ```{eval-rst} + .. automodule:: mxpic.components.primitives.directional_couplers.directional_couplers + :members: + :undoc-members: + :show-inheritance: +``` diff --git a/mxpic/docs/build/html/_sources/mxpic/components/primitives/edge_couplers/EC_dual_layer_px3.md.txt b/mxpic/docs/build/html/_sources/mxpic/components/primitives/edge_couplers/EC_dual_layer_px3.md.txt new file mode 100644 index 0000000..89b7496 --- /dev/null +++ b/mxpic/docs/build/html/_sources/mxpic/components/primitives/edge_couplers/EC_dual_layer_px3.md.txt @@ -0,0 +1,7 @@ +# mxpic\components\primitives\edge_couplers\EC_dual_layer_px3 + ```{eval-rst} + .. automodule:: mxpic.components.primitives.edge_couplers.EC_dual_layer_px3 + :members: + :undoc-members: + :show-inheritance: +``` diff --git a/mxpic/docs/build/html/_sources/mxpic/components/primitives/grating_couplers/grating_couplers.md.txt b/mxpic/docs/build/html/_sources/mxpic/components/primitives/grating_couplers/grating_couplers.md.txt new file mode 100644 index 0000000..1342cc7 --- /dev/null +++ b/mxpic/docs/build/html/_sources/mxpic/components/primitives/grating_couplers/grating_couplers.md.txt @@ -0,0 +1,7 @@ +# mxpic\components\primitives\grating_couplers\grating_couplers + ```{eval-rst} + .. automodule:: mxpic.components.primitives.grating_couplers.grating_couplers + :members: + :undoc-members: + :show-inheritance: +``` diff --git a/docs/build/html/_static/basic.css b/mxpic/docs/build/html/_static/basic.css similarity index 100% rename from docs/build/html/_static/basic.css rename to mxpic/docs/build/html/_static/basic.css diff --git a/docs/build/html/_static/doctools.js b/mxpic/docs/build/html/_static/doctools.js similarity index 100% rename from docs/build/html/_static/doctools.js rename to mxpic/docs/build/html/_static/doctools.js diff --git a/docs/build/html/_static/documentation_options.js b/mxpic/docs/build/html/_static/documentation_options.js similarity index 100% rename from docs/build/html/_static/documentation_options.js rename to mxpic/docs/build/html/_static/documentation_options.js diff --git a/docs/build/html/_static/file.png b/mxpic/docs/build/html/_static/file.png similarity index 100% rename from docs/build/html/_static/file.png rename to mxpic/docs/build/html/_static/file.png diff --git a/docs/build/html/_static/language_data.js b/mxpic/docs/build/html/_static/language_data.js similarity index 100% rename from docs/build/html/_static/language_data.js rename to mxpic/docs/build/html/_static/language_data.js diff --git a/docs/build/html/_static/minus.png b/mxpic/docs/build/html/_static/minus.png similarity index 100% rename from docs/build/html/_static/minus.png rename to mxpic/docs/build/html/_static/minus.png diff --git a/docs/build/html/_static/plus.png b/mxpic/docs/build/html/_static/plus.png similarity index 100% rename from docs/build/html/_static/plus.png rename to mxpic/docs/build/html/_static/plus.png diff --git a/docs/build/html/_static/pygments.css b/mxpic/docs/build/html/_static/pygments.css similarity index 100% rename from docs/build/html/_static/pygments.css rename to mxpic/docs/build/html/_static/pygments.css diff --git a/docs/build/html/_static/scripts/bootstrap.js b/mxpic/docs/build/html/_static/scripts/bootstrap.js similarity index 100% rename from docs/build/html/_static/scripts/bootstrap.js rename to mxpic/docs/build/html/_static/scripts/bootstrap.js diff --git a/docs/build/html/_static/scripts/bootstrap.js.LICENSE.txt b/mxpic/docs/build/html/_static/scripts/bootstrap.js.LICENSE.txt similarity index 100% rename from docs/build/html/_static/scripts/bootstrap.js.LICENSE.txt rename to mxpic/docs/build/html/_static/scripts/bootstrap.js.LICENSE.txt diff --git a/docs/build/html/_static/scripts/bootstrap.js.map b/mxpic/docs/build/html/_static/scripts/bootstrap.js.map similarity index 100% rename from docs/build/html/_static/scripts/bootstrap.js.map rename to mxpic/docs/build/html/_static/scripts/bootstrap.js.map diff --git a/docs/build/html/_static/scripts/fontawesome.js b/mxpic/docs/build/html/_static/scripts/fontawesome.js similarity index 100% rename from docs/build/html/_static/scripts/fontawesome.js rename to mxpic/docs/build/html/_static/scripts/fontawesome.js diff --git a/docs/build/html/_static/scripts/fontawesome.js.LICENSE.txt b/mxpic/docs/build/html/_static/scripts/fontawesome.js.LICENSE.txt similarity index 100% rename from docs/build/html/_static/scripts/fontawesome.js.LICENSE.txt rename to mxpic/docs/build/html/_static/scripts/fontawesome.js.LICENSE.txt diff --git a/docs/build/html/_static/scripts/fontawesome.js.map b/mxpic/docs/build/html/_static/scripts/fontawesome.js.map similarity index 100% rename from docs/build/html/_static/scripts/fontawesome.js.map rename to mxpic/docs/build/html/_static/scripts/fontawesome.js.map diff --git a/docs/build/html/_static/scripts/pydata-sphinx-theme.js b/mxpic/docs/build/html/_static/scripts/pydata-sphinx-theme.js similarity index 100% rename from docs/build/html/_static/scripts/pydata-sphinx-theme.js rename to mxpic/docs/build/html/_static/scripts/pydata-sphinx-theme.js diff --git a/docs/build/html/_static/scripts/pydata-sphinx-theme.js.map b/mxpic/docs/build/html/_static/scripts/pydata-sphinx-theme.js.map similarity index 100% rename from docs/build/html/_static/scripts/pydata-sphinx-theme.js.map rename to mxpic/docs/build/html/_static/scripts/pydata-sphinx-theme.js.map diff --git a/docs/build/html/_static/searchtools.js b/mxpic/docs/build/html/_static/searchtools.js similarity index 100% rename from docs/build/html/_static/searchtools.js rename to mxpic/docs/build/html/_static/searchtools.js diff --git a/docs/build/html/_static/sphinx_highlight.js b/mxpic/docs/build/html/_static/sphinx_highlight.js similarity index 100% rename from docs/build/html/_static/sphinx_highlight.js rename to mxpic/docs/build/html/_static/sphinx_highlight.js diff --git a/docs/build/html/_static/styles/pydata-sphinx-theme.css b/mxpic/docs/build/html/_static/styles/pydata-sphinx-theme.css similarity index 100% rename from docs/build/html/_static/styles/pydata-sphinx-theme.css rename to mxpic/docs/build/html/_static/styles/pydata-sphinx-theme.css diff --git a/docs/build/html/_static/styles/pydata-sphinx-theme.css.map b/mxpic/docs/build/html/_static/styles/pydata-sphinx-theme.css.map similarity index 100% rename from docs/build/html/_static/styles/pydata-sphinx-theme.css.map rename to mxpic/docs/build/html/_static/styles/pydata-sphinx-theme.css.map diff --git a/docs/build/html/_static/styles/theme.css b/mxpic/docs/build/html/_static/styles/theme.css similarity index 100% rename from docs/build/html/_static/styles/theme.css rename to mxpic/docs/build/html/_static/styles/theme.css diff --git a/docs/build/html/_static/vendor/fontawesome/webfonts/fa-brands-400.ttf b/mxpic/docs/build/html/_static/vendor/fontawesome/webfonts/fa-brands-400.ttf similarity index 100% rename from docs/build/html/_static/vendor/fontawesome/webfonts/fa-brands-400.ttf rename to mxpic/docs/build/html/_static/vendor/fontawesome/webfonts/fa-brands-400.ttf diff --git a/docs/build/html/_static/vendor/fontawesome/webfonts/fa-brands-400.woff2 b/mxpic/docs/build/html/_static/vendor/fontawesome/webfonts/fa-brands-400.woff2 similarity index 100% rename from docs/build/html/_static/vendor/fontawesome/webfonts/fa-brands-400.woff2 rename to mxpic/docs/build/html/_static/vendor/fontawesome/webfonts/fa-brands-400.woff2 diff --git a/docs/build/html/_static/vendor/fontawesome/webfonts/fa-regular-400.ttf b/mxpic/docs/build/html/_static/vendor/fontawesome/webfonts/fa-regular-400.ttf similarity index 100% rename from docs/build/html/_static/vendor/fontawesome/webfonts/fa-regular-400.ttf rename to mxpic/docs/build/html/_static/vendor/fontawesome/webfonts/fa-regular-400.ttf diff --git a/docs/build/html/_static/vendor/fontawesome/webfonts/fa-regular-400.woff2 b/mxpic/docs/build/html/_static/vendor/fontawesome/webfonts/fa-regular-400.woff2 similarity index 100% rename from docs/build/html/_static/vendor/fontawesome/webfonts/fa-regular-400.woff2 rename to mxpic/docs/build/html/_static/vendor/fontawesome/webfonts/fa-regular-400.woff2 diff --git a/docs/build/html/_static/vendor/fontawesome/webfonts/fa-solid-900.ttf b/mxpic/docs/build/html/_static/vendor/fontawesome/webfonts/fa-solid-900.ttf similarity index 100% rename from docs/build/html/_static/vendor/fontawesome/webfonts/fa-solid-900.ttf rename to mxpic/docs/build/html/_static/vendor/fontawesome/webfonts/fa-solid-900.ttf diff --git a/docs/build/html/_static/vendor/fontawesome/webfonts/fa-solid-900.woff2 b/mxpic/docs/build/html/_static/vendor/fontawesome/webfonts/fa-solid-900.woff2 similarity index 100% rename from docs/build/html/_static/vendor/fontawesome/webfonts/fa-solid-900.woff2 rename to mxpic/docs/build/html/_static/vendor/fontawesome/webfonts/fa-solid-900.woff2 diff --git a/docs/build/html/_static/webpack-macros.html b/mxpic/docs/build/html/_static/webpack-macros.html similarity index 100% rename from docs/build/html/_static/webpack-macros.html rename to mxpic/docs/build/html/_static/webpack-macros.html diff --git a/mxpic/docs/build/html/genindex.html b/mxpic/docs/build/html/genindex.html new file mode 100644 index 0000000..f8ccaaa --- /dev/null +++ b/mxpic/docs/build/html/genindex.html @@ -0,0 +1,560 @@ + + + + + + + + + + Index — mxpic_handbook mxpic documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+ +
+ + + + + +
+
+ + + + + + + + +
+ + +
+
+ +
+ + + + + +
+ + +

Index

+ +
+ A + | B + | D + | E + | F + | G + | M + | N + | R + | T + +
+

A

+ + +
+ +

B

+ + +
+ +

D

+ + + +
+ +

E

+ + +
+ +

F

+ + +
+ +

G

+ + + +
+ +

M

+ + + +
    +
  • + mxpic.components.primitives.directional_couplers.directional_couplers + +
  • +
  • + mxpic.components.primitives.edge_couplers.EC_dual_layer_px3 + +
  • +
  • + mxpic.components.primitives.grating_couplers.grating_couplers + +
  • +
+ +

N

+ + +
+ +

R

+ + +
+ +

T

+ + +
+ + + +
+ + + + + +
+ +
+
+
+ +
+ + + + +
+
+ +
+ +
+
+
+ + + + + +
+ + +
+ + \ No newline at end of file diff --git a/docs/build/html/index.html b/mxpic/docs/build/html/index.html similarity index 57% rename from docs/build/html/index.html rename to mxpic/docs/build/html/index.html index b57dca9..f31f18e 100644 --- a/docs/build/html/index.html +++ b/mxpic/docs/build/html/index.html @@ -8,7 +8,7 @@ - mxpic_handbook documentation — mxpic_handbook mxpic documentation + Welcome to the automated documentation for the mxPIC silicon photonics library. — mxpic_handbook mxpic documentation @@ -44,7 +44,7 @@ - + @@ -109,7 +109,7 @@ -

mxPIC Handbook

+

mxpic_handbook mxpic documentation

@@ -124,8 +124,22 @@