quchip.chip.serialization

Chip serialization, deserialization, and structural cloning.

These helpers turn a Chip into a JSON-safe dict and back (through the device / coupling registries). They also make isolated structural clones suitable for sweep evaluation.

Cloning is structural, not numerical: devices are copied fresh, and couplings are rebound to the cloned device instances. If control equipment is attached, it is cloned and reconnected. Clones keep the chip-specific backend selection so sweeps run on the same backend as the original.

Functions

clone_chip(chip)

Isolated structural clone suitable for sweep evaluation.

deserialize_chip(data)

Reconstruct a chip from serialize_chip() output.

serialize_chip(chip)

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, approximation strategy, space policy, and, if present, the control equipment wiring. The chip label, if any, is included verbatim. Backend identity is not serialized, so 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 Registrable registries (through BaseDevice.from_dict() / BaseCoupling.from_dict()). These registries are populated at subclass-definition time, so import any extension module 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. If control equipment is present, it is cloned and reconnected, so the clone’s drives target the clone’s devices and not the originals.