Skip to content

NoiseChannel

from cascaqit import NoiseChannel

NoiseChannel

NoiseChannel(
    channel_id: str,
    channel_type: NoiseChannelType,
    parameters: dict[str, float],
    units: dict[str, str],
    targets: NoiseTargets = "all",
    model: str = "",
    injection_point: str = "",
    source: str = "user",
    schedule_ref: str | None = None,
    metadata: dict[str, Any] = dict(),
    schema_version: str = "cascaqit.noise.physical.v1",
)

Declare one noise channel, usually through one of the eight constructors below. Each returns NoiseChannel with its model, injection point and units set. probability, p01 and p10 lie in [0, 1]; rate and coupling are nonnegative, duration is positive, and all numeric values must be finite.

targets="all" selects available logical targets; alternatively supply unique names such as ("q0",). Crosstalk requires at least two explicit targets. channel_id identifies the channel and source records where its parameters came from. Direct construction also accepts parameters, units, model, injection_point, schedule_ref, metadata and schema_version. Parameter keys must match the channel type exactly, and model and injection point cannot be freely changed. The units dictionary covers every parameter but performs no conversion; named constructors supply the intended labels.

Put channels into a NoiseModel and execute through the backend's noise argument. Successful construction does not establish that a program meets the channel's prerequisites. See the Noisy Hybrid project for a complete comparison.

preparation

preparation(
    probability: float,
    *,
    targets: NoiseTargets = "all",
    channel_id: str = "noise.preparation",
    source: str = "user",
) -> NoiseChannel

Apply independent bit flips with probability on selected targets after initial preparation and before evolution. This changes the state rather than final recorded counts.

dephasing

dephasing(
    rate: float,
    *,
    targets: NoiseTargets = "all",
    channel_id: str = "noise.dephasing",
    source: str = "user",
) -> NoiseChannel

Declare Lindblad dephasing during Analog evolution, with rate in 1/us. This requires an Analog block; use idle for dephasing over a Digital idle interval.

gate

gate(
    probability: float,
    *,
    targets: NoiseTargets = "all",
    channel_id: str = "noise.gate",
    source: str = "user",
) -> NoiseChannel

After each digital gate, apply independent bit flips on the intersection of gate operands and configured targets. Probability applies per injection, not to the circuit as a whole. A Digital block is required.

idle

idle(
    rate: float,
    *,
    duration: float,
    targets: NoiseTargets = "all",
    channel_id: str = "noise.idle",
    source: str = "user",
) -> NoiseChannel

Apply dephasing for a finite idle interval after a Digital block. Rate is in 1/us and duration in us. The current phase-flip probability is (1 - exp(-rate * duration)) / 2, and logical time advances. Duration is not inferred from wall-clock gate execution time.

crosstalk

crosstalk(
    coupling: float,
    *,
    duration: float,
    targets: tuple[str, ...],
    schedule_ref: str,
    channel_id: str = "noise.crosstalk",
    source: str = "user",
) -> NoiseChannel

Declare coherent XX crosstalk with coupling in rad/us and duration in us. Targets must contain at least two distinct logical names. schedule_ref must identify a supported control block or use all_control_blocks. For two targets the operator is exp(-i * coupling * duration * X⊗X); with more targets it uses the tensor product of X on all of them, not a sum of pairwise XX terms. Unsupported scheduling prerequisites fail execution. This differs from AHS van der Waals number_number interactions.

boundary

boundary(
    probability: float,
    *,
    targets: NoiseTargets = "all",
    channel_id: str = "noise.boundary",
    source: str = "user",
) -> NoiseChannel

Apply amplitude damping with probability at Hybrid control-block boundaries. This requires a Hybrid program with an inter-block boundary. The parameter is a finite channel probability, not a continuous decay rate.

atom_loss

atom_loss(
    probability: float,
    *,
    targets: NoiseTargets = "all",
    channel_id: str = "noise.atom_loss",
    source: str = "user",
) -> NoiseChannel

Model atom loss with probability at Analog-block exit. This tracks occupancy and requires trajectory execution; flipping a terminal bit does not model atom loss.

readout

readout(
    p01: float,
    *,
    p10: float | None = None,
    targets: NoiseTargets = "all",
    channel_id: str = "noise.readout",
    source: str = "user",
) -> NoiseChannel

Alter terminal measurement records only. p01 is the probability of recording true 0 as 1, and p10 of recording true 1 as 0; omitted p10 equals p01. Returned state probabilities and exact observables describe the pre-readout state, so they need not match counts distorted by readout error.

from_dict

from_dict(data: dict[str, Any]) -> NoiseChannel

Restore NoiseChannel from a dictionary. Restore targets, parameters, units and model, rechecking channel and numeric constraints. Missing required fields or invalid values can raise KeyError, TypeError or ValueError.

from_json

from_json(text: str) -> NoiseChannel

Parse a JSON object and call from_dict(), returning NoiseChannel. Invalid JSON raises a parsing error; a non-object root raises TypeError.

to_dict

to_dict() -> dict[str, Any]

Return a JSON-compatible dictionary, serializing nested objects and converting tuples to arrays. This stores the declaration, not an execution result.

to_json

to_json(*, indent: int | None = None) -> str

Return a JSON string without writing a file. indent=None uses compact formatting; supply an indentation width for readable output.

stable_hash

stable_hash() -> str

Return the SHA-256 hex digest of canonical JSON. Fields, identifiers and metadata can affect it. Use it to compare saved content, not to decide physical equivalence.