-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
92 lines (75 loc) · 3.45 KB
/
main.py
File metadata and controls
92 lines (75 loc) · 3.45 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
"""cryowire tutorial — Build, inspect, and export dilution refrigerator wiring configurations."""
from pathlib import Path
from cryowire import (
Amplifier,
Attenuator,
ChipConfig,
CooldownBuilder,
CooldownMetadata,
Filter,
Isolator,
Stage,
)
OUTPUT_DIR = Path("output")
def main() -> None:
# ── 1. Define a component catalog ────────────────────────────────
catalog = {
"XMA-10dB": Attenuator(manufacturer="XMA", model="2082-6431-10", value_dB=10),
"XMA-20dB": Attenuator(manufacturer="XMA", model="2082-6431-20", value_dB=20),
"Eccosorb": Filter(manufacturer="XMA", model="EF-03", filter_type="Eccosorb"),
"K&L-LPF": Filter(manufacturer="K&L", model="5VLF", filter_type="Lowpass"),
"RT-AMP": Amplifier(manufacturer="MITEQ", model="AFS3", amplifier_type="RT", gain_dB=20),
"LNF-HEMT": Amplifier(manufacturer="LNF", model="LNC03_14A", amplifier_type="HEMT", gain_dB=40),
"LNF-ISO": Isolator(manufacturer="LNF", model="ISC4_12A"),
}
# ── 2. Build a cooldown configuration ────────────────────────────
cooldown = (
CooldownBuilder(
chip=ChipConfig(name="sample-8q", num_qubits=8, qubits_per_readout_line=4),
metadata=CooldownMetadata(
cryo="your-cryo", cooldown_id="cd001", date="2026-03-09"
),
catalog=catalog,
control={
Stage.K50: ["XMA-10dB"],
Stage.K4: ["XMA-20dB"],
Stage.MXC: ["XMA-20dB", "Eccosorb"],
},
readout_send={Stage.K50: ["XMA-10dB"], Stage.K4: ["XMA-10dB"]},
readout_return={
Stage.RT: ["RT-AMP"],
Stage.K50: ["LNF-HEMT"],
Stage.CP: ["LNF-ISO", "LNF-ISO"],
},
)
.add("C00", Stage.STILL, "K&L-LPF")
.remove("RR00", Stage.CP, index=1)
.representative("C00", "RS00", "RR00")
.build()
)
# ── 3. Per-line overrides ────────────────────────────────────────
with cooldown.for_lines("C03", "C05") as lines:
lines.remove(Stage.MXC, component_type=Filter)
lines.replace(Stage.K4, 0, "XMA-10dB")
# ── 4. Print wiring summary (terminal) ───────────────────────────
print("=" * 60)
print(" Wiring Summary")
print("=" * 60)
cooldown.summary()
# ── 5. Export files ──────────────────────────────────────────────
OUTPUT_DIR.mkdir(parents=True, exist_ok=True)
# YAML files (metadata, chip, control, readout_send, readout_return)
cooldown.write(OUTPUT_DIR)
# Single-file bundle (cooldown.yaml)
from cryowire.bundle import write_cooldown
write_cooldown(OUTPUT_DIR, components_path=OUTPUT_DIR / "components.yaml")
# Markdown summary
md = cooldown.summary(fmt="markdown", diagram="wiring.svg")
(OUTPUT_DIR / "README.md").write_text(md)
# SVG wiring diagram
cooldown.diagram(output=OUTPUT_DIR / "wiring.svg", representative=True)
print(f"\nExported to {OUTPUT_DIR}/")
for f in sorted(OUTPUT_DIR.iterdir()):
print(f" - {f.name}")
if __name__ == "__main__":
main()