quchip.sweep¶
Declarative parameter sweeps for chip studies.
Sweep axes compose as Cartesian products or zipped correlated scans. Spectrum sweeps dress the chip at each point, keeping eigenvalues and bare→dressed label assignments.
Sweep values keep their native physical units (GHz for frequencies, ns for
times, mK for temperatures). Sweep keeps JAX arrays verbatim, so
downstream code can differentiate through swept values. Sweep promotes
all other values to np.ndarray, so len and indexing behave predictably.
The dressed-spectrum machinery here computes the eigenvalues and overlaps of the lab-frame chip Hamiltonian. For a general reference on the dressed-state picture of coupled circuit qubits, see Blais, Grimsmo, Girvin & Wallraff, Circuit quantum electrodynamics, Rev. Mod. Phys. 93, 025005 (2021).
Classes
|
Calculate dressed spectra over a parameter grid. |
|
Dressed-spectrum data collected across a |
|
Declare a one-dimensional parameter axis. |
|
Pair sweep axes element by element. |
- class quchip.sweep.ZippedSweep(sweeps)[source]¶
Bases:
objectPair sweep axes element by element.
Use
Sweep.zip()to validate lengths before you construct this bundle.
- class quchip.sweep.Sweep(values, *, name=None)[source]¶
Bases:
objectDeclare a one-dimensional parameter axis.
- Parameters:
- Variables:
- static zip(*sweeps)[source]¶
Pair axes for element-wise iteration.
Requires at least two sweeps of equal size, and raises
ValueErrorotherwise.- Parameters:
*sweeps (Sweep) – Two or more
Sweepaxes. Theirnameattributes must all be distinct. AZippedSweepwith repeated axis names raisesValueErrorwhen it is enumerated later (expand(),SpectrumSweep).- Returns:
Bundle iterated element-wise instead of taken in Cartesian product with other axes.
- Return type:
- static expand(axes)[source]¶
Expand independent axes as a Cartesian product and zipped axes pairwise.
- Parameters:
axes (sequence of Sweep or ZippedSweep) – Axes in output order. Names must be unique across all groups.
- Returns:
Parameter mappings in C order (last axis fastest). No axes gives one empty mapping, and an empty axis gives no points.
- Return type:
- class quchip.sweep.SpectrumSweepResult(device_labels, bare_labels, eigenvalues, dressed_indices, assignment_overlaps, overlap_threshold, params, eigenvector_matrices=None, eigenstates=None)[source]¶
Bases:
objectDressed-spectrum data collected across a
SpectrumSweepgrid.- Variables:
device_labels (tuple[str, ...]) – Device labels of the underlying chip, in the chip’s tensor-product order (
devices).bare_labels (tuple[tuple[int, ...], ...]) – Bare-state labels tracked by the sweep (one tuple of occupation numbers per device).
eigenvalues (numpy.ndarray) –
(*grid_shape, n_evals)array of eigenvalues in GHz, one row per sweep point.dressed_indices (numpy.ndarray) –
(*grid_shape, n_bare)array giving the dressed-state index assigned to each bare label at each sweep point, orNaNwhen no confident assignment is found.assignment_overlaps (numpy.ndarray) –
(*grid_shape, n_bare)overlap weights accompanyingdressed_indices.overlap_threshold (float) – Minimum overlap below which an assignment is unreliable and returned as
NaN.params (numpy.ndarray) – Object array of parameter dicts, one per grid point.
eigenvector_matrices (numpy.ndarray | None) – Optional object array of dressed eigenvector matrices (one per grid point), produced when
store_eigenstates=True.eigenstates (numpy.ndarray | None) – Optional object array of dressed eigenstates aligned with
eigenvector_matrices.
- dressed_index(device_states=None, /, **device_state_kwargs)[source]¶
Dressed-state indices across the sweep for one bare label.
Entries where the assignment overlap falls below
overlap_threshold(or was never found) are returned asNaN.- Parameters:
device_states (Mapping[str, int] | None) – Mapping from device (label or object) to occupation number, resolved through
bare_label_from_mapping(). Unspecified devices default to Fock index 0. Do not use withdevice_state_kwargs.**device_state_kwargs (int) – Keyword form of
device_states(device label as keyword).
- Returns:
Floating-point array of shape
shape(the sweep grid, excluding the bare-label axis). A floating dtype is needed to represent unreliable or missing assignments asNaN. An unreliable assignment is a grid point whose overlap with this bare label falls belowoverlap_threshold. A missing assignment is a grid point where no dressed state was assigned to this bare label.- Return type:
Examples
>>> # Track the bare |1, 0> state across a sweep >>> # result.dressed_index({qubit_a: 1, qubit_b: 0})
- energy_by_bare_label(device_states=None, /, **device_state_kwargs)[source]¶
Dressed energies (GHz) traced out for one bare label across the sweep.
Invalid points inherit the
NaNmask fromdressed_index().- Parameters:
device_states (Mapping[str, int] | None) – Mapping from device (label or object) to occupation number. See
dressed_index(). Do not use withdevice_state_kwargs.**device_state_kwargs (int) – Keyword form of
device_states(device label as keyword).
- Returns:
Floating-point array of shape
shape, in GHz. Entries wheredressed_index()returnsNaN(overlap belowoverlap_threshold, or no assignment found) areNaN.- Return type:
- state_components_at(point, state=None, /, *, n_components=5, **device_state_kwargs)[source]¶
Return the largest bare-state probabilities of one dressed state.
Requires running the sweep with
store_eigenstates=True.- Parameters:
point (int, tuple of int, or None) – Grid coordinate. An integer selects a one-dimensional sweep.
Noneis valid only for a result with no sweep axes.state (int, mapping, or None, default None) – Dressed index, or a mapping from device object or label to bare level. A mapping is resolved through the stored overlap assignment. Omitted devices have level zero.
n_components (int, default 5) – Positive maximum number of components returned.
**device_state_kwargs (int) – Bare levels keyed by device label, as an alternative to a mapping. Do not combine with a nonempty mapping.
- Returns:
Bare occupation tuples mapped to squared amplitudes, in descending order.
- Return type:
- Raises:
ValueError – Eigenvectors were not saved, a coordinate is invalid, the requested count is nonpositive, or the bare label has no confident assignment.
See also
SpectrumSweepDressed-spectrum conventions and physics reference.
- class quchip.sweep.SpectrumSweep(chip, axes, *, evals_count=None, store_eigenstates=False, overlap_threshold=0.5)[source]¶
Bases:
objectCalculate dressed spectra over a parameter grid.
Each point uses a fresh
Chip.with_params()clone and an independent bare-state overlap assignment, so labels are not transported along the path.- Parameters:
chip (Chip) – Model to dress in the lab frame.
axes (sequence of Sweep or ZippedSweep) – Nonempty axes named by paths in
chip.parameters. Independent axes form a Cartesian product, and zipped axes advance together.evals_count (int or None, default None) – Number of lowest eigenvalues stored, from 1 to
chip.total_dim.Nonestores all. Dressing still computes the full eigensystem.store_eigenstates (bool, default False) – Keep eigenvectors and backend states for component inspection.
overlap_threshold (float, default 0.5) – Minimum squared overlap for a confident bare-state assignment. Use a value between 0 and 1. Unassigned labels yield
NaN.
References
Blais et al., Circuit quantum electrodynamics, Rev. Mod. Phys. 93, 025005 (2021), https://doi.org/10.1103/RevModPhys.93.025005. The reference describes dressed states; grid traversal is quchip policy.