-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_directory.py
More file actions
172 lines (159 loc) · 4.63 KB
/
Copy pathcreate_directory.py
File metadata and controls
172 lines (159 loc) · 4.63 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
from pathlib import Path
import gdsfactory as gf
import json
def create_wafer_dir(gds: gf.Component, dir_name: str, design_json: str) -> None:
"""
Creates a nested directory structure for wafer design files and saves the GDS file and design JSON.
Args:
gds (gf.Component): The GDS component to be saved.
dir_name (str): The name of the main directory to be created.
design_json (str): The design JSON content to be saved in the Design directory.
example for design_json:
{
"wafer name": "20250907_",
"material": "Silicon",
"size": 76200,
"thickness": 1,
"recipe": "NORMAL",
"samples": [
{
"name": "Sample1",
"dimension": [
15000,
5000
],
"center": [
0,
0
],
"jopherson junctions": [
{
"type": "DOLAN",
"gap": 1,
"name": "A"
},
{
"type": "DOLAN",
"gap": 1,
"name": "B"
}
],
"resistance measurement points": [
{
"point": "(0,0)",
"name": "A"
},
{
"point": "(1,1)",
"name": "B"
}
]
},
{
"name": "Sample2",
"dimension": [
15000,
5000
],
"center": [
0,
0
],
"jopherson junctions": [
{
"type": "DOLAN",
"gap": 1,
"name": "A"
},
{
"type": "DOLAN",
"gap": 1,
"name": "B"
}
],
"resistance measurement points": [
{
"point": "(0,0)",
"name": "A"
},
{
"point": "(1,1)",
"name": "B"
}
]
}
],
"test junctions": [
{
"type": "DOLAN",
"BRIDGE START GAP": 1,
"BRIDGE END GAP": 5,
"LEFT FINGER": {
"layer": "(1, 0)",
"length": 10,
"width": 1
},
"RIGHT FINGER": {
"layer": "(1, 0)",
"length": 10,
"width": 1
}
}
]
}
"""
# Specify the nested directory structure
main_dir_path = Path("I:\\SergeR_Group\\Notes\\Fabrication\\" + dir_name)
# Create nested directories
main_dir_path.mkdir(parents=True, exist_ok=True)
print(f"Nested directories '{main_dir_path}' created successfully.")
design_dir_path = main_dir_path.joinpath("Design")
design_dir_path.mkdir(parents=True, exist_ok=True)
print(f"Nested directories '{design_dir_path}' created successfully.")
gds.write_gds(design_dir_path.joinpath(dir_name + ".gds"), with_metadata=False)
with design_dir_path.joinpath("data.json").open("w", encoding ="utf-8") as f:
f.write(design_json)
resistance_dir_path = main_dir_path.joinpath("Resistance")
resistance_dir_path.mkdir(parents=True, exist_ok=True)
print(f"Nested directories '{resistance_dir_path}' created successfully.")
rCsv: str = "Sample,Point,Resistance (Ohm)\n"
design_data: dict = json.loads(design_json)
for sample in design_data["samples"]:
sample_name: str = sample["name"]
for rmp in sample["resistance measurement points"]:
rCsv += f"{sample_name},{rmp['name']},\n"
with resistance_dir_path.joinpath("resistance.csv").open("w", encoding ="utf-8") as f:
f.write(rCsv)
rTJCsv: str = "Sample,Point,Resistance (Ohm)\n"
with resistance_dir_path.joinpath("resistance_test_junctions.csv").open("w", encoding ="utf-8") as f:
f.write(rTJCsv)
def create_design_json(wafer_name: str,
wafer_material: str,
wafer_size: float,
wafer_thickness: str,
recipe: str,
samples: list,
test_junctions: dict
) -> str:
"""
Creates a design JSON string for wafer configuration.
Args:
wafer_name (str): The name of the wafer.
wafer_material (str): The material of the wafer.
wafer_size (float): The size of the wafer in micrometers.
wafer_thickness (str): The thickness of the wafer in micrometers.
recipe (str): The fabrication recipe.
samples (list): A list of sample configurations.
test_junctions (dict): A dictionary of test junction configurations.
Returns:
str: A JSON string representing the wafer design.
"""
rtn: dict = {}
rtn['wafer name'] = wafer_name
rtn['material'] = wafer_material
rtn['size'] = wafer_size
rtn['thickness'] = wafer_thickness
rtn['recipe'] = recipe
rtn['samples'] = samples
rtn['test junctions'] = test_junctions
return json.dumps(rtn)