quchip.results.terminal

Projective measurements of saved states and calibrated detector responses.

Functions

measure_result(result, devices, *[, t, basis])

Project kept states with captured basis maps and existing result coordinates.

Classes

IQReadout(means, iq_covariance[, contributions])

Calibrate one complex IQ distribution per ordered physical outcome.

ReadoutWiring(fields, exposed, graph, ...)

Capture only field references and downstream mixing, without quantum operators.

StateMeasurement(devices, outcomes, ...[, axes])

Born probabilities in a captured local product measurement basis.

StateSamples(devices, outcomes, axes, ...[, iq])

Independent measurement shots, with indices that select the ordered outcome tuples.

class quchip.results.terminal.IQReadout(means, iq_covariance, contributions=None)[source]

Bases: object

Calibrate one complex IQ distribution per ordered physical outcome.

means has shape (outcomes,). iq_covariance is (2,2) or (outcomes,2,2) in the same signal units squared. They are complete conditional detector distributions, so do not add apparatus noise that the calibration already includes. Covariances must be positive definite. Wiring-derived readouts use fields in 1/sqrt(ns) and keep their integrated noise contributions. Means and IQ covariances follow the VNA engineering convention.

Variables:
  • means (array_like) – Complex conditional means, one per physical outcome.

  • iq_covariance (array_like) – Covariance with shape (outcomes, 2, 2).

  • contributions (mapping or None) – Optional named integrated noise contributions.

means: Any
iq_covariance: Any
contributions: Mapping[str, Any] | None = None
classmethod from_wiring(chip, output, *, means, frequency, receiver, noise_frequencies=None)[source]

Build an IQ detector from wiring and conditional coherent fields.

Use the same boundary-field units and vacuum assumptions as SimulationResult.iq_readout(). This method captures the chip’s current wiring, whereas the result method uses the wiring that the simulation kept.

Parameters:
  • chip (Chip) – Chip whose current output wiring is captured.

  • output (port object or str) – Output reference plane.

  • means (array_like or mapping) – Engineering-convention conditional Markov-boundary fields in 1/sqrt(ns). A mapping gives multiple boundary channels.

  • frequency (scalar) – Carrier frequency in GHz.

  • receiver (IQReceiver) – Boxcar receiver and optional digital transfer.

  • noise_frequencies (array_like or None, optional) – Two-sided offsets in GHz. None uses the standard grid.

mean(probabilities)[source]

Return the mean of the conditional IQ mixture.

Parameters:

probabilities (array_like) – Physical-outcome probabilities on the final axis.

covariance(probabilities)[source]

Return the mixture covariance, with conditional-mean separation.

Parameters:

probabilities (array_like) – Physical-outcome probabilities on the final axis.

class quchip.results.terminal.ReadoutWiring(fields, exposed, graph, array_module)[source]

Bases: object

Capture only field references and downstream mixing, without quantum operators.

fields: tuple[FieldChannel, ...]
exposed: tuple[str, ...]
graph: Any
array_module: Any
classmethod capture(slh, array_module)[source]

Keep the solved wiring independently of later component edits.

iq_readout(output, *, means, frequency, receiver, noise_frequencies=None)[source]

Propagate conditional coherent boundary templates and downstream noise.

class quchip.results.terminal.StateSamples(devices, outcomes, axes, physical_indices, indices, iq=None)[source]

Bases: object

Independent measurement shots, with indices that select the ordered outcome tuples.

physical_indices are Born draws. indices also includes assignment errors, if requested. iq is present only for a conditional IQ readout. Sweep axes follow the leading shot axis. No conditional state is returned.

Variables:
  • devices (tuple of str) – Measured device labels.

  • outcomes (tuple of tuple of int) – Ordered outcome tuples.

  • axes (tuple) – Sweep-axis metadata.

  • indices (physical_indices,) – Born and recorded outcome indices.

  • iq (array_like or None) – Conditional IQ draws, when requested.

devices: tuple[str, ...]
outcomes: tuple[tuple[int, ...], ...]
axes: tuple[tuple[str, Any], ...]
physical_indices: Any
indices: Any
iq: Any = None
counts()[source]

Count recorded outcomes along the shot axis, and keep sweep axes.

class quchip.results.terminal.StateMeasurement(devices, outcomes, probabilities, axes=())[source]

Bases: object

Born probabilities in a captured local product measurement basis.

Variables:
  • devices (tuple of str) – Measured device labels.

  • outcomes (tuple of tuple of int) – Ordered product-basis outcomes.

  • probabilities (array_like) – Normalized probabilities with outcomes on the final axis.

  • axes (tuple) – Sweep-axis metadata.

devices: tuple[str, ...]
outcomes: tuple[tuple[int, ...], ...]
probabilities: Any
axes: tuple[tuple[str, Any], ...] = ()
recorded_probabilities(assignment)[source]

Apply A[recorded, physical] to the Born probabilities.

Parameters:

assignment (array_like) – Column-stochastic (recorded, physical) assignment matrix.

sample(count, *, seed=None, key=None, assignment=None, readout=None)[source]

Draw Born outcomes, and optionally record assignment errors or conditional IQ.

Assignment and IQ are separate detector models. IQ samples stay unclassified, and quchip does not infer a threshold or assignment matrix from them. Discrete labels are not differentiable. Use an explicit key under JAX.

Parameters:
  • count (int) – Positive number of independent shots.

  • seed (int or None, optional) – NumPy random seed.

  • key (jax.Array or None, optional) – JAX random key. Do not use with seed.

  • assignment (array_like or None, optional) – Column-stochastic (recorded, physical) assignment matrix.

  • readout (IQReadout or None, optional) – Conditional IQ calibration for each physical outcome.

quchip.results.terminal.measure_result(result, devices, *, t=None, basis='energy')[source]

Project kept states with captured basis maps and existing result coordinates.