|
| 1 | +import shutil |
| 2 | + |
| 3 | +from tidy3d.config import get_manager |
| 4 | + |
| 5 | +from photonforge import pda |
| 6 | + |
| 7 | +import siepic_forge as siepic |
| 8 | +from siepic_forge.component import _component_data |
| 9 | + |
| 10 | +get_manager().switch_profile("dev") |
| 11 | + |
| 12 | + |
| 13 | +def create_library(): |
| 14 | + techs = siepic.ebeam_si(), siepic.ebeam_sin() |
| 15 | + |
| 16 | + name = "SiEPIC EBeam" |
| 17 | + version = techs[0].version |
| 18 | + |
| 19 | + for lib in pda.list_libraries(name): |
| 20 | + if lib["version"] == version: |
| 21 | + print("Library already exists: " + str(lib)) |
| 22 | + return |
| 23 | + |
| 24 | + components = [ |
| 25 | + siepic.component(n, techs[0 if _component_data[n][0] == "EBeam" else 1]) |
| 26 | + for n in siepic.component_names |
| 27 | + ] |
| 28 | + |
| 29 | + project = pda.create_project( |
| 30 | + name=name, |
| 31 | + description="SiEPIC EBeam Si and SiN PDK", |
| 32 | + visibility="public", |
| 33 | + role="viewer", |
| 34 | + create_template=False, |
| 35 | + ) |
| 36 | + |
| 37 | + # Add sources |
| 38 | + shutil.copytree("./siepic_forge", project.module_path / project.module_name, dirs_exist_ok=True) |
| 39 | + |
| 40 | + project.save_module() |
| 41 | + |
| 42 | + # Redirect parametric technology source |
| 43 | + for tech in techs: |
| 44 | + tech.parametric_function = ( |
| 45 | + project.module_name + "." + tech.parametric_function.partition(".")[2] |
| 46 | + ) |
| 47 | + |
| 48 | + # Add components |
| 49 | + for component in components: |
| 50 | + print("Adding", repr(component.name), flush=True) |
| 51 | + project.add(component, update_existing_dependencies=False, update_config=False) |
| 52 | + |
| 53 | + project.add_version(version) |
| 54 | + |
| 55 | + print("Done:", project) |
| 56 | + |
| 57 | + |
| 58 | +if __name__ == "__main__": |
| 59 | + pda.init("http://localhost:3030", "ws://localhost:3030") |
| 60 | + try: |
| 61 | + create_library() |
| 62 | + finally: |
| 63 | + pda.stop() |
0 commit comments