JSON Schema validation for cryowire configuration files
Project description
cryowire
Python library for dilution refrigerator wiring configuration — data models, validation, diagram generation, and programmatic building.
Installation
pip install cryowire
Features
| Module | Description |
|---|---|
models |
Pydantic v2 models (Stage, Component types, WiringConfig) |
validate |
JSON Schema validation against cryowire-spec |
loader |
YAML loading, module expansion, component catalog |
builder |
Programmatic cooldown generation from Python code |
summary |
Wiring summary tables (terminal, Markdown, HTML) |
diagram |
Publication-quality wiring diagrams (matplotlib) |
Quick Start
Build a cooldown
from cryowire import (
Amplifier, Attenuator, ChipConfig, CooldownBuilder,
CooldownMetadata, Filter, Isolator, Stage,
)
# 1. Component catalog
catalog = {
"XMA-10dB": Attenuator(model="XMA-2082-6431-10", value_dB=10),
"XMA-20dB": Attenuator(model="XMA-2082-6431-20", value_dB=20),
"Eccosorb": Filter(model="XMA-EF-03", filter_type="Eccosorb"),
"K&L-LPF": Filter(model="K&L-5VLF", filter_type="Lowpass"),
"RT-AMP": Amplifier(model="MITEQ-AFS3", amplifier_type="RT", gain_dB=20),
"LNF-HEMT": Amplifier(model="LNF-LNC03_14A", amplifier_type="HEMT", gain_dB=40),
"LNF-ISO": Isolator(model="LNF-ISC4_12A"),
}
# 2. Build cooldown (reference components by key)
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-06"),
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)
.build()
)
# 3. Per-line overrides (context manager)
with cooldown.for_lines("C03", "C05") as lines:
lines.remove(Stage.MXC, component_type=Filter)
lines.replace(Stage.K4, 0, "XMA-10dB")
# Summary (terminal / markdown / html)
cooldown.summary()
md = cooldown.summary(fmt="markdown")
# Publication-quality SVG diagram
cooldown.diagram(output="wiring.svg", representative=True)
# Export YAML files
cooldown.write("output/")
Load & inspect an existing cooldown
from cryowire import load_cooldown, print_summary, generate_diagram
metadata, control, readout_send, readout_return = load_cooldown("path/to/cooldown")
print_summary(control, readout_send, readout_return)
generate_diagram(control, readout_send, readout_return, output="wiring.svg")
Template-based generation
from cryowire import build_cooldown
build_cooldown(
output_dir="your-cryo/2026/cd001",
cryo="your-cryo",
chip_name="sample-chip",
num_qubits=16,
)
Validate YAML files
from cryowire import validate_wiring, validate_metadata
import yaml
with open("control.yaml") as f:
data = yaml.safe_load(f)
validate_wiring(data) # raises jsonschema.ValidationError on failure
validate_metadata(meta)
Component Types
| Class | Fields | Diagram Label | Example |
|---|---|---|---|
Attenuator |
value_dB |
10 dB |
Attenuator(model="XMA-10dB", value_dB=10) |
Filter |
filter_type |
Lowpass / FLT |
Filter(model="K&L", filter_type="Lowpass") |
Isolator |
— | ISO |
Isolator(model="LNF-ISC4_12A") |
Amplifier |
amplifier_type, gain_dB |
+40 dB |
Amplifier(model="HEMT", gain_dB=40) |
All components share model and serial fields, and expose label, summary_label, attenuation, gain properties.
Schemas
This package bundles JSON Schema files from cryowire-spec:
| Schema | Function | Validates |
|---|---|---|
wiring.schema.json |
validate_wiring() |
control.yaml, readout_send.yaml, readout_return.yaml |
metadata.schema.json |
validate_metadata() |
metadata.yaml |
components.schema.json |
validate_components() |
components.yaml |
chip.schema.json |
validate_chip() |
chip.yaml |
Documentation
Full documentation is available at cryowire.github.io/cryowire.
Examples
A Jupyter notebook tutorial is available in the examples/notebooks/ directory.
pip install cryowire jupyter
jupyter notebook examples/notebooks/tutorial.ipynb
The notebook covers builder usage, summary tables, SVG diagram rendering, and component add/remove/replace operations.
Try it online in the Playground — no installation required.
Development
uv sync
uv run pytest
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cryowire-0.0.3.tar.gz.
File metadata
- Download URL: cryowire-0.0.3.tar.gz
- Upload date:
- Size: 517.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e71856c630990ee60f3c4ecac4ce8e3d4910177789c14baf04485ea79ef20ba4
|
|
| MD5 |
4eb7f990e83537e540a25ff9c1820be0
|
|
| BLAKE2b-256 |
a5975a442dfaa1891bd626c77c94ffd59f4c4839c07bef46ff24cc6fc5780fa9
|
Provenance
The following attestation bundles were made for cryowire-0.0.3.tar.gz:
Publisher:
publish.yml on cryowire/cryowire
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cryowire-0.0.3.tar.gz -
Subject digest:
e71856c630990ee60f3c4ecac4ce8e3d4910177789c14baf04485ea79ef20ba4 - Sigstore transparency entry: 1066422929
- Sigstore integration time:
-
Permalink:
cryowire/cryowire@f4b809373dc6b745ad5a0377eeb1bfb68b719bf3 -
Branch / Tag:
refs/tags/v0.0.3 - Owner: https://github.com/cryowire
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f4b809373dc6b745ad5a0377eeb1bfb68b719bf3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cryowire-0.0.3-py3-none-any.whl.
File metadata
- Download URL: cryowire-0.0.3-py3-none-any.whl
- Upload date:
- Size: 40.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca849f01aa0067c8749797d658205980ce16609c6be019f78fb3b4a4e4441d85
|
|
| MD5 |
7bb28126f52be5d540fb09a71561aa12
|
|
| BLAKE2b-256 |
d392d4ab6ce437a7959858bb3e6c1faecc9a9fe449196d2a820133be7a2afbb9
|
Provenance
The following attestation bundles were made for cryowire-0.0.3-py3-none-any.whl:
Publisher:
publish.yml on cryowire/cryowire
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cryowire-0.0.3-py3-none-any.whl -
Subject digest:
ca849f01aa0067c8749797d658205980ce16609c6be019f78fb3b4a4e4441d85 - Sigstore transparency entry: 1066422935
- Sigstore integration time:
-
Permalink:
cryowire/cryowire@f4b809373dc6b745ad5a0377eeb1bfb68b719bf3 -
Branch / Tag:
refs/tags/v0.0.3 - Owner: https://github.com/cryowire
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f4b809373dc6b745ad5a0377eeb1bfb68b719bf3 -
Trigger Event:
push
-
Statement type: