quchip.chip.serialization¶
Chip serialization, deserialization, and structural cloning.
These helpers turn a Chip into a JSON-safe
dict and back (via the device / coupling registries), and produce
isolated structural clones suitable for sweep evaluation.
Cloning is structural, not numerical: devices are copied fresh, couplings are rebound to the cloned device instances, and control equipment — when attached — is cloned and reconnected. Clones keep the chip-specific backend selection so sweeps run on the same backend as the original.
Functions
|
Isolated structural clone suitable for sweep evaluation. |
|
Reconstruct a chip from |
|
Serialize chip topology into a JSON-safe dictionary. |
- quchip.chip.serialization.serialize_chip(chip)[source]¶
Serialize chip topology into a JSON-safe dictionary.
Captures devices, couplings, baths, frame, RWA policy, and — if present — the control equipment wiring. The chip label (if any) is included verbatim. Backend identity is not serialized; deserialization uses the process default backend unless changed afterwards.
- quchip.chip.serialization.deserialize_chip(data)[source]¶
Reconstruct a chip from
serialize_chip()output.Device and coupling classes are resolved through their shared
Registrableregistries (viaBaseDevice.from_dict()/BaseCoupling.from_dict()), which are populated at subclass-definition time, so any extension module must be imported before deserialization.
- quchip.chip.serialization.clone_chip(chip)[source]¶
Isolated structural clone suitable for sweep evaluation.
Devices are copied and decoupled from their original drive wiring; couplings are rebound to the cloned device instances. Control equipment, when present, is cloned and reconnected so the clone’s drives target the clone’s devices — not the originals.