bragi_quantum.experiments API#
The library of calibration and characterization nodes. Every
experiment is a node built from a Parameters, a Measurement, an
Analysis and one or more QOI classes (see Core Concepts).
Abstractions#
The base-class families every node is assembled from.
Parameters & QOI#
- pydantic model bragi_quantum.experiments.abstract.parameters.BaseParameters[source]#
Bases:
BaseModelConfiguration parameters for a Calibration Node. Pydantic ensures these are validated before a node execution begins.
Every field is a single default value applied to all elements. To override a field for specific elements, populate
custom_parameterswith a mapping{field_name: {element_name: value}};for_qubit/for_couplerthen resolve a copy of these parameters with that element’s overrides applied (and defaults everywhere else). Values are plain data, socustom_parametersround-trips through JSON/YAML config files.- Fields:
- by_category()[source]#
Return this instance’s field values grouped by category.
Maps each category (
"metadata","data_acquisition","analysis", and"uncategorized"if any field is unlabelled) to an{field_name: value}dict. Only non-empty categories are included.Complements
fields_by_category(), which returns field names from the class; this returns the concrete values from the instance — handy for inspecting or displaying a parameter set (e.g. in a notebook):>>> for cat, fields in params.by_category().items(): ... print(cat, fields)
- show()[source]#
Return a human-readable listing of the parameters grouped by category.
Printing the result gives a quick overview of a parameter set and which knobs are re-tunable at reanalysis (the
analysisgroup):>>> print(params.show())Metadata fields (
name,qubits,couplers) are populated by the orchestrator when a node actually runs; on a bare instance they are still unset and rendered as(unset)rather than''/[].- Return type:
- for_qubit(qubit)[source]#
Resolve these parameters for
qubit(applying any per-qubit overrides).- Parameters:
qubit (str)
- Return type:
- for_coupler(coupler)[source]#
Resolve these parameters for
coupler(applying any per-coupler overrides).- Parameters:
coupler (str)
- Return type:
- resolved_by_qubit()[source]#
Return
{qubit: resolved_parameters}for every qubit inself.qubits.Convenience for nodes building a per-qubit sample space: instead of repeating
{q: self.parameters.for_qubit(q) for q in ...}in each node, callresolved = self.parameters.resolved_by_qubit()once and readresolved[q].<field>. Qubits without overrides map toself(no copy), so this is cheap.- Return type:
- resolved_by_coupler()[source]#
Return
{coupler: resolved_parameters}for every coupler inself.couplers.Coupler-node analogue of
resolved_by_qubit().- Return type:
- pydantic model bragi_quantum.experiments.abstract.parameters.BaseQoi[source]#
-
Base class for Quantities of Interest (QOI). This stores the results of an experiment/analysis to be persisted back into the bragi_quantum.datalayer models.
- property Hz_to_GHz#
- abstractmethod to_dict()[source]#
Returns the calculated QOIs as a dictionary. The keys should match the attribute paths in the bragi_quantum.datalayer models (e.g., {‘rxy.amp180’: 0.5}).
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
Measurement#
- class bragi_quantum.experiments.abstract.measurement.SingleQubitGate(*args, **kwargs)[source]#
Bases:
ProtocolA callable that constructs a single-qubit gate or schedule from a qubit name.
- class bragi_quantum.experiments.abstract.measurement.BaseMeasurement(transmons, couplers={})[source]#
Bases:
ABC- property transmons: OrderedDict[str, ExtendedTransmon]#
- abstract property measure_gate_class: Measure#
- abstractmethod schedule_function(**kwargs)[source]#
Build this measurement’s schedule.
Called by
BaseNode.precompile()asschedule_function(**schedule_samplespace, **self.schedule_keywords)– keyword-only, with the keyword set varying per measurement (there’s no shared signature to enforce beyond that).- Return type:
TimeableSchedule
- excite_system(to_state)[source]#
Excite all qubits to the given state (1 or 2) in parallel.
- Parameters:
to_state (Literal[1, 2])
- Return type:
TimeableSchedule
- static calibrated_gate_level(transmon)[source]#
Highest excited state this qubit’s device model can prepare.
Calibration values are NaN until a real value has been written by a successful calibration run. Returns 0 when even the X gate (0->1) is not calibrated, 1 when the X gate is calibrated, and 2 when the 1->2 pulse is calibrated too.
- Parameters:
transmon (ExtendedTransmon)
- Return type:
- calibration_points_schedule(repetitions)[source]#
Static per-state calibration block, appended by
BaseNode.precompile.Requires every qubit’s X gate (0->1) to be calibrated; returns
Noneotherwise (no partial calibration block for a subset of qubits). The shared state range is the lowest calibrated level across all qubits: for each stateiin that range, the system is reset, excited to statei(all qubits together) and measured with the coordinateCAL=ion dedicatedCAL_<n>acquisition channels (CALmarks calibration data everywhere, likeAR_marks active reset).BaseNode.configure_datasetextracts these into per-qubit<qubit>_CALdata variables.The block carries its own repetition loop register, so it runs identically regardless of the node’s sweep/loop structure and its acquisitions are hardware-averaged over repetitions.
- Parameters:
repetitions (int)
- Return type:
TimeableSchedule | None
- reset_system(*, method)[source]#
- Parameters:
method (Literal['passive', 'active'])
- Return type:
TimeableSchedule
- measure_system(*, coords, bin_mode, acq_protocol='SSBIntegrationComplex', acq_channel_prefix=None, holdoff_time=0.0, stagger=0.0, conditional_operation=None, measure_gate_class=None, acq_delay=None, pulse_amp=None, pulse_duration=None, freq=None, acq_duration=None)[source]#
Readout all qubits with configurable timing and optional conditional operations.
Qubit names are prepended to all coordinate keys before passing to the measure gate. Device override parameters, if given, are indexed per qubit by position in
transmons.Method Parameters#
- coordsdict[str, list[Variable] or Variable or int or float or complex]
Coordinate labels and values attached to each acquisition. List values are indexed per qubit; scalars are broadcast to all qubits.
- holdoff_timeVariable or float, optional
Idle time inserted before any measurements. By default 0.0.
- staggerlist[float] or float or “trigger_network”, optional
Start times for each measurement, relative to
holdoff_time. When specified as a fixed offset, then the start times are computed usingcompute_stagger_times()."trigger_network"uses a fixed offset based on trigger network timing constraints. By default stagger=0.0 which corresponds to a simultaneous readout of all qubits.- conditional_operationSingleQubitGate, optional
If provided, called with each qubit name and the result is wrapped in a
ConditionalOperationappended after its measurement. By defaultNone.- measure_gate_classMeasure, optional
Override the gate class used for measurement. Defaults to
measure_gate_class.
Measure gate parameters#
- bin_mode“average_append” or “append”
Binning mode passed to the measure gate.
- acq_protocolstr, optional
Acquisition protocol passed to the measure gate. By default
"SSBIntegrationComplex".- acq_channel_prefixstr, optional
If set, the acquisition channel is set to
f"{acq_channel_prefix}{qubit_idx}"instead of the default integer index. By defaultNone.
Measure gate device override parameters#
- acq_delaylist[Variable], optional
Per-qubit device override for acquisition delay.
- pulse_amplist[Variable], optional
Per-qubit device override for measure pulse amplitude.
- pulse_durationlist[Variable], optional
Per-qubit device override for measure pulse duration.
- freqlist[Variable], optional
Per-qubit device override for readout frequency.
- acq_durationlist[Variable], optional
Per-qubit device override for the acquisition duration (integration time / raw trace length).
- returns:
Schedule containing the staggered measurement of all qubits.
- rtype:
TimeableSchedule
- Parameters:
coords (dict[str, list[Variable] | Variable | int | float | complex])
bin_mode (Literal['average_append', 'append'])
acq_protocol (Literal['SSBIntegrationComplex', 'Timetag', 'TimetagTrace', 'Trace', 'TriggerCount', 'ThresholdedTriggerCount', 'NumericalSeparatedWeightedIntegration', 'NumericalWeightedIntegration', 'ThresholdedAcquisition'])
acq_channel_prefix (str | None)
holdoff_time (Variable | float)
conditional_operation (SingleQubitGate | None)
measure_gate_class (Measure | None)
acq_delay (list[Variable] | None)
pulse_amp (list[Variable] | None)
pulse_duration (list[Variable] | None)
freq (list[Variable] | None)
acq_duration (list[Variable] | None)
- Return type:
TimeableSchedule
Analysis#
- class bragi_quantum.experiments.abstract.analysis.Analysis(parameters, qoi_cls=None)[source]#
Bases:
ABCUnified, parameter-driven analysis for a single calibration node.
Usage:
analysis = RabiAnalysis(parameters, Rabi01QOI) analysis.set_parameters(qubits=["q06", "q12"]) # restrict the set results = analysis.run("data/dataset_rabi_0.hdf5") # {element: qoi} fig = analysis.figure("q06") # interactive plotly grid = analysis.grid_figure() # all analysed elements analysis.save(out_dir) # png + preview + pdf
runloops overparameters.qubits(orparameters.couplerswhenelement_kind == "coupler") and analyses each element on its own worker instance, so per-element fit state is preserved for plotting. A single element can also be analysed directly withanalyse_element.Subclasses implement two hooks:
compute_qoi()(populate fit/derived state fromself.dataset/self.magnitudesand return the QOI) andadd_traces()(draw this element’s plotly traces).- Parameters:
parameters (BaseParameters)
- set_parameters(**overrides)[source]#
Update parameters in place (pydantic-revalidated) and return self.
- Return type:
- analyse_element(dataset, element)[source]#
Slice
elementfromdataset(Dataset or path) and fit it here.
- property has_calibration_points: bool#
Whether this element’s calibration points are present and complete.
Raises
CalibrationPointsErrorif calibration points are present butexpects_calibration_pointsisFalse— that combination means this analysis could use them but doesn’t declare so.
- run(dataset)[source]#
Analyse the target elements; return
{element: qoi}.Targets are
parameters.qubits/parameters.couplers. If that list is empty, every matching element found indatasetis analysed — sorunworks out-of-the-box on a raw dataset, and a subset is selected simply by setting the parameters list.
- abstractmethod compute_qoi()[source]#
Compute the QOI for the current element.
Runs against
self.dataset/self.magnitudes/self.data_var(already set for the current element) and should store whatever stateadd_traces()needs onself.- Return type:
- abstractmethod add_traces(fig, row=1, col=1)[source]#
Add this element’s plotly traces (and axis titles) to
figat (row, col).
- plot_title()[source]#
Title for this element’s (sub)plot. Override per node if desired.
- Return type:
- support_figures()[source]#
Extra per-element diagnostic figures as
(plotly_figure, filename).Called on each analysed element’s worker during save. Default: none. Override for nodes with 1-D projections / per-slice diagnostics.
- grid_figure(ncols=5)[source]#
Return a plotly grid Figure over every analysed element.
- Parameters:
ncols (int)
- save_png(path, *, grid=True, scale=2)[source]#
Write a PNG (grid of all elements by default) via kaleido.
- save(out_dir)[source]#
Write this node’s figures into
out_dir(call afterrun()).Produces the grid
{name}.png+{name}_preview.png, the per-element support figures, and — ifpdf_report_pathis set — merges them into the report PDF. This is the output half of the analysis;run()does the analysis and populates the per-element workers used here.- Return type:
None
Node#
- class bragi_quantum.experiments.abstract.node.BaseNode(parameters, qoi_cls)[source]#
Bases:
ABC- Parameters:
parameters (BaseParameters)
qoi_cls (BaseQoi)
- measurement_cls: BaseMeasurement#
- measure_node(*, execution_mode)[source]#
To be implemented by the Classes that define the Node Type: ScheduleNode or ExternalParameterNode
- Parameters:
execution_mode (ExecutionMode)
- Return type:
Dataset
- execute()[source]#
Execute the full calibration pipeline for this node. Derives the data path from the active session’s root path, using a unique per-invocation folder so repeated runs don’t collide.
- initial_operation()[source]#
To be implemented by the child measurement nodes. This is called before the execution of each and every iteration of the samples of the external samplespace. See coupler_spectroscopy for examples.
- final_operation()[source]#
To be implemented by the child measurement nodes. This is called after ALL the iteration samples of the external samplespace have been executed. e.g. set back the dc_current to 0 in coupler_spectroscopy. See coupler_spectroscopy for examples.
- precompile(schedule_samplespace)[source]#
- Parameters:
schedule_samplespace (dict)
- Return type:
CompiledSchedule
- measure_compiled_schedule(compiled_schedule, *, execution_mode=None, measurement=(1, 1))[source]#
Execute a measurement for a node and save the resulting dataset.
- Parameters:
compiled_schedule (CompiledSchedule) – The compiled schedule to execute.
execution_mode (ExecutionMode | None) – The execution mode. If None, falls back to the active session’s session_options.
measurement (tuple) – Tuple of (current_measurement, total_measurements).
- Returns:
The dataset containing the measurement results.
- Return type:
xarray.Dataset
- calibrate(data_path)[source]#
Execute the calibration workflow for this node.
- Parameters:
data_path (Path) – Directory where measurement results will be saved.
- class bragi_quantum.experiments.abstract.node.QubitNode(parameters, qoi_cls)[source]#
-
- Parameters:
parameters (BaseParameters)
qoi_cls (BaseQoi)
- property transmons: dict[str, ExtendedTransmon]#
Return transmons (qubits) restricted to this node’s parameters.qubits.
- class bragi_quantum.experiments.abstract.node.CouplerNode(parameters, qoi_cls)[source]#
-
- Parameters:
parameters (BaseParameters)
qoi_cls (BaseQoi)
- property edges: dict[str, ExtendedCompositeSquareEdge]#
Return coupler edges restricted to this node’s parameters.couplers.
Errors#
- exception bragi_quantum.experiments.abstract.errors.ExperimentBuildingError[source]#
Bases:
ExceptionRaised when a node violates bragi_quantum.experiments’s build assumptions.
- exception bragi_quantum.experiments.abstract.errors.ExperimentRegistryError[source]#
Bases:
ExceptionRaised when the bragi_quantum.experiments node registry (
nodes.yaml) fails to load, or a registered variant is used in a way that violates its spec.
- exception bragi_quantum.experiments.abstract.errors.ExperimentParameterError[source]#
Bases:
ExceptionRaised when a
BaseParameterssubclass violates a parameter convention/restriction introduced by bragi_quantum.experiments itself — e.g. a variant- defining field that isn’t a finite type, ametadata_fieldmarked as variant-defining, or an instance matching a declaredinvalid_variant_combinationsentry. Covers what would otherwise be a mix ofValueError/TypeErrorso all such violations share one type.
Node-type base classes#
Schedule nodes#
- class bragi_quantum.experiments.nodes.schedule_node.ScheduleNode(parameters, qoi_cls)[source]#
-
A Node specialized for experiments defined entirely by pulse schedules.
This class handles the complexity of mapping experimental parameters to hardware execution, specifically addressing hardware limits: 1. Standard execution for small/simple schedules. 2. Batching for schedules exceeding QCM_RF instruction limits. 3. Outer-looping for schedules exceeding QRM_RF measurement memory limits.
- property outer_schedule_dimensions: int#
Calculate the size of the outer samplespace.
The outer samplespace is used when an experiment must be split into multiple hardware executions because the number of measurement points exceeds hardware memory.
Example
self.outer_samplespace = {‘cz_amp’: {‘q1_q2’: np.array([0.1, 0.2, 0.3])}} returns 3.
- Returns:
The number of iterations required in the outer loop.
- Return type:
- measure_node(*, execution_mode)[source]#
The main entry point for executing the node’s measurement.
- Parameters:
execution_mode (ExecutionMode) – The mode of execution (real, dummy, or re-analyse).
- Returns:
The combined dataset from the schedule measurements.
- Return type:
xr.Dataset
- measure_schedule_node(*, execution_mode)[source]#
Orchestrate the measurement sequence based on schedule complexity.
It branches into three paths:
Simple: A single compilation and execution.
Mixed/Batched: Splitting schedules that have too many pulse instructions for the QCM_RF sequencers.
Outer-Looped: Splitting measurements that have too many acquisition points for the QRM_RF memory.
- Returns:
The final merged experimental data.
- Return type:
xr.Dataset
- Parameters:
execution_mode (ExecutionMode)
- class bragi_quantum.experiments.nodes.schedule_node.ScheduleQubitNode(parameters, qoi_cls, **kwargs)[source]#
Bases:
ScheduleNode,QubitNodeA ScheduleNode specifically configured for single-qubit elements.
- Parameters:
parameters (BaseParameters)
- class bragi_quantum.experiments.nodes.schedule_node.ScheduleCouplerNode(parameters, qoi_cls, **kwargs)[source]#
Bases:
ScheduleNode,CouplerNodeA ScheduleNode specifically configured for multi-qubit coupler elements.
- Parameters:
parameters (BaseParameters)
External-parameter nodes#
- class bragi_quantum.experiments.nodes.external_parameter_node.ExternalParameterNode(parameters, qoi_cls)[source]#
-
Abstract base class for nodes involving external hardware parameters.
These nodes are used for experiments where a parameter outside of the Quantify pulse schedule must be swept (e.g., DC currents from a DAC or magnetic fields).
- Parameters:
parameters (BaseParameters)
qoi_cls (BaseQoi)
- pre_measurement_operation(reduced_ext_space)[source]#
Hook called before each hardware measurement.
Subclasses implement this to set physical hardware values (like ramping a current) before the pulse schedule executes.
- property external_dimensions: list[int]#
Calculates the dimensions of the external samplespace.
Supports multidimensional external sweeps. For example, if sweeping ‘dc_current’ (4 points) and ‘offset’ (3 points), it returns [4, 3].
- Returns:
A list of lengths for each swept external quantity.
- Return type:
List[int]
- class bragi_quantum.experiments.nodes.external_parameter_node.ExternalParameterFixedScheduleNode(parameters, qoi_cls)[source]#
Bases:
ExternalParameterNodeA node where the pulse schedule is constant, but hardware parameters change.
The schedule is compiled once, and then executed repeatedly for every point in the external samplespace. This is efficient for sweeps like flux-spectroscopy.
- Parameters:
parameters (BaseParameters)
qoi_cls (BaseQoi)
- measure_node(*, execution_mode)[source]#
Executes the measurement loop for a fixed schedule.
- Parameters:
execution_mode (ExecutionMode) – The execution mode (real, dummy, re-analyse).
- Returns:
The merged dataset containing all external iterations.
- Return type:
xr.Dataset
- class bragi_quantum.experiments.nodes.external_parameter_node.ExternalParameterDifferentSchedulesNode(parameters, **kwargs)[source]#
Bases:
ExternalParameterNodeA node where the schedule changes alongside external hardware parameters.
This is used for complex calibrations where the schedule keywords depend on the external sweep index. It includes logic to handle “active elements,” allowing different elements (like couplers) to have different numbers of sweep points.
- Parameters:
parameters (BaseParameters)
- measure_node(*, execution_mode)[source]#
Executes a loop where schedules are re-compiled per iteration.
- Parameters:
execution_mode (ExecutionMode)
- Return type:
Dataset
- class bragi_quantum.experiments.nodes.external_parameter_node.ExternalParameterFixedScheduleQubitNode(parameters, **kwargs)[source]#
Bases:
ExternalParameterFixedScheduleNode,QubitNodeQubit-specific node for sweeps over external parameters with a fixed schedule.
- Parameters:
parameters (BaseParameters)
- class bragi_quantum.experiments.nodes.external_parameter_node.ExternalParameterDifferentSchedulesQubitNode(parameters, **kwargs)[source]#
Bases:
ExternalParameterDifferentSchedulesNode,QubitNodeQubit-specific node for sweeps over external parameters with varying schedules.
- Parameters:
parameters (BaseParameters)
- class bragi_quantum.experiments.nodes.external_parameter_node.ExternalParameterFixedScheduleCouplerNode(parameters, **kwargs)[source]#
Bases:
ExternalParameterFixedScheduleNode,CouplerNodeCoupler-specific node for sweeps over external parameters with a fixed schedule.
- Parameters:
parameters (BaseParameters)
- class bragi_quantum.experiments.nodes.external_parameter_node.ExternalParameterDifferentSchedulesCouplerNode(parameters, **kwargs)[source]#
Bases:
ExternalParameterDifferentSchedulesNode,CouplerNodeCoupler-specific node for sweeps over external parameters with varying schedules.
- Parameters:
parameters (BaseParameters)
Readout nodes#
Resonator spectroscopy#
Node implementation for Resonator Spectroscopy.
- class bragi_quantum.experiments.nodes.readout.resonator_spectroscopy.node.ResonatorSpectroscopy(parameters, qoi_cls=<class 'bragi_quantum.experiments.nodes.readout.resonator_spectroscopy.parameters.ResonatorSpectroscopyBaseQOI'>)[source]#
Bases:
ScheduleQubitNodeExecution node for performing Resonator Spectroscopy.
Inherits from ScheduleNode to automatically leverage ActiveSession for hardware and datastore state, injecting keywords and sample spaces into the measurement schedule.
- Parameters:
parameters (ResonatorSpectroscopyParameters)
qoi_cls (type[ResonatorSpectroscopyBaseQOI])
- measurement_cls#
alias of
ResonatorSpectroscopyMeasurement
- analysis_cls#
alias of
ResonatorSpectroscopyAnalysis
- parameters: ResonatorSpectroscopyParameters#
- pydantic model bragi_quantum.experiments.nodes.readout.resonator_spectroscopy.parameters.ResonatorSpectroscopyParameters[source]#
Bases:
BaseParametersParameters for Resonator Spectroscopy & Punchout.
- Fields:
- field readout_state: Literal[0, 1, 2] = 0#
Basis state the resonator is prepared to before readout.
- Constraints:
ge = 0
lt = 3
- field sample_size_for_sliding_window_analysis: int = 200#
Frequency-point count above which a resonator sweep is treated as wide-range and routed through the sliding-window fit instead of a single fit over the full window. A wide sweep can contain more than one dip-like feature, so it needs to be localized onto one resonance first.
- field slide_window_size: int = 100#
Number of frequency points in each sliding sub-window fit during the wide-range path.
- field slide_window_step: int = 50#
Number of frequency points the sliding window advances between successive fit attempts.
- field slide_window_min_ql: float = 7000.0#
Minimum loaded quality factor Ql a sliding-window fit must reach (in addition to the R^2 gate) to be accepted as the resonance and stop the window scan.
- field slide_window_max_qe: float = 60000.0#
Maximum external quality factor Qe a sliding-window fit may have (in addition to the R^2 gate) to be accepted as the resonance and stop the window scan.
- field min_r_squared: float = 0.9#
Minimum R^2 (coefficient of determination, data vs. fit) accepted for a resonator fit. R^2 doesn’t need an assumed per-point error, so its scale is fixed regardless of the qubit’s signal level.
- pydantic model bragi_quantum.experiments.nodes.readout.resonator_spectroscopy.parameters.ResonatorSpectroscopyBaseQOI[source]#
Bases:
BaseQoiBase Quantities of Interest for Resonator Spectroscopy.
- Fields:
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
- pydantic model bragi_quantum.experiments.nodes.readout.resonator_spectroscopy.parameters.ResonatorSpectroscopyQOI[source]#
Bases:
ResonatorSpectroscopyBaseQOIQuantities of Interest for Resonator Spectroscopy (State 0).
- Fields:
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
- pydantic model bragi_quantum.experiments.nodes.readout.resonator_spectroscopy.parameters.ResonatorSpectroscopy1QOI[source]#
Bases:
ResonatorSpectroscopyBaseQOIQuantities of Interest for Resonator Spectroscopy (State 1).
- Fields:
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
- pydantic model bragi_quantum.experiments.nodes.readout.resonator_spectroscopy.parameters.ResonatorSpectroscopy2QOI[source]#
Bases:
ResonatorSpectroscopyBaseQOIQuantities of Interest for Resonator Spectroscopy (State 2).
- Fields:
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
Module containing classes that fit data from a resonator spectroscopy experiment.
One model is used here: hanger_with_delay_model
(hanger_with_delay()) —
the full complex hanger response (resonance dip, amplitude tilt,
impedance-mismatch asymmetry, and cable propagation delay), fit directly
against complex IQ data. See bragi_quantum.experiments.nodes.readout.resonator_spectroscopy.model.
Punchout (readout-amplitude calibration) reuses this exact same fit, one call per amplitude slice — a punchout trace is not a different kind of resonator sweep, so it doesn’t need a different model or a special mode flag.
- class bragi_quantum.experiments.nodes.readout.resonator_spectroscopy.analysis.ResonatorSpectroscopyAnalysis(parameters, qoi_cls=None)[source]#
Bases:
AnalysisFit the data of a resonator spectroscopy experiment.
Replaces the former
ResonatorSpectroscopyBaseQubitAnalysis/ResonatorSpectroscopyQubitAnalysis(per-qubit) +…NodeAnalysis(node-level).ResonatorSpectroscopy1Analysis/…2Analysisadd the state-1/2 markers.- Parameters:
parameters (ResonatorSpectroscopyParameters)
- parameters: ResonatorSpectroscopyParameters#
- resonator_analysis()[source]#
Executes the fitting routine on the dataset populated by the abstract layer. Fits the complex hanger-with-delay model directly against the raw complex IQ data.
- Return type:
None
- is_good_fit(fit_result)[source]#
Validate if the provided fit meets the quality constraints.
Gated on R^2 (
r_squared(), not lmfit’s ownrsquared— see that function’s docstring), used for both the final fit and the sliding-window candidate search. Without a real per-point noise estimate (no SSRO), any chi-squared threshold would depend on an assumed error scale that doesn’t track the real SNR, so chi-squared has no fixed meaning across qubits/amplitudes and isn’t tracked anywhere in this module.Used uniformly by every caller — the plain resonator_spectroscopy node and punchout call this same check. Always called with
self.fit_resultin practice, which is what_fit_r_squaredscores against.- Parameters:
fit_result (ModelResult)
- Return type:
- compute_qoi()[source]#
Run the resonator fit and return the QOI.
Used as-is by every state (0/1/2) and every caller (plain resonator_spectroscopy and punchout) — they all fit the same model and gate on the same
is_good_fit(), so there’s nothing left to specialize here.- Return type:
- plot_title()[source]#
Title for this element’s (sub)plot. Override per node if desired.
- Return type:
- add_traces(fig, row=1, col=1)[source]#
Draw the fitted model (magnitude) over the raw data (plotly).
The fit curve is drawn on the dense frequency grid (_f_dense) so it looks smooth even for narrow resonances. The black vertical line is placed at the closed-form magnitude minimum, so it always lands exactly on the dip regardless of background slope.
- class bragi_quantum.experiments.nodes.readout.resonator_spectroscopy.analysis.ResonatorSpectroscopy1Analysis(parameters, qoi_cls=None)[source]#
Bases:
ResonatorSpectroscopyAnalysisResonator spectroscopy specialised for state 1.
- Parameters:
parameters (ResonatorSpectroscopyParameters)
- compute_qoi()[source]#
Run the resonator fit and return the QOI.
Used as-is by every state (0/1/2) and every caller (plain resonator_spectroscopy and punchout) — they all fit the same model and gate on the same
is_good_fit(), so there’s nothing left to specialize here.- Return type:
- add_traces(fig, row=1, col=1)[source]#
Draw the fitted model (magnitude) over the raw data (plotly).
The fit curve is drawn on the dense frequency grid (_f_dense) so it looks smooth even for narrow resonances. The black vertical line is placed at the closed-form magnitude minimum, so it always lands exactly on the dip regardless of background slope.
- class bragi_quantum.experiments.nodes.readout.resonator_spectroscopy.analysis.ResonatorSpectroscopy2Analysis(parameters, qoi_cls=None)[source]#
Bases:
ResonatorSpectroscopyAnalysisResonator spectroscopy specialised for state 2.
- Parameters:
parameters (ResonatorSpectroscopyParameters)
- compute_qoi()[source]#
Run the resonator fit and return the QOI.
Used as-is by every state (0/1/2) and every caller (plain resonator_spectroscopy and punchout) — they all fit the same model and gate on the same
is_good_fit(), so there’s nothing left to specialize here.- Return type:
- add_traces(fig, row=1, col=1)[source]#
Draw the fitted model (magnitude) over the raw data (plotly).
The fit curve is drawn on the dense frequency grid (_f_dense) so it looks smooth even for narrow resonances. The black vertical line is placed at the closed-form magnitude minimum, so it always lands exactly on the dip regardless of background slope.
Punchout#
Node implementation for Punchout (readout amplitude) calibration.
- class bragi_quantum.experiments.nodes.readout.punchout.node.Punchout(parameters, qoi_cls=<class 'bragi_quantum.experiments.nodes.readout.punchout.parameters.PunchoutQOI'>)[source]#
Bases:
ScheduleQubitNodeExecution node for performing Punchout.
A single node class handles the 0, 1 and 2 readout clocks (
state) and both end point methods (bin_mode, seePunchoutParameters). The analysis class and QOI class are injected at construction time, mirroring the resonator spectroscopy interface used by the orchestrator.Inherits from ScheduleNode to automatically leverage ActiveSession for hardware and datastore state, injecting keywords and sample spaces into the measurement schedule.
- Parameters:
parameters (PunchoutParameters)
qoi_cls (type[PunchoutBaseQOI])
- measurement_cls#
alias of
PunchoutMeasurement
- analysis_cls#
alias of
PunchoutAnalysis
- parameters: PunchoutParameters#
- pydantic model bragi_quantum.experiments.nodes.readout.punchout.parameters.PunchoutParameters[source]#
Bases:
BaseParametersParameters for Punchout (readout amplitude) calibration.
bin_modeselects the end point method the same wayreadout_stateselects the readout clock:"average_append"hardware-averages each point and finds the end point from a shift in the fitted resonator frequency;"append"keeps every single-shot repetition instead and finds the end point from that IQ cloud’s circularity.The readout-amplitude sweep is sampled more densely at low power, where the resonator dip moves quickly, and more coarsely at high power. The two segments are configured by
crossover_amplitudeand the two bin counts.- Fields:
- field readout_state: Literal[0, 1, 2] = 0#
Basis state the resonator is prepared to before readout.
- Constraints:
ge = 0
lt = 3
- field crossover_amplitude: float = 0.06#
Amplitude where the dense low-power segment hands over to the coarse high-power segment.
- field bin_mode: Literal['average_append', 'append'] = 'average_append'#
‘average_append’ hardware-averages each point (‘repetitions’ averages) and selects the frequency-shift end point; ‘append’ keeps every single-shot repetition instead and selects the IQ-cloud-circularity end point.
- field upper_threshold: float = 10000000.0#
Upward resonator-frequency shift (Hz) that ends the punchout.
- field lower_threshold: float = 50000.0#
Downward resonator-frequency shift (Hz) that ends the punchout.
- field amplitude_scale_factor: float = 0.8#
Fraction of the end-point amplitude used as the operating point.
- field max_consecutive_missing_points: int = 3#
Maximum number of consecutive amplitudes without a valid fit before the punchout search is stopped.
- field circularity_threshold: float = 0.8#
Minimum IQ-cloud circularity (ratio of the covariance eigenvalues) required to consider an amplitude still in the linear (non-discriminating) regime.
- field min_r_squared: float = 0.9#
Minimum R^2 (coefficient of determination) accepted for a per-amplitude resonator fit (forwarded to ResonatorSpectroscopyParameters).
- field max_abs_theta: float = 0.25#
Maximum theta magnitude (impedance-mismatch phase, rad) accepted for a per-amplitude resonator fit (forwarded to ResonatorSpectroscopyParameters).
- legal_variant_combinations: ClassVar[tuple[ParameterCombination, ...]] = (mappingproxy({'readout_state': 0, 'bin_mode': 'average_append'}), mappingproxy({'readout_state': 0, 'bin_mode': 'append'}), mappingproxy({'readout_state': 1, 'bin_mode': 'average_append'}), mappingproxy({'readout_state': 1, 'bin_mode': 'append'}), mappingproxy({'readout_state': 2, 'bin_mode': 'average_append'}), mappingproxy({'readout_state': 2, 'bin_mode': 'append'}))#
- pydantic model bragi_quantum.experiments.nodes.readout.punchout.parameters.PunchoutBaseQOI[source]#
Bases:
BaseQoiBase Quantities of Interest for Punchout.
- Fields:
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
- pydantic model bragi_quantum.experiments.nodes.readout.punchout.parameters.PunchoutQOI[source]#
Bases:
PunchoutBaseQOIQuantities of Interest for Punchout (State 0).
- Fields:
- to_dict()[source]#
Returns the calculated QOIs as a dictionary. The keys should match the attribute paths in the bragi_quantum.datalayer models (e.g., {‘rxy.amp180’: 0.5}).
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
- pydantic model bragi_quantum.experiments.nodes.readout.punchout.parameters.Punchout1QOI[source]#
Bases:
PunchoutBaseQOIQuantities of Interest for Punchout (State 1).
- Fields:
- to_dict()[source]#
Returns the calculated QOIs as a dictionary. The keys should match the attribute paths in the bragi_quantum.datalayer models (e.g., {‘rxy.amp180’: 0.5}).
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
- pydantic model bragi_quantum.experiments.nodes.readout.punchout.parameters.Punchout2QOI[source]#
Bases:
PunchoutBaseQOIQuantities of Interest for Punchout (State 2).
- Fields:
- to_dict()[source]#
Returns the calculated QOIs as a dictionary. The keys should match the attribute paths in the bragi_quantum.datalayer models (e.g., {‘rxy.amp180’: 0.5}).
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
Module containing classes that analyse data from a punchout experiment.
For each readout pulse amplitude, the swept resonator trace is fitted with the
same ResonatorSpectroscopyAnalysis used by the plain
resonator_spectroscopy node — a punchout amplitude slice isn’t a different
kind of resonator sweep, so it doesn’t need special-cased fitting. Two end
point methods are supported, selected by PunchoutParameters.bin_mode:
Frequency shift (
bin_mode="average_append"): the amplitude at which the fitted resonator frequency starts to shift away from its low-power value marks the punchout end point, and a scaled fraction of that amplitude is returned as the operating readout amplitude.Circularity (
bin_mode="append"): the amplitude at which the single-shot IQ cloud at the resonator dip stops being circular (i.e. state discrimination starts to bias the resonator fit) marks the end point. This requires single-shot acquisitions (ashot_indexdimension in the raw dataset).
- class bragi_quantum.experiments.nodes.readout.punchout.analysis.PunchoutAnalysis(parameters, qoi_cls=None, **kwargs)[source]#
Bases:
AnalysisDetermine the operating readout amplitude for a qubit (unified, plotly).
Replaces the former
PunchoutQubitAnalysis+PunchoutNodeAnalysis. For each readout amplitude the resonator trace is fitted (reusingResonatorSpectroscopyAnalysisverbatim, one call per amplitude slice). Which end point method then runs —_find_endpoint_frequency_shift()or_find_endpoint_circularity()— is driven byself.parameters.bin_mode, the same wayself.parameters.readout_statedrives which clock the measurement targets.- Parameters:
parameters (PunchoutParameters)
- parameters: PunchoutParameters#
- plot_title()[source]#
Title for this element’s (sub)plot. Override per node if desired.
- Return type:
- compute_qoi()[source]#
Compute the QOI for the current element.
Runs against
self.dataset/self.magnitudes/self.data_var(already set for the current element) and should store whatever stateadd_traces()needs onself.- Return type:
IQ-cloud circularity tools for the punchout node’s circularity end point
(PunchoutParameters.bin_mode="append").
A cloud is the set of single-shot (I, Q) readings taken at one readout amplitude, at that amplitude’s fitted resonator dip. While the readout stays in the linear regime the cloud is round; once it starts discriminating qubit states it stretches, which also biases the resonator fit.
- bragi_quantum.experiments.nodes.readout.punchout.circularity.iq_clouds_at_dip(raw_dataset, data_var, amplitude_coord, frequency_coord, amplitudes, resonator_analyses)[source]#
Return the (N, 2) single-shot IQ cloud at each amplitude’s resonator dip.
The dip is the minimum-|S21| frequency bin of that amplitude’s resonator fit (
ana.min_freq_data). An entry isNonewhere the fit failed or the shots could not be selected, so callers can skip that amplitude.
- bragi_quantum.experiments.nodes.readout.punchout.circularity.compute_circularities(clouds)[source]#
Circularity of each IQ cloud: min/max covariance eigenvalue.
1.0 is a perfectly round (isotropic) cloud and 0.0 a fully elongated one;
nanmarks a cloud that is missing or too degenerate to fit.
- bragi_quantum.experiments.nodes.readout.punchout.circularity.find_endpoint_by_circularity(detected_amplitudes, detected_frequencies, circularities, circularity_threshold, qubit)[source]#
Return the last (index, amplitude, frequency) before circularity drops.
Considers all amplitudes, so a transient dip in circularity (noise) does not end the search early: the end point is the highest amplitude still at or above circularity_threshold — more power is better as long as the readout stays in the linear regime. Falls back to the highest available circularity when nothing reaches the threshold, and returns (None, None, None) when no amplitude has a usable fit at all.
- bragi_quantum.experiments.nodes.readout.punchout.circularity.circularity_figure(amplitudes, circularities, circularity_threshold, end_point_index)[source]#
Standalone circularity-vs-amplitude chart: the threshold line and, if an end point was found, a green star marking it.
- bragi_quantum.experiments.nodes.readout.punchout.circularity.point_clouds_grid_figure(clouds, amplitudes, end_point_index)[source]#
One IQ-cloud scatter (with a 99% confidence ellipse) per amplitude whose resonator fit succeeded; the amplitude selected as the circularity end point is outlined in green.
Axis titles/tick labels are shown only on the grid’s outer edge — with many amplitudes, repeating them on every cell just overlaps into noise.
Readout frequency optimization#
Node implementation for readout-frequency optimization.
- class bragi_quantum.experiments.nodes.readout.ro_frequency_optimization.node.ROTwoStateFrequencyOptimizationNode(parameters, qoi_cls=<class 'bragi_quantum.experiments.nodes.readout.ro_frequency_optimization.parameters.ROTwoStateFrequencyOptimizationQOI'>)[source]#
Bases:
ScheduleQubitNodeExecution node for the 2-state (|0>, |1>) readout-frequency optimization.
The prepared states are passed as a samplespace (
qubit_states); the measurement derives the optimization clock from them, so noqubit_stateschedule keyword is needed (it would clash with the multi-state sweep).- Parameters:
parameters (ROFrequencyOptimizationParameters)
qoi_cls (type[ROTwoStateFrequencyOptimizationQOI])
- measurement_cls#
alias of
ROFrequencyOptimizationMeasurement
- analysis_cls#
- parameters: ROFrequencyOptimizationParameters#
- class bragi_quantum.experiments.nodes.readout.ro_frequency_optimization.node.ROThreeStateFrequencyOptimizationNode(parameters, qoi_cls=<class 'bragi_quantum.experiments.nodes.readout.ro_frequency_optimization.parameters.ROThreeStateFrequencyOptimizationQOI'>)[source]#
Bases:
ScheduleQubitNodeExecution node for the 3-state (|0>, |1>, |2>) readout-frequency optimization.
- Parameters:
parameters (ROFrequencyOptimizationParameters)
qoi_cls (type[ROThreeStateFrequencyOptimizationQOI])
- measurement_cls#
alias of
ROFrequencyOptimizationMeasurement
- analysis_cls#
- parameters: ROFrequencyOptimizationParameters#
- pydantic model bragi_quantum.experiments.nodes.readout.ro_frequency_optimization.parameters.ROFrequencyOptimizationParameters[source]#
Bases:
BaseParametersParameters for readout-frequency optimization nodes.
- pydantic model bragi_quantum.experiments.nodes.readout.ro_frequency_optimization.parameters.ROTwoStateFrequencyOptimizationQOI[source]#
Bases:
BaseQoiQuantities of Interest for the readout 2-state frequency optimization.
- Fields:
- to_dict()[source]#
Returns the calculated QOIs as a dictionary. The keys should match the attribute paths in the bragi_quantum.datalayer models (e.g., {‘rxy.amp180’: 0.5}).
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
- pydantic model bragi_quantum.experiments.nodes.readout.ro_frequency_optimization.parameters.ROThreeStateFrequencyOptimizationQOI[source]#
Bases:
BaseQoiQuantities of Interest for the readout 3-state frequency optimization.
- Fields:
- to_dict()[source]#
Returns the calculated QOIs as a dictionary. The keys should match the attribute paths in the bragi_quantum.datalayer models (e.g., {‘rxy.amp180’: 0.5}).
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
Module containing classes that select the optimal readout frequency.
The resonator is probed with the qubit in each prepared state; the optimal frequency maximises the |0>/|1> IQ separation (2-state) or the area of the |0>,|1>,|2> triangle (3-state).
- class bragi_quantum.experiments.nodes.readout.ro_frequency_optimization.analysis.ROTwoStateFrequencyOptimizationAnalysis(parameters, qoi_cls=None, **kwargs)[source]#
Bases:
AnalysisSelects the readout frequency maximising the |0>/|1> IQ-plane separation (unified, plotly).
Replaces the former
ROTwoStateFrequencyOptimizationQubitAnalysis+ROTwoStateFrequencyOptimizationNodeAnalysis.- Parameters:
qoi_cls (type[ROTwoStateFrequencyOptimizationQOI] | None)
- plot_title()[source]#
Title for this element’s (sub)plot. Override per node if desired.
- Return type:
- compute_qoi()[source]#
Compute the QOI for the current element.
Runs against
self.dataset/self.magnitudes/self.data_var(already set for the current element) and should store whatever stateadd_traces()needs onself.- Return type:
- class bragi_quantum.experiments.nodes.readout.ro_frequency_optimization.analysis.ROThreeStateFrequencyOptimizationAnalysis(parameters, qoi_cls=None, **kwargs)[source]#
Bases:
ROTwoStateFrequencyOptimizationAnalysisSelects the readout frequency maximising the area of the |0>,|1>,|2> triangle in the IQ plane (unified, plotly).
Replaces the former
ROThreeStateFrequencyOptimizationQubitAnalysis+ROThreeStateFrequencyOptimizationNodeAnalysis.- Parameters:
qoi_cls (type[ROThreeStateFrequencyOptimizationQOI] | None)
- compute_qoi()[source]#
Compute the QOI for the current element.
Runs against
self.dataset/self.magnitudes/self.data_var(already set for the current element) and should store whatever stateadd_traces()needs onself.- Return type:
Readout amplitude optimization#
Node implementations for readout amplitude optimisation.
Uses single-shot acquisitions (bin_mode=”append”) to build IQ clouds at each swept RO amplitude, then applies LDA to find the amplitude that maximises state-assignment fidelity.
- class bragi_quantum.experiments.nodes.readout.ro_amplitude_optimization.node.ROTwoStateAmplitudeOptimizationNode(parameters, qoi_cls=<class 'bragi_quantum.experiments.nodes.readout.ro_amplitude_optimization.parameters.ROTwoStateAmplitudeOptimizationQOI'>)[source]#
Bases:
ScheduleQubitNodeExecution node for the 2-state (|0>, |1>) RO amplitude optimisation.
Sweeps the RO pulse amplitude around the punchout value, collecting single-shot IQ data at each point. LDA selects the amplitude that maximises assignment fidelity.
- Parameters:
parameters (ROAmplitudeOptimizationParameters)
qoi_cls (type[ROTwoStateAmplitudeOptimizationQOI])
- measurement_cls#
alias of
ROAmplitudeOptimizationMeasurement
- analysis_cls#
- parameters: ROAmplitudeOptimizationParameters#
- class bragi_quantum.experiments.nodes.readout.ro_amplitude_optimization.node.ROThreeStateAmplitudeOptimizationNode(parameters, qoi_cls=<class 'bragi_quantum.experiments.nodes.readout.ro_amplitude_optimization.parameters.ROThreeStateAmplitudeOptimizationQOI'>)[source]#
Bases:
ScheduleQubitNodeExecution node for the 3-state (|0>, |1>, |2>) RO amplitude optimisation.
- Parameters:
parameters (ROAmplitudeOptimizationParameters)
qoi_cls (type[ROThreeStateAmplitudeOptimizationQOI])
- measurement_cls#
alias of
ROAmplitudeOptimizationMeasurement
- analysis_cls#
- parameters: ROAmplitudeOptimizationParameters#
Parameters and QOI classes for readout amplitude optimisation.
- pydantic model bragi_quantum.experiments.nodes.readout.ro_amplitude_optimization.parameters.ROAmplitudeOptimizationParameters[source]#
Bases:
BaseParametersConfiguration for readout amplitude optimisation nodes.
- Fields:
- pydantic model bragi_quantum.experiments.nodes.readout.ro_amplitude_optimization.parameters.ROTwoStateAmplitudeOptimizationQOI[source]#
Bases:
BaseQoiQOI for the 2-state (|0>, |1>) RO amplitude optimisation.
- Fields:
- to_dict()[source]#
Returns the calculated QOIs as a dictionary. The keys should match the attribute paths in the bragi_quantum.datalayer models (e.g., {‘rxy.amp180’: 0.5}).
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
- pydantic model bragi_quantum.experiments.nodes.readout.ro_amplitude_optimization.parameters.ROThreeStateAmplitudeOptimizationQOI[source]#
Bases:
BaseQoiQOI for the 3-state (|0>, |1>, |2>) RO amplitude optimisation.
- Fields:
- to_dict()[source]#
Returns the calculated QOIs as a dictionary. The keys should match the attribute paths in the bragi_quantum.datalayer models (e.g., {‘rxy.amp180’: 0.5}).
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
Analysis classes for readout amplitude optimisation.
For each swept RO amplitude, an LDA classifier is fitted to the single-shot IQ cloud (states |0> and |1>, or |0>, |1>, |2>). The optimal amplitude is the one that maximises the trace-normalised confusion-matrix diagonal (assignment fidelity).
- Dataset coordinate expectations (after configure_dataset):
one coord whose name contains “amplitudes” → amplitude sweep axis
one coord whose name contains “state” → prepared qubit state
one coord whose name contains “shot” → individual shot index
- class bragi_quantum.experiments.nodes.readout.ro_amplitude_optimization.analysis.ROAmplitudeOptimizationAnalysis(parameters, qoi_cls=None, **kwargs)[source]#
Bases:
AnalysisShared per-qubit LDA machinery for RO amplitude optimisation (unified, plotly).
Replaces the former
ROAmplitudeOptimizationQubitAnalysis+RO{Two,Three}StateAmplitudeOptimizationNodeAnalysis. Subclasses (ROTwoStateAmplitudeOptimizationAnalysis/ROThreeStateAmplitudeOptimizationAnalysis) implement the state-count-specific parts offit()and the IQ-cloud support figure.- plot_title()[source]#
Title for this element’s (sub)plot. Override per node if desired.
- Return type:
- class bragi_quantum.experiments.nodes.readout.ro_amplitude_optimization.analysis.ROTwoStateAmplitudeOptimizationAnalysis(parameters, qoi_cls=None, **kwargs)[source]#
Bases:
ROAmplitudeOptimizationAnalysisOptimal RO amplitude for the 2-state (|0>, |1>) discrimination (unified, plotly).
Replaces the former
ROTwoStateAmplitudeOptimizationQubitAnalysis+ROTwoStateAmplitudeOptimizationNodeAnalysis.- Parameters:
qoi_cls (type[ROTwoStateAmplitudeOptimizationQOI] | None)
- class bragi_quantum.experiments.nodes.readout.ro_amplitude_optimization.analysis.ROThreeStateAmplitudeOptimizationAnalysis(parameters, qoi_cls=None, **kwargs)[source]#
Bases:
ROAmplitudeOptimizationAnalysisOptimal RO amplitude for the 3-state (|0>, |1>, |2>) discrimination (unified, plotly).
Replaces the former
ROThreeStateAmplitudeOptimizationQubitAnalysis+ROThreeStateAmplitudeOptimizationNodeAnalysis.- Parameters:
qoi_cls (type[ROThreeStateAmplitudeOptimizationQOI] | None)
Readout combined optimization#
Node implementations for readout combined amplitude and frequency optimisation.
Uses single-shot acquisitions (bin_mode=”append”) to build IQ clouds at each swept RO amplitude for each RO frequency, then applies LDA to find the amplitude and frequency that maximises state-assignment fidelity.
- class bragi_quantum.experiments.nodes.readout.ro_combined_optimization.node.ROTwoStateCombinedOptimizationNode(parameters, qoi_cls=<class 'bragi_quantum.experiments.nodes.readout.ro_combined_optimization.parameters.ROTwoStateCombinedOptimizationQOI'>)[source]#
Bases:
_AmplitudeSweepMixin,ScheduleQubitNodeExecution node for the 2-state (|0>, |1>) RO amplitude optimisation.
Sweeps the RO pulse amplitude around the punchout value, collecting single-shot IQ data at each point. LDA selects the amplitude that maximises assignment fidelity.
- Parameters:
parameters (ROCombinedOptimizationParameters)
qoi_cls (type[ROTwoStateCombinedOptimizationQOI])
- measurement_cls#
alias of
ROCombinedOptimizationMeasurement
- analysis_cls#
- parameters: ROCombinedOptimizationParameters#
- class bragi_quantum.experiments.nodes.readout.ro_combined_optimization.node.ROThreeStateCombinedOptimizationNode(parameters, qoi_cls=<class 'bragi_quantum.experiments.nodes.readout.ro_combined_optimization.parameters.ROThreeStateCombinedOptimizationQOI'>)[source]#
Bases:
_AmplitudeSweepMixin,ScheduleQubitNodeExecution node for the 3-state (|0>, |1>, |2>) RO amplitude optimisation.
- Parameters:
parameters (ROCombinedOptimizationParameters)
qoi_cls (type[ROThreeStateCombinedOptimizationQOI])
- measurement_cls#
alias of
ROCombinedOptimizationMeasurement
- analysis_cls#
- parameters: ROCombinedOptimizationParameters#
Parameters and QOI classes for readout amplitude optimisation.
- pydantic model bragi_quantum.experiments.nodes.readout.ro_combined_optimization.parameters.ROCombinedOptimizationParameters[source]#
Bases:
BaseParametersConfiguration for readout amplitude optimisation nodes.
- Fields:
- field amplitude_lower_fraction: float = 1.0#
Lower bound of the amplitude sweep as a fraction of the nominal amplitude.
- pydantic model bragi_quantum.experiments.nodes.readout.ro_combined_optimization.parameters.ROTwoStateCombinedOptimizationQOI[source]#
Bases:
BaseQoiQOI for the 2-state (|0>, |1>) RO amplitude optimisation.
- Fields:
- to_dict()[source]#
Returns the calculated QOIs as a dictionary. The keys should match the attribute paths in the bragi_quantum.datalayer models (e.g., {‘rxy.amp180’: 0.5}).
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
- pydantic model bragi_quantum.experiments.nodes.readout.ro_combined_optimization.parameters.ROThreeStateCombinedOptimizationQOI[source]#
Bases:
BaseQoiQuantity of Interest (QOI) results from the readout 3 states amplitude optimization.
- Fields:
- to_dict()[source]#
Returns the calculated QOIs as a dictionary. The keys should match the attribute paths in the bragi_quantum.datalayer models (e.g., {‘rxy.amp180’: 0.5}).
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
Analysis classes for readout combined amplitude and frequency optimisation.
For each (amplitude, frequency) pair in the 2-D sweep, an LDA classifier is fitted to the single-shot IQ cloud (states |0> and |1>, or |0>, |1>, |2>). The optimal (amplitude, frequency) pair is the one that maximises the trace-normalised confusion-matrix diagonal (assignment fidelity).
- Dataset coordinate expectations (after configure_dataset):
one coord whose name contains “amplitudes” → amplitude sweep axis
one coord whose name contains “frequencies” → frequency sweep axis
one coord whose name contains “state” → prepared qubit state
one coord whose name contains “loops” → individual shot index
- class bragi_quantum.experiments.nodes.readout.ro_combined_optimization.analysis.ROCombinedOptimizationAnalysis(parameters, qoi_cls=None, **kwargs)[source]#
Bases:
AnalysisShared per-qubit LDA machinery for RO combined amplitude/frequency optimisation (unified, plotly).
Replaces the former
ROCombinedOptimizationQubitAnalysis+RO{Two,Three}StateCombinedOptimizationNodeAnalysis. Subclasses (ROTwoStateCombinedOptimizationAnalysis/ROThreeStateCombinedOptimizationAnalysis) implement the state-count-specific parts offit()and the IQ-cloud support figure.- plot_title()[source]#
Title for this element’s (sub)plot. Override per node if desired.
- Return type:
- IQ(amp_index, freq_index)[source]#
Extract (N_shots, 2) IQ array for the given amplitude and frequency indices.
- class bragi_quantum.experiments.nodes.readout.ro_combined_optimization.analysis.ROTwoStateCombinedOptimizationAnalysis(parameters, qoi_cls=None, **kwargs)[source]#
Bases:
ROCombinedOptimizationAnalysisOptimal RO amplitude/frequency for the 2-state (|0>, |1>) discrimination.
Replaces the former
ROTwoStateCombinedOptimizationQubitAnalysis+ROTwoStateCombinedOptimizationNodeAnalysis.- Parameters:
qoi_cls (type[ROTwoStateCombinedOptimizationQOI] | None)
- class bragi_quantum.experiments.nodes.readout.ro_combined_optimization.analysis.ROThreeStateCombinedOptimizationAnalysis(parameters, qoi_cls=None, **kwargs)[source]#
Bases:
ROCombinedOptimizationAnalysisOptimal RO amplitude/frequency for the 3-state (|0>, |1>, |2>) discrimination.
Replaces the former
ROThreeStateCombinedOptimizationQubitAnalysis+ROThreeStateCombinedOptimizationNodeAnalysis.- Parameters:
qoi_cls (type[ROThreeStateCombinedOptimizationQOI] | None)
Qubit-control nodes#
Qubit spectroscopy#
Node implementation for Qubit (Two-Tone) Spectroscopy.
- class bragi_quantum.experiments.nodes.qubit_control.spectroscopy.node.QubitSpectroscopy(parameters, qoi_cls=<class 'bragi_quantum.experiments.nodes.qubit_control.spectroscopy.parameters.QubitSpectroscopyBaseQOI'>)[source]#
Bases:
ScheduleQubitNodeExecution node for performing Qubit (Two-Tone) Spectroscopy.
A single node class handles both the 0→1 and 1→2 transitions; the transition is selected by the
stateandtransitionfields inQubitSpectroscopyParameters. The analysis class and QOI class are injected at construction time, mirroring the resonator spectroscopy interface used by the orchestrator.- Parameters:
parameters (QubitSpectroscopyParameters)
qoi_cls (type[QubitSpectroscopyBaseQOI])
- measurement_cls#
alias of
TwoTonesMultidimMeasurement
- analysis_cls#
alias of
QubitSpectroscopyAnalysis
- parameters: QubitSpectroscopyParameters#
- pydantic model bragi_quantum.experiments.nodes.qubit_control.spectroscopy.parameters.QubitSpectroscopyParameters[source]#
Bases:
BaseParametersParameters for Qubit Spectroscopy (two-tone experiment).
- Fields:
- invalid_variant_combinations: ClassVar[tuple[Mapping[str, Any], ...]] = (mappingproxy({'transition': '12', 'continuous_mode': True}),)#
- field continuous_mode: bool = False#
Whether to drive the qubit with a continuous tone rather than a pulse. Faster and more reliable than pulsed spectroscopy, but only useable with the 0->1 transition.
- field spec_pulse_duration: float | None = None#
Duration of the spectroscopy drive pulse in seconds. None uses the qubit’s device value (spec.spec_duration for 0->1, spec.spec_duration_12 for 1->2), or if that is unset 20 us for 0->1 and 0.5 us for 1->2. Ignored when continuous_mode is True.
- Constraints:
gt = 0
- field continuous_reset_duration: float = 2e-05#
Idle time after each measurement in continuous mode, in seconds. Continuous mode holds the drive on and so cannot reset the qubit passively the way the pulsed schedule does; this wait instead lets the readout resonator ring down (~1/kappa) so successive measurements stay statistically independent. It exists as a parameter because reset_system has no settable duration. Ignored when continuous_mode is False.
- resolve_spec_pulse_duration(transmon)[source]#
Return the pulse duration to use for
transmon.An explicit
spec_pulse_durationwins; otherwise the transition’s duration is read from the transmon’sspecsubmodule, falling back toDEFAULT_SPEC_PULSE_DURATIONwhen that is unset (NaN).- Parameters:
transmon (ExtendedTransmon)
- Return type:
- pydantic model bragi_quantum.experiments.nodes.qubit_control.spectroscopy.parameters.QubitSpectroscopyBaseQOI[source]#
Bases:
BaseQoiBase Quantities of Interest for Qubit Spectroscopy.
- to_dict()[source]#
Returns the calculated QOIs as a dictionary. The keys should match the attribute paths in the bragi_quantum.datalayer models (e.g., {‘rxy.amp180’: 0.5}).
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
- pydantic model bragi_quantum.experiments.nodes.qubit_control.spectroscopy.parameters.QubitSpectroscopy01QOI[source]#
Bases:
QubitSpectroscopyBaseQOIQuantities of Interest for Qubit Spectroscopy (0→1 transition).
- Fields:
- to_dict()[source]#
Returns the calculated QOIs as a dictionary. The keys should match the attribute paths in the bragi_quantum.datalayer models (e.g., {‘rxy.amp180’: 0.5}).
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
- pydantic model bragi_quantum.experiments.nodes.qubit_control.spectroscopy.parameters.QubitSpectroscopy12QOI[source]#
Bases:
QubitSpectroscopyBaseQOIQuantities of Interest for Qubit Spectroscopy (1→2 transition).
- Fields:
- to_dict()[source]#
Returns the calculated QOIs as a dictionary. The keys should match the attribute paths in the bragi_quantum.datalayer models (e.g., {‘rxy.amp180’: 0.5}).
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
Module containing classes that fit and plot data from a qubit (two-tone) spectroscopy experiment.
For each spectroscopy pulse amplitude, a Lorentzian + constant baseline is fitted to the 1-D frequency trace. The amplitude whose fitted peak_height is largest (i.e. the tallest peak above the baseline) is selected as the optimal operating point, and the Lorentzian center frequency is returned as the qubit frequency.
- class bragi_quantum.experiments.nodes.qubit_control.spectroscopy.analysis.PeakFitResult(lorentzian_fitted_frequency=None, lorentzian_fitted_frequency_stderr=None, significance=0.0, fit_result=None, amplitude=None, raw_maximum=None)[source]#
Bases:
objectBundle the outcome of a single-trace Lorentzian peak fit.
lorentzian_fitted_frequency/lorentzian_fitted_frequency_stderrareNonewhen no peak was accepted;fit_resultis the raw lmfitModelResultkept for slice diagnostics.amplitude/raw_maximumare filled in by the caller for 2-D sweeps, where each slice corresponds to one spectroscopy pulse amplitude.- Parameters:
- class bragi_quantum.experiments.nodes.qubit_control.spectroscopy.analysis.QubitSpectroscopyAnalysis(parameters, qoi_cls=None, **kwargs)[source]#
Bases:
AnalysisFit data from a qubit (two-tone) spectroscopy experiment (unified, plotly).
Iterates over the amplitude sweep axis, applies a significance-threshold peak-finder on each 1-D frequency trace, and picks the amplitude whose trace carries the highest significance as the calibrated operating point. A single class handles both the 0→1 and 1→2 transitions, selected by
parameters.transition. Replaces the formerQubitSpectroscopyQubitAnalysis/QubitSpectroscopy12QubitAnalysis+QubitSpectroscopyNodeAnalysis.- Parameters:
parameters (QubitSpectroscopyParameters)
qoi_cls (type[QubitSpectroscopyBaseQOI] | None)
- parameters: QubitSpectroscopyParameters#
- plot_title()[source]#
Title for this element’s (sub)plot. Override per node if desired.
- Return type:
- qubit_spectroscopy_analysis()[source]#
Executes the peak-finding routine on the dataset populated by the abstract layer. Supports both a 2-D sweep (frequency × amplitude) and a 1-D sweep (frequency only).
- Return type:
None
- compute_qoi()[source]#
Compute the QOI for the current element.
Runs against
self.dataset/self.magnitudes/self.data_var(already set for the current element) and should store whatever stateadd_traces()needs onself.- Return type:
- add_traces(fig, row=1, col=1)[source]#
Add this element’s plotly traces (and axis titles) to
figat (row, col).
Rabi oscillations#
Node implementation for Rabi and N-Rabi oscillation calibration.
- class bragi_quantum.experiments.nodes.qubit_control.rabi_oscillations.node.RabiOscillations(parameters, qoi_cls=<class 'bragi_quantum.experiments.nodes.qubit_control.rabi_oscillations.parameters.Rabi01QOI'>)[source]#
Bases:
ScheduleQubitNodeExecution node for performing Rabi oscillations.
A single node class handles both the 0->1 and 1->2 transitions; the transition is selected by the
transitionfield inRabiParameters.- Parameters:
parameters (RabiParameters)
qoi_cls (type[RabiBaseQOI])
- measurement_cls#
alias of
RabiOscillationsMeasurement
- analysis_cls#
alias of
RabiAnalysis
- parameters: RabiParameters#
- class bragi_quantum.experiments.nodes.qubit_control.rabi_oscillations.node.NRabiOscillations(parameters, qoi_cls=<class 'bragi_quantum.experiments.nodes.qubit_control.rabi_oscillations.parameters.NRabi01QOI'>)[source]#
Bases:
ScheduleQubitNodeExecution node for performing N-Rabi (amplitude-correction) oscillations.
Sweeps a small correction to the current amp180 over several X-pulse repetition counts to amplify the amplitude error. The transition is selected by the
transitionfield inNRabiParameters.- Parameters:
parameters (NRabiParameters)
qoi_cls (type[NRabiBaseQOI])
- measurement_cls#
alias of
NRabiOscillationsMeasurement
- analysis_cls#
alias of
NRabiAnalysis
- parameters: NRabiParameters#
- pydantic model bragi_quantum.experiments.nodes.qubit_control.rabi_oscillations.parameters.RabiParameters[source]#
Bases:
BaseParametersParameters for Rabi oscillation calibration.
The transition field selects the transition:
transition="01"drives 0->1 (the X gate amplitude,rxy.amp180),transition="12"drives 1->2 (r12.ef_amp180).- Fields:
- field scaled_uncertainty_analysis_threshold: float = 0.02#
Maximum scaled fit uncertainty for a successful analysis.
- pydantic model bragi_quantum.experiments.nodes.qubit_control.rabi_oscillations.parameters.NRabiParameters[source]#
Bases:
RabiParametersParameters for N-Rabi (amplitude-correction) calibration.
- Fields:
- field sinusoidal_r2_threshold: float = 0.8#
Minimum per-slice R² for a slice to enter the joint fit.
- pydantic model bragi_quantum.experiments.nodes.qubit_control.rabi_oscillations.parameters.RabiBaseQOI[source]#
Bases:
BaseQoiBase Quantities of Interest for Rabi oscillations.
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
- pydantic model bragi_quantum.experiments.nodes.qubit_control.rabi_oscillations.parameters.Rabi01QOI[source]#
Bases:
RabiBaseQOIQuantities of Interest for Rabi oscillations (0->1 transition).
- Fields:
- to_dict()[source]#
Returns the calculated QOIs as a dictionary. The keys should match the attribute paths in the bragi_quantum.datalayer models (e.g., {‘rxy.amp180’: 0.5}).
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
- pydantic model bragi_quantum.experiments.nodes.qubit_control.rabi_oscillations.parameters.Rabi12QOI[source]#
Bases:
RabiBaseQOIQuantities of Interest for Rabi oscillations (1->2 transition).
- Fields:
- to_dict()[source]#
Returns the calculated QOIs as a dictionary. The keys should match the attribute paths in the bragi_quantum.datalayer models (e.g., {‘rxy.amp180’: 0.5}).
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
- pydantic model bragi_quantum.experiments.nodes.qubit_control.rabi_oscillations.parameters.NRabiBaseQOI[source]#
Bases:
RabiBaseQOIBase Quantities of Interest for N-Rabi oscillations.
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
- pydantic model bragi_quantum.experiments.nodes.qubit_control.rabi_oscillations.parameters.NRabi01QOI[source]#
Bases:
NRabiBaseQOIQuantities of Interest for N-Rabi oscillations (0->1 transition).
- Fields:
- to_dict()[source]#
Returns the calculated QOIs as a dictionary. The keys should match the attribute paths in the bragi_quantum.datalayer models (e.g., {‘rxy.amp180’: 0.5}).
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
- pydantic model bragi_quantum.experiments.nodes.qubit_control.rabi_oscillations.parameters.NRabi12QOI[source]#
Bases:
NRabiBaseQOIQuantities of Interest for N-Rabi oscillations (1->2 transition).
- Fields:
- to_dict()[source]#
Returns the calculated QOIs as a dictionary. The keys should match the attribute paths in the bragi_quantum.datalayer models (e.g., {‘rxy.amp180’: 0.5}).
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
Module containing classes that model, fit and plot data from Rabi and N-Rabi experiments.
RabiQubitAnalysisfits a cosine to a 1-D amplitude sweep and returns the pi-pulse amplitude.NRabiQubitAnalysisfits a joint 2-D cosine model to all repetition slices simultaneously, constraining each slice to frequency r·f₀ with a shared shift (the optimal amplitude correction). The joint fit quality naturally detects failures without per-slice thresholds or combinatorial root selection.
- class bragi_quantum.experiments.nodes.qubit_control.rabi_oscillations.analysis.RabiAnalysis(parameters, qoi_cls=None)[source]#
Bases:
AnalysisFit a cosine to Rabi oscillation data (unified, parameter-driven).
Replaces the former
RabiQubitAnalysis(per-qubit) +RabiNodeAnalysis(node-level) pair. Analyse one qubit withanalyse_element(dataset, "q06")or every qubit inparameters.qubitswithrun(dataset).- Parameters:
parameters (BaseParameters)
- plot_title()[source]#
Title for this element’s (sub)plot. Override per node if desired.
- Return type:
- compute_qoi()[source]#
Compute the QOI for the current element.
Runs against
self.dataset/self.magnitudes/self.data_var(already set for the current element) and should store whatever stateadd_traces()needs onself.- Return type:
- class bragi_quantum.experiments.nodes.qubit_control.rabi_oscillations.analysis.NRabiAnalysis(parameters, qoi_cls=None, **kwargs)[source]#
Bases:
AnalysisAnalysis of N-Rabi oscillation data that determines the optimal microwave amplitude correction for qubit control (unified, plotly).
Fits a joint 2-D model to all repetition slices simultaneously, constraining slice r to frequency r·f₀ with a shared shift parameter. The shift IS the correction — no root enumeration or combinatorial selection needed. Failed experiments (data that does not satisfy the r·f₀ scaling) are detected by the joint fit failing to converge or producing undefined errorbars. Replaces the former
NRabiQubitAnalysis+NRabiNodeAnalysissplit.- Parameters:
parameters (NRabiParameters)
qoi_cls (type[NRabiBaseQOI] | None)
- parameters: NRabiParameters#
- compute_qoi()[source]#
Compute the QOI for the current element.
Runs against
self.dataset/self.magnitudes/self.data_var(already set for the current element) and should store whatever stateadd_traces()needs onself.- Return type:
- plot_title()[source]#
Title for this element’s (sub)plot. Override per node if desired.
- Return type:
Ramsey fringes#
Node implementation for Ramsey-fringes (detuning) calibration.
- class bragi_quantum.experiments.nodes.qubit_control.ramsey_fringes.node.RamseyFringes(parameters, qoi_cls=<class 'bragi_quantum.experiments.nodes.qubit_control.ramsey_fringes.parameters.Ramsey01QOI'>)[source]#
Bases:
ScheduleQubitNodeExecution node for performing Ramsey-fringes (detuning) calibration.
A single node class handles both the 0->1 and 1->2 transitions; the transition is selected by the
transitionfield inRamseyParameters.- Parameters:
parameters (RamseyParameters)
qoi_cls (type[RamseyBaseQOI])
- measurement_cls#
alias of
RamseyDetuningsMeasurement
- analysis_cls#
alias of
RamseyDetuningsAnalysis
- parameters: RamseyParameters#
- pydantic model bragi_quantum.experiments.nodes.qubit_control.ramsey_fringes.parameters.RamseyParameters[source]#
Bases:
BaseParametersParameters for Ramsey-fringes (detuning) calibration.
The transition field selects the transition:
transition="01"corrects f01,transition="12"corrects f12.- Fields:
- field artificial_detunings: list[float] [Optional]#
Artificial detunings applied per Ramsey trace, in Hz.
- field sequence: Literal['x90_x90', 'x90_y90'] = 'x90_x90'#
Ramsey pulse sequence run: ‘x90_x90’ or ‘x90_y90’.
- field analysis_sequence: Literal['x90_x90', 'x90_y90'] | None = None#
Override which fit strategy to use, independent of sequence — e.g. to force the sign-agnostic folded fit on data whose recorded sequence is missing or unknown. Falls back to sequence when unset.
- field min_r_squared_detune_fit: float = 0.85#
Minimum R^2 for a per-detuning Ramsey fit to be accepted.
- field minimum_relative_error_from_fits: float = 0.02#
Floor on the relative error of each fitted detuning.
- field min_r_squared_line_fit: float = 0.9#
Minimum R^2 (coefficient of determination, fitted vs. artificial detuning) accepted for the linear detuning fit. Unlike reduced chi-squared, R^2 doesn’t depend on the per-point error floor, so its scale is fixed regardless of qubit/detuning spread.
- legal_variant_combinations: ClassVar[tuple[ParameterCombination, ...]] = (mappingproxy({'transition': '01', 'sequence': 'x90_x90'}), mappingproxy({'transition': '01', 'sequence': 'x90_y90'}), mappingproxy({'transition': '12', 'sequence': 'x90_x90'}), mappingproxy({'transition': '12', 'sequence': 'x90_y90'}))#
- pydantic model bragi_quantum.experiments.nodes.qubit_control.ramsey_fringes.parameters.RamseyBaseQOI[source]#
Bases:
BaseQoiBase Quantities of Interest for Ramsey fringes.
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
- pydantic model bragi_quantum.experiments.nodes.qubit_control.ramsey_fringes.parameters.Ramsey01QOI[source]#
Bases:
RamseyBaseQOIQuantities of Interest for Ramsey fringes (0->1 transition).
- Fields:
- to_dict()[source]#
Returns the calculated QOIs as a dictionary. The keys should match the attribute paths in the bragi_quantum.datalayer models (e.g., {‘rxy.amp180’: 0.5}).
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
- pydantic model bragi_quantum.experiments.nodes.qubit_control.ramsey_fringes.parameters.Ramsey12QOI[source]#
Bases:
RamseyBaseQOIQuantities of Interest for Ramsey fringes (1->2 transition).
- Fields:
- to_dict()[source]#
Returns the calculated QOIs as a dictionary. The keys should match the attribute paths in the bragi_quantum.datalayer models (e.g., {‘rxy.amp180’: 0.5}).
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
Module containing classes that fit and plot data from a Ramsey-fringes experiment.
For each artificial detuning a damped sinusoid is fitted to the delay trace to extract its Ramsey frequency; a linear fit of fitted-vs-artificial detuning then gives the frequency correction (its zero crossing).
- class bragi_quantum.experiments.nodes.qubit_control.ramsey_fringes.analysis.RamseyDetuningsAnalysis(parameters, qoi_cls=None, **kwargs)[source]#
Bases:
AnalysisExtract the frequency correction for one qubit (unified, plotly).
For each artificial detuning a damped sinusoid is fitted to the delay trace to extract its Ramsey frequency; a linear fit of fitted-vs-artificial detuning then gives the frequency correction (its zero crossing). Replaces the former
RamseyDetuningsQubitAnalysis+RamseyDetuningsNodeAnalysis.- Parameters:
parameters (RamseyParameters)
qoi_cls (type[RamseyBaseQOI] | None)
- parameters: RamseyParameters#
- plot_title()[source]#
Title for this element’s (sub)plot. Override per node if desired.
- Return type:
- compute_qoi()[source]#
Compute the QOI for the current element.
Runs against
self.dataset/self.magnitudes/self.data_var(already set for the current element) and should store whatever stateadd_traces()needs onself.- Return type:
- add_traces(fig, row=1, col=1)[source]#
Add this element’s plotly traces (and axis titles) to
figat (row, col).
Motzoi / DRAG parameter#
Node implementation for Motzoi (DRAG beta) calibration.
- class bragi_quantum.experiments.nodes.qubit_control.motzoi_parameter.node.MotzoiParameter(parameters, qoi_cls=<class 'bragi_quantum.experiments.nodes.qubit_control.motzoi_parameter.parameters.Motzoi01QOI'>)[source]#
Bases:
ScheduleQubitNodeExecution node for performing Motzoi (DRAG beta) calibration.
A single node class handles both the 0->1 and 1->2 transitions; the transition is selected by the
transitionfield inMotzoiParameters.- Parameters:
parameters (MotzoiParameters)
qoi_cls (type[MotzoiBaseQOI])
- measurement_cls#
alias of
MotzoiMeasurement
- analysis_cls#
alias of
MotzoiAnalysis
- parameters: MotzoiParameters#
- pydantic model bragi_quantum.experiments.nodes.qubit_control.motzoi_parameter.parameters.MotzoiParameters[source]#
Bases:
BaseParametersParameters for Motzoi (DRAG beta) calibration.
The transition field selects which DRAG coefficient is calibrated:
transition="01"correctsrxy.beta,transition="12"r12.ef_beta.- Fields:
- pydantic model bragi_quantum.experiments.nodes.qubit_control.motzoi_parameter.parameters.MotzoiBaseQOI[source]#
Bases:
BaseQoiBase Quantities of Interest for Motzoi.
- Fields:
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
- pydantic model bragi_quantum.experiments.nodes.qubit_control.motzoi_parameter.parameters.Motzoi01QOI[source]#
Bases:
MotzoiBaseQOIQuantities of Interest for Motzoi (0->1 transition).
- Fields:
- to_dict()[source]#
Returns the calculated QOIs as a dictionary. The keys should match the attribute paths in the bragi_quantum.datalayer models (e.g., {‘rxy.amp180’: 0.5}).
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
- pydantic model bragi_quantum.experiments.nodes.qubit_control.motzoi_parameter.parameters.Motzoi12QOI[source]#
Bases:
MotzoiBaseQOIQuantities of Interest for Motzoi (1->2 transition).
- Fields:
- to_dict()[source]#
Returns the calculated QOIs as a dictionary. The keys should match the attribute paths in the bragi_quantum.datalayer models (e.g., {‘rxy.amp180’: 0.5}).
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
Module containing classes that fit and plot data from a Motzoi (DRAG beta) calibration experiment.
For each motzoi value two complementary circuits are measured (X.Y90 and Y.X90). The readout magnitude of each circuit varies ~linearly with the motzoi parameter; the optimal beta is the intersection of the two fitted lines.
- class bragi_quantum.experiments.nodes.qubit_control.motzoi_parameter.analysis.MotzoiAnalysis(parameters, qoi_cls=None, **kwargs)[source]#
Bases:
AnalysisExtract the optimal motzoi (DRAG beta) for a qubit (unified, plotly).
Two complementary circuits (X.Y90, Y.X90) each vary ~linearly with the motzoi parameter; the optimal beta is the intersection of the two fitted lines. Replaces the former
MotzoiQubitAnalysis+MotzoiNodeAnalysis.- Parameters:
parameters (MotzoiParameters)
qoi_cls (type[MotzoiBaseQOI] | None)
- parameters: MotzoiParameters#
- plot_title()[source]#
Title for this element’s (sub)plot. Override per node if desired.
- Return type:
- compute_qoi()[source]#
Compute the QOI for the current element.
Runs against
self.dataset/self.magnitudes/self.data_var(already set for the current element) and should store whatever stateadd_traces()needs onself.- Return type:
Coupler nodes#
Shared by several of the nodes below: the coupler’s CZ transition frequency
(the detuning between the \(|11\rangle\) state and the targeted \(|20\rangle\)/\(|02\rangle\) state),
preferring a value saved to Redis by
cz_currents_from_spectroscopies and otherwise
computed from the qubits’ calibrated clock frequencies.
Shared CZ transition frequency logic for cz_parametrization and cz_chevron.
The CZ transition frequency (Hz) is the detuning between the \(|11\rangle\) state and
the targeted \(|20\rangle\) / \(|02\rangle\) state, computed from the qubits’ calibrated 01/12
clock frequencies. cz_currents_from_spectroscopies computes and stores this
value on the coupler’s Redis hash (fields cz_transition_frequency_20 /
cz_transition_frequency_02); consumers should prefer that stored value
and only fall back to recomputing it live from the device when Redis has
nothing stored yet (e.g. cz_currents_from_spectroscopies has never run for
that coupler).
- bragi_quantum.experiments.nodes.coupler.cz_transition_frequency.compute_transition_frequency(device, coupler, cz_transition)[source]#
Raw (unrounded) CZ transition frequency (Hz) for
coupler, computed from the qubits’ current clock frequencies ondevice.
- bragi_quantum.experiments.nodes.coupler.cz_transition_frequency.get_cz_transition_frequency(device, redis_connection, coupler, cz_transition, cz_half_frequency_wp=False)[source]#
CZ transition frequency (Hz) for
coupler, preferring the value last saved to Redis by cz_currents_from_spectroscopies and falling back to computing it live from the device’s clock frequencies if Redis has nothing stored forcz_transition.
Resonator spectroscopy vs. current#
Node implementation for Resonator Spectroscopy vs coupler DC current.
Ported from tergite-autocalibration (ResonatorSpectroscopyVsCurrentNode).
- class bragi_quantum.experiments.nodes.coupler.resonator_spectroscopy_vs_current.node.ResonatorSpectroscopyVsCurrent(parameters, qoi_cls=<class 'bragi_quantum.experiments.nodes.coupler.resonator_spectroscopy_vs_current.parameters.ResonatorSpectroscopyVsCurrentQOI'>)[source]#
Bases:
ExternalParameterFixedScheduleCouplerNodeResonator spectroscopy on both qubits of each coupler while sweeping the coupler’s DC bias current via the SPI rack.
The resonator schedule is compiled once; for every current in the external samplespace the coupler DACs are ramped and the schedule is re-executed. The analysis tracks the fitted resonator frequency versus current and reports the currents at which the coupler crosses the resonator.
- Parameters:
parameters (ResonatorSpectroscopyVsCurrentParameters)
qoi_cls (type[ResonatorSpectroscopyVsCurrentQOI])
- measurement_cls#
alias of
ResonatorSpectroscopyMeasurement
- analysis_cls#
- parameters: ResonatorSpectroscopyVsCurrentParameters#
- property transmons: dict[str, ExtendedTransmon]#
The coupled qubits’ transmons; measured (and read out) by this node.
- pydantic model bragi_quantum.experiments.nodes.coupler.resonator_spectroscopy_vs_current.parameters.ResonatorSpectroscopyVsCurrentParameters[source]#
Bases:
ResonatorSpectroscopyParametersParameters for Resonator Spectroscopy vs coupler DC current.
Extends the plain resonator spectroscopy parameters with the external DC-current sweep applied to each coupler and the thresholds used by the crossing-current detection. Ported from tergite-autocalibration (ResonatorSpectroscopyVsCurrentNode).
- Fields:
- field crossing_threshold: float = 30000.0#
Minimum resonator frequency jump (Hz) between consecutive detected points to count as a coupler crossing.
- field spurious_threshold: float = 4000.0#
Maximum frequency difference (Hz) between the neighbours of a missing point for it to be filled in as a spurious gap.
- pydantic model bragi_quantum.experiments.nodes.coupler.resonator_spectroscopy_vs_current.parameters.ResonatorSpectroscopyVsCurrentQOI[source]#
Bases:
BaseQoiQuantities of Interest for Resonator Spectroscopy vs current on one coupler.
Holds, for each of the coupler’s two qubits, the list of DC currents at which the coupler crosses the readout resonator.
- field crossing_currents: dict[str, list[float]] [Optional]#
Mapping from qubit name to the detected resonator crossing currents in Amps.
- items()[source]#
Iterate like a mapping so bragi_quantum.datalayer’s
update_redis_trusted_valuescan inspect the QOI keys when routing coupler results.
- to_dict()[source]#
Returns the calculated QOIs as a dictionary. The keys should match the attribute paths in the bragi_quantum.datalayer models (e.g., {‘rxy.amp180’: 0.5}).
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
Analysis for resonator spectroscopy as a function of coupler DC current.
Ported from tergite-autocalibration (lib/nodes/coupler/spectroscopy/analysis.py). Each coupler dataset holds a resonator spectroscopy per DC-current point for both of the coupler’s qubits; every spectroscopy is fitted individually and the fitted resonator frequency is tracked versus current. A sudden jump in the tracked frequency (or a gap where the fit fails) marks a current at which the coupler crosses the resonator — the “crossing currents” reported as this node’s QOI.
The dataset’s data variables are named after each qubit (e.g. q06,
q07), not after the coupler (q06_q07) — so unlike a plain qubit/coupler
analysis, an element (“q06_q07”) cannot be sliced out with the generic
slice_element helper. ResonatorSpectroscopyVsCurrentAnalysis overrides
analyse_element/_process to group the coupler’s two qubit variables
directly, mirroring the former _group_by_coupler.
- class bragi_quantum.experiments.nodes.coupler.resonator_spectroscopy_vs_current.analysis.ResonatorSpectroscopyVsCurrentAnalysis(parameters, qoi_cls=None, **kwargs)[source]#
Bases:
AnalysisRuns the frequency-vs-current analysis for both qubits of one coupler and packages their crossing currents into a single QOI (unified, plotly).
Replaces the former
ResonatorSpectroscopyVsCurrentQubitAnalysis+ResonatorSpectroscopyVsCurrentCouplerAnalysis+ResonatorSpectroscopyVsCurrentNodeAnalysis.- Parameters:
parameters (ResonatorSpectroscopyVsCurrentParameters)
qoi_cls (type[ResonatorSpectroscopyVsCurrentQOI] | None)
- parameters: ResonatorSpectroscopyVsCurrentParameters#
- plot_title()[source]#
Title for this element’s (sub)plot. Override per node if desired.
- Return type:
- analyse_element(dataset, element)[source]#
Slice
elementfromdataset(Dataset or path) and fit it here.
- compute_qoi()[source]#
Compute the QOI for the current element.
Runs against
self.dataset/self.magnitudes/self.data_var(already set for the current element) and should store whatever stateadd_traces()needs onself.- Return type:
- add_traces(fig, row=1, col=1)[source]#
Both qubits’ tracked frequency-vs-current traces overlaid (main plot). The raw |S21| heatmaps and per-current fit grids move to support_figures().
The two qubits’ absolute resonator frequencies typically differ by tens/hundreds of MHz, which would swamp a shared y-axis and hide the (kHz-scale) jumps this plot exists to show — so each trace is centred on its own median frequency (failed-fit zeros excluded) and plotted in kHz deviation instead of absolute Hz.
Qubit spectroscopy vs. current#
Node implementation for Qubit Spectroscopy vs coupler DC current.
Ported from tergite-autocalibration (QubitSpectroscopyVsCurrentNode).
- class bragi_quantum.experiments.nodes.coupler.qubit_spectroscopy_vs_current.node.QubitSpectroscopyVsCurrent(parameters, qoi_cls=<class 'bragi_quantum.experiments.nodes.coupler.qubit_spectroscopy_vs_current.parameters.QubitSpectroscopyVsCurrentQOI'>)[source]#
Bases:
ExternalParameterFixedScheduleCouplerNodeQubit (two-tone) spectroscopy on both qubits of each coupler while sweeping the coupler’s DC bias current via the SPI rack.
The spectroscopy schedule is compiled once; for every current in the external samplespace the coupler DACs are ramped and the schedule is re-executed. The analysis tracks the fitted qubit frequency versus current and reports the currents at which the coupler crosses the qubit, vetoing candidates near the resonator crossings found by resonator_spectroscopy_vs_current.
- Parameters:
parameters (QubitSpectroscopyVsCurrentParameters)
qoi_cls (type[QubitSpectroscopyVsCurrentQOI])
- measurement_cls#
alias of
TwoTonesMultidimMeasurement
- analysis_cls#
alias of
QubitSpectroscopyVsCurrentAnalysis
- parameters: QubitSpectroscopyVsCurrentParameters#
- property transmons: dict[str, ExtendedTransmon]#
The coupled qubits’ transmons; measured (and read out) by this node.
- pydantic model bragi_quantum.experiments.nodes.coupler.qubit_spectroscopy_vs_current.parameters.QubitSpectroscopyVsCurrentParameters[source]#
Bases:
QubitSpectroscopyParametersParameters for Qubit Spectroscopy vs coupler DC current.
Extends the plain qubit (two-tone) spectroscopy parameters with the external DC-current sweep applied to each coupler and the thresholds used by the crossing-current detection.
- Fields:
- field crossing_threshold: float = 2000000.0#
Minimum qubit frequency jump (Hz) between consecutive detected points to count as a coupler crossing.
- field spurious_threshold: float = 300000.0#
Maximum frequency difference (Hz) between the neighbours of a missing point for it to be filled in as a spurious gap.
- field min_crossing_interval: float = 0.0003#
Minimum current span (A) a group of jumps must cover before it is collapsed into a single crossing current.
- field resonator_crossing_interval: float = 0.00015#
Candidate crossings within this current distance (A) of a known resonator crossing (from resonator_spectroscopy_vs_current) are discarded as resonator artefacts.
- field max_fit_workers: int | None = None#
Worker processes for the per-current-slice fits. None auto-sizes to os.cpu_count().
- pydantic model bragi_quantum.experiments.nodes.coupler.qubit_spectroscopy_vs_current.parameters.QubitSpectroscopyVsCurrentQOI[source]#
Bases:
BaseQoiQuantities of Interest for Qubit Spectroscopy vs current on one coupler.
Holds, for each of the coupler’s two qubits, the list of DC currents at which the coupler crosses the qubit.
- field crossing_currents: dict[str, list[float]] [Optional]#
Mapping from qubit name to the detected qubit crossing currents in Amps.
- items()[source]#
Iterate like a mapping so bragi_quantum.datalayer’s
update_redis_trusted_valuescan inspect the QOI keys when routing coupler results.
- to_dict()[source]#
Returns the calculated QOIs as a dictionary. The keys should match the attribute paths in the bragi_quantum.datalayer models (e.g., {‘rxy.amp180’: 0.5}).
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
Analysis for qubit (two-tone) spectroscopy as a function of coupler DC current.
Ported from tergite-autocalibration (lib/nodes/coupler/spectroscopy/analysis.py). Each coupler dataset holds a qubit spectroscopy per DC-current point for both of the coupler’s qubits; every spectroscopy is fitted individually and the fitted qubit frequency is tracked versus current. A sudden jump in the tracked frequency (or a gap where the fit fails) marks a current at which the coupler crosses the qubit — the “crossing currents” reported as this node’s QOI. Candidates too close to a resonator crossing (stored in Redis by resonator_spectroscopy_vs_current) are discarded as readout artefacts.
Like resonator_spectroscopy_vs_current, the dataset’s data variables are
named after each qubit, not the coupler — so QubitSpectroscopyVsCurrentAnalysis
overrides analyse_element/_process to group the coupler’s two qubit
variables directly rather than relying on the generic slice_element.
- class bragi_quantum.experiments.nodes.coupler.qubit_spectroscopy_vs_current.analysis.QubitSpectroscopyVsCurrentAnalysis(parameters, qoi_cls=None, **kwargs)[source]#
Bases:
AnalysisRuns the frequency-vs-current analysis for both qubits of one coupler and packages their crossing currents into a single QOI (unified, plotly).
Replaces the former
QubitSpectroscopyVsCurrentQubitAnalysis+QubitSpectroscopyVsCurrentCouplerAnalysis+QubitSpectroscopyVsCurrentNodeAnalysis.- Parameters:
parameters (QubitSpectroscopyVsCurrentParameters)
qoi_cls (type[QubitSpectroscopyVsCurrentQOI] | None)
- parameters: QubitSpectroscopyVsCurrentParameters#
- plot_title()[source]#
Title for this element’s (sub)plot. Override per node if desired.
- Return type:
- analyse_element(dataset, element)[source]#
Slice
elementfromdataset(Dataset or path) and fit it here.
- compute_qoi()[source]#
Compute the QOI for the current element.
Runs against
self.dataset/self.magnitudes/self.data_var(already set for the current element) and should store whatever stateadd_traces()needs onself.- Return type:
- add_traces(fig, row=1, col=1)[source]#
Both qubits’ tracked frequency-vs-current traces overlaid (main plot). The per-current fit grids move to support_figures().
As with resonator_spectroscopy_vs_current, the two qubits’ absolute frequencies typically differ by tens/hundreds of MHz, which would swamp a shared y-axis — so each trace is centred on its own median frequency (failed-fit zeros excluded) and plotted in kHz deviation.
CZ currents from spectroscopies#
Node implementation for deriving CZ working-point currents from spectroscopies.
Ported from tergite-autocalibration (CZCurrentsFromSpectroscopiesNode).
- class bragi_quantum.experiments.nodes.coupler.cz_currents_from_spectroscopies.node.CZCurrentsFromSpectroscopies(parameters, qoi_cls=<class 'bragi_quantum.experiments.nodes.coupler.cz_currents_from_spectroscopies.parameters.CZCurrentsFromSpectroscopiesQOI'>)[source]#
Bases:
CouplerNodeAnalysis-only node evaluating the candidate currents at which the coupler can be operated to perform a CZ gate.
No measurement is performed: the analysis fits the tunable-coupler frequency model to the qubit and resonator crossing currents stored in Redis by qubit_spectroscopy_vs_current and resonator_spectroscopy_vs_current (combined with the qubits’ clock frequencies from the session device), and solves the fit for the CZ avoided-crossing currents.
- Parameters:
parameters (CZCurrentsFromSpectroscopiesParameters)
qoi_cls (type[CZCurrentsFromSpectroscopiesQOI])
- measurement_cls: BaseMeasurement = None#
- analysis_cls#
alias of
CZCurrentsFromSpectroscopiesAnalysis
- parameters: CZCurrentsFromSpectroscopiesParameters#
- pydantic model bragi_quantum.experiments.nodes.coupler.cz_currents_from_spectroscopies.parameters.CZCurrentsFromSpectroscopiesParameters[source]#
Bases:
BaseParametersParameters for CZCurrentsFromSpectroscopies.
Analysis-only node: no measurement is performed. The coupler-frequency model is fitted to the crossing points stored in Redis by qubit_spectroscopy_vs_current and resonator_spectroscopy_vs_current, and candidate CZ working-point currents are computed from the fit. Ported from tergite-autocalibration (CZCurrentsFromSpectroscopiesNode).
- Fields:
- field calculate_wp: bool = True#
Compute candidate CZ working-point currents from the fitted coupler frequency (otherwise only the fit results are stored).
- field max_cz_frequency_in_GHz: float = 1.0#
CZ modulation frequencies above this are outside the electronics range; working points are not calculated for them.
- pydantic model bragi_quantum.experiments.nodes.coupler.cz_currents_from_spectroscopies.parameters.CZCurrentsFromSpectroscopiesQOI[source]#
Bases:
BaseQoiQuantities of Interest for CZCurrentsFromSpectroscopies on one coupler: the fitted coupler-frequency model parameters and the candidate CZ working-point currents for the 20 and 02 avoided crossings.
- Fields:
- items()[source]#
Iterate like a mapping so bragi_quantum.datalayer’s
update_redis_trusted_valuescan inspect the QOI keys when routing coupler results.
- to_dict()[source]#
Returns the calculated QOIs as a dictionary. The keys should match the attribute paths in the bragi_quantum.datalayer models (e.g., {‘rxy.amp180’: 0.5}).
- Return type:
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
Analysis for deriving candidate CZ working-point currents from spectroscopies.
Ported from tergite-autocalibration (lib/nodes/coupler/cz_currents_from_spectroscopies/analysis.py). This node has no measurement of its own: the qubit and resonator crossing currents stored in Redis by qubit_spectroscopy_vs_current and resonator_spectroscopy_vs_current are combined with the qubits’ clock frequencies (from the session device) into (frequency, current) points, a tunable-coupler frequency model is fitted through them, and the currents at which the coupler frequency matches the CZ avoided-crossing frequencies (20 and 02) are solved from the fit.
- bragi_quantum.experiments.nodes.coupler.cz_currents_from_spectroscopies.analysis.coupler_freq(x, bare_coupler_frequency, amplitude, offset, minimum_coupler_frequency)[source]#
Model function for the frequency of a tunable coupler.
Models the coupler frequency as a function of the DC current applied to the coupler, using a cosine function to represent the modulation of the frequency by the current.
- Parameters:
x (float) – The current applied to the coupler, in mA.
bare_coupler_frequency (float) – The bare frequency of the coupler, in GHz.
amplitude (float) – Amplitude of the modulation.
offset (float) – Phase shift of the modulation, in mA.
minimum_coupler_frequency (float) – This parameter is used to improve fitting stability. Users should check its value as it is supposed to be small.
- Returns:
The frequency of the coupler at the given current, in GHz.
- Return type:
- class bragi_quantum.experiments.nodes.coupler.cz_currents_from_spectroscopies.analysis.CZCurrentsFromSpectroscopiesAnalysis(parameters, qoi_cls=None, **kwargs)[source]#
Bases:
AnalysisDerive candidate CZ working-point currents for every coupler (unified).
This is an analysis-only node: there is no measured dataset. For each coupler it reads the qubit/resonator crossing currents from Redis and the qubits’ clock frequencies from the session device, fits the tunable-coupler frequency model, and solves for the CZ avoided-crossing currents. Replaces the former
CZCurrentsFromSpectroscopiesCouplerAnalysis/...NodeAnalysissplit.- Parameters:
parameters (CZCurrentsFromSpectroscopiesParameters)
- parameters: CZCurrentsFromSpectroscopiesParameters#
- run(dataset=None)[source]#
Analyse every coupler in
parameters.couplers.Analysis-only: the
datasetargument is accepted (the pipeline passes the node’s would-be HDF5 path) but ignored — inputs come from Redis and the session device.
- plot_title()[source]#
Title for this element’s (sub)plot. Override per node if desired.
- Return type:
- initial_guess(qubit_currents)[source]#
Estimate the current offset of the coupler modulation as the midpoint of the widest gap between consecutive qubit crossing currents.
- compute_qoi()[source]#
Compute the QOI for the current element.
Runs against
self.dataset/self.magnitudes/self.data_var(already set for the current element) and should store whatever stateadd_traces()needs onself.- Return type:
CZ parametrization (fixed duration)#
Node implementation for CZ parametrization with a fixed pulse duration.
Ported from tergite-autocalibration (CZParametrizationFixDurationNode).
- class bragi_quantum.experiments.nodes.coupler.cz_parametrization.node.CZParametrizationFixDuration(parameters, qoi_cls=<class 'bragi_quantum.experiments.nodes.coupler.cz_parametrization.parameters.CZParametrizationFixDurationQOI'>)[source]#
Bases:
ScheduleCouplerNodeTests a candidate CZ working-point current by sweeping the coupler’s flux pulse frequency and amplitude (duration held fixed).
Both qubits of a coupler are excited to |1> and the coupler flux pulse is applied at every (frequency, amplitude) point; the analysis looks for the point where population exchanges into the targeted |20> or |02> state (
parameters.cz_transition), consistently between both qubits — i.e. whether a usable CZ avoided crossing exists at this current.- Parameters:
parameters (CZParametrizationFixDurationParameters)
qoi_cls (type[CZParametrizationFixDurationQOI])
- measurement_cls#
alias of
CZParametrizationFixDurationMeasurement
- analysis_cls#
alias of
CZParametrizationFixDurationAnalysis
- parameters: CZParametrizationFixDurationParameters#
- property transmons: dict[str, ExtendedTransmon]#
The coupled qubits’ transmons; measured (and read out) by this node.
- pydantic model bragi_quantum.experiments.nodes.coupler.cz_parametrization.parameters.CZParametrizationFixDurationParameters[source]#
Bases:
BaseParametersParameters for CZ parametrization with a fixed pulse duration.
Tests a candidate CZ working-point current by sweeping the coupler’s flux pulse frequency and amplitude (duration held fixed) to find whether a usable |11>-|20> (or |11>-|02>) avoided crossing exists there. Ported from tergite-autocalibration (CZParametrizationFixDurationNode).
- Fields:
- field amplitude_min: float = 0.0#
Start of the amplitude sweep (fullscale).
- Constraints:
ge = -1
le = 1
- field amplitude_max: float = 0.5#
End of the amplitude sweep (fullscale); capped at 0.70 to stay under the AWG gain limit.
- Constraints:
ge = -1
le = 1
- field cz_half_frequency_wp: bool = False#
Center the frequency sweep at half the computed CZ transition frequency, for couplers operated at a half-frequency working point.
- pydantic model bragi_quantum.experiments.nodes.coupler.cz_parametrization.parameters.CZParametrizationFixDurationQOI[source]#
Bases:
BaseQoiQuantities of Interest for CZ parametrization on one coupler: the (frequency, amplitude) working point found, and a quality score for ranking candidate parking currents against each other.
- Fields:
- items()[source]#
Iterate like a mapping so bragi_quantum.datalayer’s
update_redis_trusted_valuescan inspect the QOI keys when routing coupler results.
- to_dict()[source]#
Returns the calculated QOIs as a dictionary. The keys should match the attribute paths in the bragi_quantum.datalayer models (e.g., {‘rxy.amp180’: 0.5}).
- Return type:
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
Analysis for CZ parametrization with a fixed pulse duration.
Ported from tergite-autocalibration (lib/nodes/coupler/cz_parametrization/analysis.py). Each coupler dataset holds a 2-D (frequency, amplitude) CZ-pulse scan per qubit of the coupler; the qubit driven towards |2> is expected to show a magnitude maximum and the qubit driven towards |0> a magnitude minimum at the same (frequency, amplitude) point if a real CZ avoided crossing exists there.
Like qubit_spectroscopy_vs_current, the dataset’s data variables are
named after each qubit, not the coupler — so
CZParametrizationFixDurationAnalysis overrides analyse_element/
_process to group the coupler’s two qubit variables directly rather than
relying on the generic slice_element.
- bragi_quantum.experiments.nodes.coupler.cz_parametrization.analysis.spatial_coherence_zscore(magnitude_map, n_shuffle=200, seed=0)[source]#
Quantifies how spatially coherent a 2D magnitude map is, i.e. whether it contains a smooth blob/chevron rather than uncorrelated noise.
A real feature varies smoothly between neighboring sweep points, so its total variation (mean absolute difference between adjacent pixels) is much lower than that of the same pixel values randomly shuffled, which destroys any spatial structure. Pure noise has no structure to destroy, so shuffling barely changes the total variation and the z-score stays near zero. The z-score is how many standard deviations below the shuffled-null mean the real total variation sits.
- class bragi_quantum.experiments.nodes.coupler.cz_parametrization.analysis.CombinedFrequencyVsAmplitudeAnalysis(result_to2, result_to0, max_diff_point, to2_raw_magnitudes=None, to0_raw_magnitudes=None)[source]#
Bases:
objectCombines the results of a coupler’s two qubit analyses in a CZ parametrization experiment. Finds the point of maximum q_to2-q_to0 magnitude difference and checks that it agrees with either the q_to2 max point or the q_to0 min point within tolerance, and that both qubits’ magnitude maps show spatially coherent structure rather than just noise. If either check fails, the analysis fails.
- Parameters:
- are_two_qubits_compatible()[source]#
Check if the maximum-difference point is near either the q_to2 max or the q_to0 min point, and that both qubits’ magnitude maps show real spatial structure.
- Return type:
- best_parameters()[source]#
The point of maximum q_to2-q_to0 magnitude difference (the working point).
- Return type:
- transition_quality()[source]#
A score for ranking how good this transition region is across multiple candidate datasets (e.g. different parking currents): the weaker of the two qubits’ spatial-coherence z-scores, mirroring the AND-gate used by
_has_significant_structure. Higher is a cleaner, more chevron-like map.- Return type:
- class bragi_quantum.experiments.nodes.coupler.cz_parametrization.analysis.CZParametrizationFixDurationAnalysis(parameters, qoi_cls=None, **kwargs)[source]#
Bases:
AnalysisRuns the frequency-vs-amplitude CZ parametrization analysis for both qubits of one coupler and packages the working point into a single QOI.
- Parameters:
parameters (CZParametrizationFixDurationParameters)
- parameters: CZParametrizationFixDurationParameters#
- plot_title()[source]#
Title for this element’s (sub)plot. Override per node if desired.
- Return type:
- analyse_element(dataset, element)[source]#
Slice
elementfromdataset(Dataset or path) and fit it here.
- compute_qoi()[source]#
Compute the QOI for the current element.
Runs against
self.dataset/self.magnitudes/self.data_var(already set for the current element) and should store whatever stateadd_traces()needs onself.- Return type:
CZ wall finder#
Node implementation for the CZ wall finder.
Ported from tergite-autocalibration (CZWallFinder).
- class bragi_quantum.experiments.nodes.coupler.cz_wall_finder.node.CZWallFinder(parameters, qoi_cls=<class 'bragi_quantum.experiments.nodes.coupler.cz_wall_finder.parameters.CZWallFinderQOI'>)[source]#
Bases:
ScheduleCouplerNodeSweeps the coupler’s CZ flux pulse amplitude at a single fixed frequency (its CZ transition frequency) to find, per qubit, the amplitude beyond which the magnitude response departs from its baseline – a “wall” past which driving the coupler further is unsafe or uncontrolled. Reuses CZParametrizationFixDuration’s measurement (fixed duration, swept frequency/amplitude), collapsed here to a single frequency point.
- Parameters:
parameters (CZWallFinderParameters)
qoi_cls (type[CZWallFinderQOI])
- measurement_cls#
alias of
CZParametrizationFixDurationMeasurement
- analysis_cls#
alias of
CZWallFinderAnalysis
- parameters: CZWallFinderParameters#
- property transmons: dict[str, ExtendedTransmon]#
The coupled qubits’ transmons; measured (and read out) by this node.
- pydantic model bragi_quantum.experiments.nodes.coupler.cz_wall_finder.parameters.CZWallFinderParameters[source]#
Bases:
CZParametrizationFixDurationParametersParameters for the CZ wall finder.
Sweeps the coupler’s CZ flux pulse amplitude at a single fixed frequency (the coupler’s CZ transition frequency) to find, per qubit, the amplitude beyond which the magnitude response departs from its baseline – a “wall” past which driving the coupler further is unsafe or uncontrolled. Ported from tergite-autocalibration (CZWallFinder).
Reuses CZParametrizationFixDuration’s fields (
cz_pulse_duration,cz_transition,max_transition_frequency, …) and its measurement;frequency_sweep/frequency_binsare inherited but unused here – the frequency sweep always collapses to the single point at the coupler’s CZ transition frequency.
- pydantic model bragi_quantum.experiments.nodes.coupler.cz_wall_finder.parameters.CZWallFinderQOI[source]#
Bases:
BaseQoiQuantities of Interest for the CZ wall finder on one coupler: the wall amplitude, the more conservative (lower) of its two qubits’ wall amplitudes. Informational only – there is no device field to update, so
to_redis_dictuses a plain (non-submodule:field) key.- Fields:
- items()[source]#
Iterate like a mapping so bragi_quantum.datalayer’s
update_redis_trusted_valuescan inspect the QOI keys when routing coupler results.
- to_dict()[source]#
Returns the calculated QOIs as a dictionary. The keys should match the attribute paths in the bragi_quantum.datalayer models (e.g., {‘rxy.amp180’: 0.5}).
- Return type:
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
Analysis for the CZ wall finder.
Ported from tergite-autocalibration (lib/nodes/coupler/cz_wall_finder/analysis.py). Each coupler dataset holds a single-frequency amplitude sweep per qubit (reusing CZParametrizationFixDuration’s measurement, collapsed to one frequency point); the “wall” is the amplitude at which a qubit’s magnitude response first drops below its own sweep mean, scanned from the highest amplitude down. The coupler’s wall amplitude is the more conservative (lower) of its two qubits’.
Like cz_parametrization, the dataset’s data variables are named after each
qubit, not the coupler, so CZWallFinderAnalysis overrides
analyse_element/_process to group the coupler’s two qubit variables
directly rather than relying on the generic slice_element.
- bragi_quantum.experiments.nodes.coupler.cz_wall_finder.analysis.find_wall_amplitude(amplitudes, magnitudes)[source]#
The amplitude at which
magnitudesfirst drops below its own sweep mean, scanning from the highest amplitude down – the onset of the “wall”.A wall is only searched for if the sweep shows a clear rise from its first two points to its last three (more than 3 standard deviations of the first two points’ spread); flat/noisy sweeps report
NO_WALL_FOUND.
- class bragi_quantum.experiments.nodes.coupler.cz_wall_finder.analysis.CZWallFinderAnalysis(parameters, qoi_cls=None, **kwargs)[source]#
Bases:
AnalysisFinds each coupler’s CZ wall amplitude – the lower of its two qubits’ wall amplitudes – from a single-frequency amplitude sweep.
- Parameters:
parameters (CZWallFinderParameters)
- parameters: CZWallFinderParameters#
- plot_title()[source]#
Title for this element’s (sub)plot. Override per node if desired.
- Return type:
- analyse_element(dataset, element)[source]#
Slice
elementfromdataset(Dataset or path) and fit it here.
- compute_qoi()[source]#
Compute the QOI for the current element.
Runs against
self.dataset/self.magnitudes/self.data_var(already set for the current element) and should store whatever stateadd_traces()needs onself.- Return type:
CZ chevron#
Node implementation for the CZ chevron (fixed pulse amplitude).
Ported from tergite-autocalibration (CZChevronNode).
- class bragi_quantum.experiments.nodes.coupler.cz_chevron.node.CZChevron(parameters, qoi_cls=<class 'bragi_quantum.experiments.nodes.coupler.cz_chevron.parameters.CZChevronQOI'>)[source]#
Bases:
ScheduleCouplerNodeTests a candidate CZ working-point current by sweeping the coupler’s flux pulse frequency and duration (amplitude held fixed).
Both qubits of a coupler are excited to |1> and the coupler flux pulse is applied at every (frequency, duration) point; the analysis looks for the point where population exchanges into the targeted |20> or |02> state (
parameters.cz_transition), consistently between both qubits — i.e. whether a usable CZ avoided crossing exists at this current — and refines the CZ pulse duration from the resulting oscillation period.- Parameters:
parameters (CZChevronParameters)
qoi_cls (type[CZChevronQOI])
- measurement_cls#
alias of
CZChevronMeasurement
- analysis_cls#
alias of
CZChevronAnalysis
- parameters: CZChevronParameters#
- property transmons: dict[str, ExtendedTransmon]#
The coupled qubits’ transmons; measured (and read out) by this node.
- pydantic model bragi_quantum.experiments.nodes.coupler.cz_chevron.parameters.CZChevronParameters[source]#
Bases:
BaseParametersParameters for the CZ chevron: sweeping the coupler’s flux pulse frequency and duration (amplitude held fixed) to find whether a usable |11>-|20> (or |11>-|02>) avoided crossing exists at a candidate current, and to refine the CZ pulse duration itself. Ported from tergite-autocalibration (CZChevronNode).
- Fields:
- field cz_pulse_amplitude: float = 0.5#
Amplitude of the CZ flux pulse (fullscale).
- Constraints:
ge = -1
le = 1
- field cz_half_frequency_wp: bool = False#
Center the frequency sweep at half the computed CZ transition frequency, for couplers operated at a half-frequency working point.
- field max_transition_frequency: float = 1000000000.0#
Couplers whose computed transition frequency exceeds this (Hz) are skipped entirely.
- pydantic model bragi_quantum.experiments.nodes.coupler.cz_chevron.parameters.CZChevronQOI[source]#
Bases:
BaseQoiQuantities of Interest for the CZ chevron on one coupler: the (frequency, duration) working point found, plus diagnostics on how many of the neighboring support-trace fits resolved a genuine oscillation.
- Fields:
- items()[source]#
Iterate like a mapping so bragi_quantum.datalayer’s
update_redis_trusted_valuescan inspect the QOI keys when routing coupler results.
- to_dict()[source]#
Returns the calculated QOIs as a dictionary. The keys should match the attribute paths in the bragi_quantum.datalayer models (e.g., {‘rxy.amp180’: 0.5}).
- Return type:
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
Analysis for the CZ chevron: sweeping the frequency and duration of a coupler’s flux pulse (amplitude held fixed), to find the CZ working point.
Ported from tergite-autocalibration
(lib/nodes/coupler/cz_chevron/analysis.py), structured like the sibling
cz_parametrization node (frequency vs. amplitude): each coupler dataset
holds a 2-D (frequency, duration) CZ-pulse scan per qubit, the qubit driven
towards |2> is expected to show a magnitude maximum and the qubit driven
towards |0> a magnitude minimum at the same (frequency, duration) point if a
real CZ avoided crossing exists there.
Unlike cz_parametrization, the duration sweep is dense enough to resolve
a population oscillation, so the chosen duration is refined further: a
damped-sinusoid (Ramsey) model is fitted to the duration trace at the chosen
frequency for both qubits and their fitted periods are averaged. The same
fit is repeated at the 8 neighboring frequencies (9 total) to gauge how
reliably the oscillation resolves around the chosen point; if too many of
those fits fail, the working point is discarded even when the coarser
two-qubit-compatibility check passed.
Like cz_parametrization, the dataset’s data variables are named after
each qubit, not the coupler — so CZChevronAnalysis overrides
analyse_element/_process to group the coupler’s two qubit variables
directly rather than relying on the generic slice_element.
- class bragi_quantum.experiments.nodes.coupler.cz_chevron.analysis.CombinedFrequencyVsDurationAnalysis(result_to2, result_to0, max_diff_point)[source]#
Bases:
objectCombines the results of a coupler’s two qubit analyses in a CZ chevron experiment. Finds the point of maximum q_to2-q_to0 magnitude difference and checks that it agrees with either the q_to2 max point or the q_to0 min point within tolerance. If not, the analysis fails.
- class bragi_quantum.experiments.nodes.coupler.cz_chevron.analysis.CZChevronAnalysis(parameters, qoi_cls=None, **kwargs)[source]#
Bases:
AnalysisRuns the frequency-vs-duration CZ chevron analysis for both qubits of one coupler and packages the working point into a single QOI.
- Parameters:
parameters (CZChevronParameters)
- SUPPORT_TRACE_HALF_WINDOW = 4#
- parameters: CZChevronParameters#
- plot_title()[source]#
Title for this element’s (sub)plot. Override per node if desired.
- Return type:
- analyse_element(dataset, element)[source]#
Slice
elementfromdataset(Dataset or path) and fit it here.
- compute_qoi()[source]#
Compute the QOI for the current element.
Runs against
self.dataset/self.magnitudes/self.data_var(already set for the current element) and should store whatever stateadd_traces()needs onself.- Return type:
CZ conditional phase & local phases#
Node implementation for CZ phase calibration.
Ported from tergite-autocalibration (CZConditionalPhaseSSRONode /
CZLocalPhaseSSRONode / CZLocalPhaseSwapSSRONode). Those three node classes
differed only by two booleans on an otherwise-identical measurement and
analysis, so here they collapse into one node class, registered in
nodes.yaml as three parameters:-variants of it (cz_phases_conditional,
cz_phases_local, cz_phases_local_swap).
- class bragi_quantum.experiments.nodes.coupler.cz_phases.node.CZPhases(parameters, qoi_cls=<class 'bragi_quantum.experiments.nodes.coupler.cz_phases.parameters.CZConditionalPhaseQOI'>)[source]#
Bases:
ScheduleCouplerNodeMeasures the CZ conditional phase, or (with
local_phases=True) one of the two CZ local phases, for each coupler.- Parameters:
parameters (CZPhasesParameters)
- measurement_cls#
alias of
CZPhasesMeasurement
- analysis_cls#
alias of
CZPhasesAnalysis
- parameters: CZPhasesParameters#
- property transmons: dict[str, ExtendedTransmon]#
The coupled qubits’ transmons; measured (and read out) by this node.
Parameters and QOIs for CZ phase calibration.
Ported from tergite-autocalibration (lib/nodes/coupler/cz_phases). The three
node variants there (CZConditionalPhaseSSRONode, CZLocalPhaseSSRONode,
CZLocalPhaseSwapSSRONode) differed only by two booleans on one shared
measurement/analysis pair, so here they share a single CZPhasesParameters
and node class, and are registered in nodes.yaml as three parameters:
variants of it (see the “shared class + parameter variants” convention
documented at the top of nodes.yaml, e.g. resonator_spectroscopy_1/_2).
- pydantic model bragi_quantum.experiments.nodes.coupler.cz_phases.parameters.CZPhasesParameters[source]#
Bases:
BaseParametersParameters for CZ phase calibration (conditional phase and local phases).
Sweeps a Ramsey-type phase on the target qubit, with the coupler’s CZ pulse (at its already-calibrated frequency/amplitude/duration) turned on or off / applied with the control qubit in |0> or |1>, depending on
local_phases/swap_control_and_target:Conditional phase (
local_phases=False): compares the target qubit’s Ramsey phase with the control qubit in |0> vs |1>, with the coupler’s virtual-Z phase corrections applied. The difference is the CZ conditional phase (ideal: 180 degrees).Local phase (
local_phases=True,swap_control_and_target=False): compares the target qubit’s Ramsey phase with the CZ pulse off vs on (no virtual-Z corrections, no conditional X on the control qubit), giving the local phase the target qubit itself picks up from the CZ pulse.Local phase, swapped (
local_phases=True,swap_control_and_target=True): same as above with the control and target roles swapped, giving the local phase on the other qubit.
- Fields:
- invalid_variant_combinations: ClassVar[tuple[dict[str, Any], ...]] = (mappingproxy({'local_phases': False, 'swap_control_and_target': True}),)#
- field local_phases: bool = False#
If False, measure the CZ conditional phase. If True, measure a local phase instead (gate off vs on, no virtual-Z corrections).
- pydantic model bragi_quantum.experiments.nodes.coupler.cz_phases.parameters.CZConditionalPhaseQOI[source]#
Bases:
BaseQoiQOI for the CZ conditional-phase node.
- items()[source]#
Iterate like a mapping so bragi_quantum.datalayer’s
update_redis_trusted_valuescan inspect the QOI keys when routing coupler results.
- to_dict()[source]#
Returns the calculated QOIs as a dictionary. The keys should match the attribute paths in the bragi_quantum.datalayer models (e.g., {‘rxy.amp180’: 0.5}).
- Return type:
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
- pydantic model bragi_quantum.experiments.nodes.coupler.cz_phases.parameters.CZLocalPhaseQOI[source]#
Bases:
BaseQoiQOI for the CZ local-phase (target qubit) node.
- items()[source]#
Iterate like a mapping so bragi_quantum.datalayer’s
update_redis_trusted_valuescan inspect the QOI keys when routing coupler results.
- to_dict()[source]#
Returns the calculated QOIs as a dictionary. The keys should match the attribute paths in the bragi_quantum.datalayer models (e.g., {‘rxy.amp180’: 0.5}).
- Return type:
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
- pydantic model bragi_quantum.experiments.nodes.coupler.cz_phases.parameters.CZLocalPhaseSwapQOI[source]#
Bases:
BaseQoiQOI for the CZ local-phase (control qubit, swapped) node.
- items()[source]#
Iterate like a mapping so bragi_quantum.datalayer’s
update_redis_trusted_valuescan inspect the QOI keys when routing coupler results.
- to_dict()[source]#
Returns the calculated QOIs as a dictionary. The keys should match the attribute paths in the bragi_quantum.datalayer models (e.g., {‘rxy.amp180’: 0.5}).
- Return type:
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
Analysis for CZ phase calibration.
Ported from tergite-autocalibration (lib/nodes/coupler/cz_phases/analysis.py).
Each coupler dataset holds a Ramsey-phase scan on the target qubit, for both
values of control_ons, for each of the coupler’s two qubits (only the
Target qubit’s data is fit with a cosine; the Control qubit’s is not expected
to oscillate and is shown as a flat reference).
Like cz_parametrization, the dataset’s data variables are named after
each qubit, not the coupler — so CZPhasesAnalysis overrides
analyse_element/_process to group the coupler’s two qubit variables
directly rather than relying on the generic slice_element.
- class bragi_quantum.experiments.nodes.coupler.cz_phases.analysis.CZPhasesAnalysis(parameters, qoi_cls=None, **kwargs)[source]#
Bases:
AnalysisFits a coupler’s Control and Target qubit Ramsey-phase scans and packages the CZ (conditional or local) phase into a single QOI.
- Parameters:
parameters (CZPhasesParameters)
- parameters: CZPhasesParameters#
- plot_title()[source]#
Title for this element’s (sub)plot. Override per node if desired.
- Return type:
- analyse_element(dataset, element)[source]#
Slice
elementfromdataset(Dataset or path) and fit it here.
- compute_qoi()[source]#
Compute the QOI for the current element.
Runs against
self.dataset/self.magnitudes/self.data_var(already set for the current element) and should store whatever stateadd_traces()needs onself.- Return type:
Two-qubit gate randomized benchmarking#
Node implementations for two-qubit-gate randomized benchmarking (TQG RB).
Ported from tergite-autocalibration (TQGRandomizedBenchmarkingSSRONode /
TQGRandomizedBenchmarkingInterleavedSSRONode). TQGRandomizedBenchmarking
runs standard RB; TQGRandomizedBenchmarkingInterleaved additionally
interleaves a bare CZ Clifford into every sequence, and combines its decay
parameter with the standard run’s (via Redis) to derive the CZ gate fidelity.
Both share the same measurement class and coupler CZ settings, resolved here
from self.edges[coupler].cz rather than read from Redis directly
(matching the cz_phases / cz_parametrization convention).
- class bragi_quantum.experiments.nodes.coupler.tqg_randomized_benchmarking.node.TQGRandomizedBenchmarking(parameters, qoi_cls=<class 'bragi_quantum.experiments.nodes.coupler.tqg_randomized_benchmarking.parameters.TQGRandomizedBenchmarkingQOI'>)[source]#
Bases:
ScheduleCouplerNodeStandard two-qubit-gate randomized benchmarking on a coupler.
- Parameters:
parameters (TQGRandomizedBenchmarkingParameters)
qoi_cls (type[TQGRandomizedBenchmarkingQOI])
- measurement_cls#
alias of
TQGRandomizedBenchmarkingMeasurement
- analysis_cls#
alias of
TQGRandomizedBenchmarkingAnalysis
- parameters: TQGRandomizedBenchmarkingParameters#
- property transmons: dict[str, ExtendedTransmon]#
The coupled qubits’ transmons; measured (and read out) by this node.
- class bragi_quantum.experiments.nodes.coupler.tqg_randomized_benchmarking.node.TQGRandomizedBenchmarkingInterleaved(parameters, qoi_cls=<class 'bragi_quantum.experiments.nodes.coupler.tqg_randomized_benchmarking.parameters.TQGRandomizedBenchmarkingInterleavedQOI'>)[source]#
Bases:
TQGRandomizedBenchmarkingTwo-qubit-gate RB with a bare CZ Clifford interleaved into every sequence, used to extract the CZ gate fidelity against a prior standard RB run on the same coupler.
- Parameters:
parameters (TQGRandomizedBenchmarkingParameters)
qoi_cls (type[TQGRandomizedBenchmarkingInterleavedQOI])
- analysis_cls#
Parameters and QOIs for two-qubit-gate randomized benchmarking (TQG RB).
Ported from tergite-autocalibration (lib/nodes/coupler/tqg_randomized_benchmarking).
Standard RB (TQGRandomizedBenchmarking) and CZ-interleaved RB
(TQGRandomizedBenchmarkingInterleaved) share this one parameters class;
the two node classes differ only in whether the CZ Clifford is interleaved
into every sequence (see node.py).
- pydantic model bragi_quantum.experiments.nodes.coupler.tqg_randomized_benchmarking.parameters.TQGRandomizedBenchmarkingParameters[source]#
Bases:
BaseParametersParameters for two-qubit-gate randomized benchmarking on a coupler.
Runs
n_seedsindependent random Clifford sequences (drawn from the two-qubit Clifford group) at each length inclifford_sequence_lengths, each averaged overnumber_of_shotssingle-shot repetitions. Negative lengths inclifford_sequence_lengthsare calibration points (-1: state |1>, -2: state |2>) used by the analysis to correct for per-seed IQ drift.- Fields:
- pydantic model bragi_quantum.experiments.nodes.coupler.tqg_randomized_benchmarking.parameters.TQGRandomizedBenchmarkingBaseQOI[source]#
Bases:
BaseQoiShared QOI fields and redis layout for the SRB and IRB variants.
- Fields:
- items()[source]#
Iterate like a mapping so bragi_quantum.datalayer’s
update_redis_trusted_valuescan inspect the QOI keys when routing coupler results.
- to_dict()[source]#
Returns the calculated QOIs as a dictionary. The keys should match the attribute paths in the bragi_quantum.datalayer models (e.g., {‘rxy.amp180’: 0.5}).
- Return type:
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
- pydantic model bragi_quantum.experiments.nodes.coupler.tqg_randomized_benchmarking.parameters.TQGRandomizedBenchmarkingQOI[source]#
Bases:
TQGRandomizedBenchmarkingBaseQOIQOI for standard (non-interleaved) two-qubit-gate RB.
- Fields:
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
- pydantic model bragi_quantum.experiments.nodes.coupler.tqg_randomized_benchmarking.parameters.TQGRandomizedBenchmarkingInterleavedQOI[source]#
Bases:
TQGRandomizedBenchmarkingBaseQOIQOI for CZ-interleaved two-qubit-gate RB.
tqg_fidelityhere is the CZ gate fidelity, derived by combining this run’s interleaved decay parameter with the standard RB run’s decay parameter (read back from Redis; see analysis.py).- Fields:
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
Analysis for two-qubit-gate randomized benchmarking (TQG RB).
Ported from tergite-autocalibration (lib/nodes/coupler/tqg_randomized_benchmarking/analysis.py). Fits an exponential decay to the |00> return probability, and a second exponential decay to the population confined to the computational subspace (|00>, |01>, |10>, |11>) to extract a leakage rate. When calibration points (n_cl < 0) are present, per-seed IQ drift is corrected before classification using the 3-state readout boundary (centroid + omega_01/12/20) read from Redis.
TQGRandomizedBenchmarkingInterleavedAnalysis additionally combines its own
decay parameter with the standard-RB run’s decay parameter (read back from
Redis, written there from the SRB run’s QOI) to derive the CZ gate fidelity.
- class bragi_quantum.experiments.nodes.coupler.tqg_randomized_benchmarking.analysis.TQGRandomizedBenchmarkingAnalysis(parameters, qoi_cls=None, **kwargs)[source]#
Bases:
AnalysisFits an exponential decay function to two-qubit-gate randomized benchmarking data for one coupler.
- suffix = 'SRB'#
- plot_title()[source]#
Title for this element’s (sub)plot. Override per node if desired.
- Return type:
- analyse_element(dataset, element)[source]#
Slice
elementfromdataset(Dataset or path) and fit it here.
- compute_qoi()[source]#
Compute the QOI for the current element.
Runs against
self.dataset/self.magnitudes/self.data_var(already set for the current element) and should store whatever stateadd_traces()needs onself.- Return type:
- class bragi_quantum.experiments.nodes.coupler.tqg_randomized_benchmarking.analysis.TQGRandomizedBenchmarkingInterleavedAnalysis(parameters, qoi_cls=None, **kwargs)[source]#
Bases:
TQGRandomizedBenchmarkingAnalysisTwo-qubit-gate RB with the CZ Clifford interleaved into every sequence.
Combines this run’s decay parameter with the standard-RB run’s decay parameter (read back from Redis) to derive the CZ gate fidelity.
- suffix = 'IRB'#
- class bragi_quantum.experiments.nodes.coupler.tqg_randomized_benchmarking.utils.clifford_group.Clifford(idx)[source]#
Bases:
objectBase class for Clifford
Abstract base class for all Clifford operations.
- Variables:
- Parameters:
idx (int)
- get_inverse()[source]#
Get the inverse of this Clifford operation
- Returns:
The inverse operation
- Return type:
- property pauli_transfer_matrix: ndarray#
Returns the Pauli transfer matrix of the Clifford operation.
- Returns:
The Pauli transfer matrix
- Return type:
np.ndarray
- property gate_decomposition: list[tuple[list[str], str]]#
Returns the gate decomposition of the Clifford gate
- Returns:
Gate decomposition as a list of tuples (gate_name, qubit_identifier)
- Return type:
List
- classmethod find_clifford_index(matrix)[source]#
Find the index of a Clifford matrix using hash lookup
- Parameters:
matrix (np.ndarray) – The Pauli transfer matrix
- Returns:
The index of the Clifford operation
- Return type:
- Raises:
ValueError – If the Clifford index is not found
- class bragi_quantum.experiments.nodes.coupler.tqg_randomized_benchmarking.utils.clifford_group.SingleQubitClifford(idx)[source]#
Bases:
CliffordSingle Qubit Clifford gate class
The decomposition of the single qubit clifford group follows paper Epstein et al. Phys. Rev. A 89, 062321 (2014)
- Parameters:
idx (int)
- class bragi_quantum.experiments.nodes.coupler.tqg_randomized_benchmarking.utils.clifford_group.TwoQubitClifford(idx)[source]#
Bases:
CliffordTwo Qubit Clifford gate class
The Clifford decomposition closely follows two papers:
1. Corcoles et al. Process verification … Phys. Rev. A. 2013 https://journals.aps.org/pra/pdf/10.1103/PhysRevA.87.030301 for the different classes of two-qubit Cliffords.
2. Barends et al. Superconducting quantum circuits at the … Nature 2014 https://www.nature.com/articles/nature13171?lang=en for writing the cliffords in terms of CZ gates.
2-qubit clifford decompositions#
The two qubit clifford group (C2) consists of 11520 two-qubit cliffords These gates can be subdivided into four classes.
The Single-qubit like class | 576 elements (24^2)
The CNOT-like class | 5184 elements (24^2 * 3^2)
The iSWAP-like class | 5184 elements (24^2 * 3^2)
4. The SWAP-like class | 576 elements (24^2) ——————————–|————- + Two-qubit Clifford group C2 | 11520 elements
- The Single-qubit like class
– C1 – – C1 –
- The CNOT-like class
- –C1–”–S1– –C1–”–S1——
- -> |
–C1–?–S1– –C1–”–S1^Y90–
- The SWAP-like class
- --C1--x--
–C1–“-mY90–”–Y90–”——- | -> | | |
- --C1--x--
–C1–”–Y90–“-mY90–”–Y90–
- C1: element of the single qubit Clifford group
Note: We use the decomposition defined in Epstein et al. here
S1: element of the S1 group, a subgroup of the single qubit Clifford group
- GROUP_SIZE_CLIFFORD = 24#
- GROUP_SIZE_SINGLE_QUBIT = 576#
- GROUP_SIZE_S1 = 3#
- GROUP_SIZE_CNOT = 5184#
- GROUP_SIZE_ISWAP = 5184#
- GROUP_SIZE_SWAP = 576#
- property pauli_transfer_matrix: ndarray#
Returns the Pauli transfer matrix of the Clifford operation.
- Returns:
The Pauli transfer matrix
- Return type:
np.ndarray
- property gate_decomposition#
Returns the gate decomposition of the two qubit Clifford group.
Single qubit Cliffords are decomposed according to Epstein et al.
- classmethod single_qubit_like_PTM(idx)[source]#
- Returns the pauli transfer matrix for gates of the single qubit like class
(q0) – C1 – (q1) – C1 –
- classmethod single_qubit_like_gates(idx)[source]#
- Returns the gates for Cliffords of the single qubit like class
(q0) – C1 – (q1) – C1 –
- classmethod CNOT_like_PTM(idx)[source]#
- Returns the pauli transfer matrix for gates of the cnot like class
- (q0) –C1–”–S1– –C1–”–S1——
- -> |
(q1) –C1–?–S1– –C1–”–S1^Y90–
- classmethod CNOT_like_gates(idx)[source]#
- Returns the gates for Cliffords of the cnot like class
- (q0) –C1–”–S1– –C1–”–S1——
- -> |
(q1) –C1–?–S1– –C1–”–S1^Y90–
- Parameters:
idx (int)
- classmethod iSWAP_like_PTM(idx)[source]#
- classmethod iSWAP_like_gates(idx)[source]#
- Returns the gates for Cliffords of the iSWAP like class
- (q0) –C1–*–S1– –C1–”—Y90–”–S1^Y90–
- -> | |
(q1) –C1–*–S1– –C1–”–mY90–”–S1^X90–
- Parameters:
idx (int)
- Parameters:
idx (int)
- bragi_quantum.experiments.nodes.coupler.tqg_randomized_benchmarking.utils.randomized_benchmarking.calculate_net_clifford(clifford_indices, CliffordClass)[source]#
Calculate the net-clifford from a list of cliffords indices.
- Parameters:
- Returns:
- a Clifford object containing the net-clifford.
the Clifford index is contained in the Clifford.idx attribute.
- Return type:
net_clifford
- Note: the order corresponds to the order in a pulse sequence but is
the reverse of what it would be in a chained dot product.
- bragi_quantum.experiments.nodes.coupler.tqg_randomized_benchmarking.utils.randomized_benchmarking.add_interleaved_clifford(clifford_sequence, interleaved_clifford)[source]#
Adds an interleaved Clifford gate to the sequence.
- Parameters:
clifford_sequence (np.ndarray) – Array of Clifford indices.
interleaved_clifford (int)
- Returns:
Array with interleaved Clifford.
- Return type:
np.ndarray
- bragi_quantum.experiments.nodes.coupler.tqg_randomized_benchmarking.utils.randomized_benchmarking.add_inverse_clifford(clifford_sequence, CliffordClass)[source]#
Adds the inverse of the total sequence to the end of the sequence.
- bragi_quantum.experiments.nodes.coupler.tqg_randomized_benchmarking.utils.randomized_benchmarking.randomized_benchmarking_sequence(number_of_cliffords, apply_inverse=True, clifford_group=1, interleaved_clifford_idx=None, seed=None)[source]#
Generates a randomized benchmarking sequence using the one- or two-qubit Clifford group.
- Parameters:
number_of_cliffords (int) – Number of Clifford gates in the sequence (excluding the optional inverse).
apply_inverse (bool) – Whether to append the recovery Clifford that inverts the total sequence.
clifford_group (int) – Specifies which Clifford group to use. 1 for single-qubit (24 elements), 2 for two-qubit (11,520 elements).
interleaved_clifford_idx (Optional[int]) – Optional ID for interleaving a specific Clifford gate.
seed (Optional[int]) – Optional seed for reproducibility.
- Returns:
Array of Clifford indices representing the randomized benchmarking sequence.
- Return type:
np.ndarray
- Raises:
ValueError – If number_of_cliffords is negative.
NotImplementedError – If an unsupported Clifford group is specified.
- bragi_quantum.experiments.nodes.coupler.tqg_randomized_benchmarking.utils.pauli_transfer_matrices.X_theta(theta, unit='deg')[source]#
Return the Pauli Transfer Matrix (PTM) of a rotation of angle theta around the X-axis.
Characterization nodes#
T1#
Node implementation for T1 relaxation-time characterization.
- class bragi_quantum.experiments.nodes.characterization.t1.node.T1(parameters, qoi_cls=<class 'bragi_quantum.experiments.nodes.characterization.t1.parameters.T1QOI'>)[source]#
Bases:
ExternalParameterFixedScheduleQubitNodeExecution node for T1 relaxation-time characterization.
The delay sweep (with its per-point hardware averaging expressed as a loop register, plus the automatic calibration-points block appended by
BaseNode.precompile) is compiled once and then executed independentlyt1_repetitionstimes:ExternalParameterFixedScheduleNodetags each execution’s data — sweep AND calibration points alike — with its ownt1_repetitionscoordinate.T1Analysisfits each repeat separately against its own calibration axis and reports the T1 error as the spread across those independent fits.- Parameters:
parameters (T1Parameters)
- measurement_cls#
alias of
T1Measurement
- analysis_cls#
alias of
T1Analysis
- parameters: T1Parameters#
- pydantic model bragi_quantum.experiments.nodes.characterization.t1.parameters.T1Parameters[source]#
Bases:
CoherenceParametersParameters for T1 relaxation-time characterization.
- Fields:
- field max_duration: float = 0.00036#
Longest waiting time, in seconds. Recommended: 5x expected T1 of the qubit.Ignored if list of delays is given explicitly.
- Constraints:
gt = 0.0
- field num_steps: int = 31#
Number of points between 0 and max_duration, default is 31.Ignored if list of delays is given explicitly.
- Constraints:
ge = 2
- field delays: list[float] | None = None#
Explicit delays between the excitation pulse and the readout, in seconds.If defined, this overwrites max_duration and num_steps.
- pydantic model bragi_quantum.experiments.nodes.characterization.t1.parameters.T1QOI[source]#
Bases:
BaseQoiQuantities of Interest from T1 characterization.
Times are stored in microseconds, matching the fitting units.
- Fields:
- to_dict()[source]#
Returns the calculated QOIs as a dictionary. The keys should match the attribute paths in the bragi_quantum.datalayer models (e.g., {‘rxy.amp180’: 0.5}).
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
Module containing classes that fit and plot data from a T1 experiment.
- class bragi_quantum.experiments.nodes.characterization.t1.analysis.T1Analysis(parameters, qoi_cls)[source]#
Bases:
ExponentialDecayAnalysisAnalysis that fits T1 decay of a single qubit, repeated independently
t1_repetitionstimes.Every delay point is a single hardware-averaged value (
repetitionshardware-averaged shots collapse into it — that averaging is not a coordinate this analysis has access to). Each of thet1_repetitionsindependent sweeps is projected onto the |0>-|1> calibration axis using its own calibration points (projectbroadcasts per slice of the outert1_repetitionsdimension, never averaging calibration points across repeats) and fitted separately to an exponential decay. The reported T1 is the mean of the per-repeat fits and its error is the plain standard deviation across those repeats.- Parameters:
parameters (T1Parameters)
- parameters: T1Parameters#
T2 (Ramsey)#
Node implementation for T2* (Ramsey) coherence-time characterization.
- class bragi_quantum.experiments.nodes.characterization.t2.node.T2(parameters, qoi_cls=<class 'bragi_quantum.experiments.nodes.characterization.t2.parameters.T2QOI'>)[source]#
Bases:
ExternalParameterFixedScheduleQubitNodeExecution node for T2* (Ramsey) coherence-time characterization.
Each qubit’s two pi/2 pulses are separated by a swept idle time, with a shared
artificial_detuning_Hzapplied via a clock-phase shift to produce a Ramsey fringe;T2Analysisfits the resulting decaying oscillation to extract T2*.- Parameters:
parameters (T2Parameters)
- parameters: T2Parameters#
- measurement_cls#
alias of
T2Measurement
- analysis_cls#
alias of
T2Analysis
- pydantic model bragi_quantum.experiments.nodes.characterization.t2.parameters.T2Parameters[source]#
Bases:
CoherenceParametersParameters for T2 relaxation-time characterization.
- Fields:
- field delays: list[float] [Optional]#
Sweeping delay times tau between the two pi/2-pulses, in seconds, as an array of setpoints per qubit, keyed by qubit name.
- field artificial_detuning_Hz: float = 1000000.0#
Artificial detuning, in Hz, applied to every qubit via a clock-phase shift after the idle time, used to generate the Ramsey fringe.
- pydantic model bragi_quantum.experiments.nodes.characterization.t2.parameters.T2QOI[source]#
Bases:
BaseQoiQuantities of Interest from T2* (Ramsey) characterization.
t2andtauboth hold the fitted decay time, in microseconds, matching the fitting units (the same quantity —tauis the underlying damped-oscillation fit parameter name,t2is the reported characterization quantity).frequencyandfrequency_errorare in Hz, matchingartificial_detuning_Hz.- Fields:
- to_dict()[source]#
Returns the calculated QOIs as a dictionary. The keys should match the attribute paths in the bragi_quantum.datalayer models (e.g., {‘rxy.amp180’: 0.5}).
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
Module containing classes that fit and plot data from a T2* (Ramsey) experiment.
- class bragi_quantum.experiments.nodes.characterization.t2.analysis.T2Analysis(parameters, qoi_cls)[source]#
Bases:
CoherenceAnalysisAnalysis that fits a damped Ramsey oscillation to a single qubit’s T2* delay sweep, repeated independently
t2_repetitionstimes.Every delay point is a single hardware-averaged value (
repetitionshardware-averaged shots collapse into it — that averaging is not a coordinate this analysis has access to). Each of thet2_repetitionsindependent sweeps is projected onto the |0>-|1> calibration axis using its own calibration points (projectbroadcasts per slice of the outert2_repetitionsdimension, never averaging calibration points across repeats) and fitted separately to an exponentially decaying sinusoid (RamseyModel), seeded with the known (signed)artificial_detuning_Hzso each fit converges on the physically correct oscillation frequency rather than an arbitrary sign. A fit whose frequency lands at or beyond the delay sampling’s Nyquist limit is rejected as an alias, and a fit whose amplitude implausibly exceeds the trace’s own peak-to-peak/2 is rejected as a runaway fit. The reported T2* is the mean of the per-repeat fits and its error is the plain standard deviation across those repeats.- Delays (and so
t2/tau) are fitted and reported in microseconds; frequency/frequency_errorstay in Hz,
matching
artificial_detuning_Hz— the fitted oscillation frequency is converted between the fit’s native cycles/microsecond and Hz at the fit/report boundary.- Parameters:
parameters (T2Parameters)
- model_cls#
alias of
RamseyModel
- parameters: T2Parameters#
- Delays (and so
T2 echo#
Node implementation for T2 Echo (Hahn echo) characterization.
- class bragi_quantum.experiments.nodes.characterization.t2_echo.node.T2Echo(parameters, qoi_cls=<class 'bragi_quantum.experiments.nodes.characterization.t2_echo.parameters.T2EchoQOI'>)[source]#
Bases:
ExternalParameterFixedScheduleQubitNodeExecution node for T2 Echo (Hahn echo) characterization.
The delay sweep (with its per-point hardware averaging expressed as a loop register, plus the automatic calibration-points block appended by
BaseNode.precompile) is compiled once and then executed independentlyt2_echo_repetitionstimes:ExternalParameterFixedScheduleNodetags each execution’s data — sweep AND calibration points alike — with its ownt2_echo_repetitionscoordinate.T2EchoAnalysisfits each repeat separately against its own calibration axis and reports the T2 echo error as the spread across those independent fits.- Parameters:
parameters (T2EchoParameters)
- measurement_cls#
alias of
T2EchoMeasurement
- analysis_cls#
alias of
T2EchoAnalysis
- parameters: T2EchoParameters#
- pydantic model bragi_quantum.experiments.nodes.characterization.t2_echo.parameters.T2EchoParameters[source]#
Bases:
CoherenceParametersParameters for T2 Echo (Hahn echo) characterization.
- Fields:
- pydantic model bragi_quantum.experiments.nodes.characterization.t2_echo.parameters.T2EchoQOI[source]#
Bases:
BaseQoiQuantities of Interest from T2 Echo characterization.
Times are stored in microseconds, matching the fitting units.
- Fields:
- to_dict()[source]#
Returns the calculated QOIs as a dictionary. The keys should match the attribute paths in the bragi_quantum.datalayer models (e.g., {‘rxy.amp180’: 0.5}).
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
Module containing classes that fit and plot data from a T2 Echo experiment.
- class bragi_quantum.experiments.nodes.characterization.t2_echo.analysis.T2EchoAnalysis(parameters, qoi_cls)[source]#
Bases:
ExponentialDecayAnalysisAnalysis that fits T2 echo decay of a single qubit, repeated independently
t2_echo_repetitionstimes.Every delay point is a single hardware-averaged value (
repetitionshardware-averaged shots collapse into it — that averaging is not a coordinate this analysis has access to). Each of thet2_echo_repetitionsindependent sweeps is projected onto the |0>-|1> calibration axis using its own calibration points (projectbroadcasts per slice of the outert2_echo_repetitionsdimension, never averaging calibration points across repeats) and fitted separately to an exponential decay. The reported T2 echo is the mean of the per-repeat fits and its error is the plain standard deviation across those repeats.The recorded
delayscoordinate is the half-delay (tau/2) the measurement schedule swept — seeT2EchoMeasurement— so it is doubled back to the total echo delay before fitting.- Parameters:
parameters (T2EchoParameters)
- parameters: T2EchoParameters#
Randomized benchmarking#
Node implementation for single-qubit randomized benchmarking (RB).
- class bragi_quantum.experiments.nodes.characterization.randomized_benchmarking.node.RandomizedBenchmarking(parameters, qoi_cls=<class 'bragi_quantum.experiments.nodes.characterization.randomized_benchmarking.parameters.RBQOI'>)[source]#
Bases:
ScheduleQubitNodeExecution node for single-qubit randomized benchmarking (SSRO-classified).
Each of the
n_seedsindependent random-Clifford realizations needs a genuinely different compiled schedule (the random sequence is baked directly into the pulses, not expressible as a hardwareVariablesweep), so — unlike every other node so far — this one drives its outer loop viaScheduleNode.outer_schedule_samplespace(recompile fresh per iteration) rather thanExternalParameterFixedScheduleQubitNode(compile once, re-execute).seedsis the outer dimension; theclifford_sequence_lengthssweep is inner, expressed as a plain Python loop within each seed’s own compiled schedule (also not a hardwareVariablesweep, since each sequence length needs its own randomly generated gates). Every per-seed compile also gets its own automatic calibration-points block, so each seed’s state populations are normalized against its own calibration, never an average across seeds.- Parameters:
parameters (RBParameters)
- measurement_cls#
alias of
RandomizedBenchmarkingMeasurement
- analysis_cls#
alias of
RBAnalysis
- parameters: RBParameters#
- pydantic model bragi_quantum.experiments.nodes.characterization.randomized_benchmarking.parameters.RBParameters[source]#
Bases:
BaseParametersParameters for single-qubit randomized benchmarking (SSRO-classified).
- Fields:
- field n_seeds: int = 8#
Number of independent random-Clifford-sequence realizations (a fresh, differently seeded sequence per sequence length). Recompiled and executed once per seed; fidelity is fit against their seed-averaged state populations, weighted by the seed-to-seed spread at each sequence length.
- field repetitions: int = 1024#
Hardware-averaged shots for the automatic calibration-points block appended by BaseNode.precompile — independent of number_of_shots, which drives the main single-shot RB loop.
- field clifford_sequence_lengths: list[int] [Optional]#
Numbers of random Cliffords applied (then inverted) per sequence.
- field seed_number: str | None = None#
1-based seed(s) to show in the IQ-cloud plot, e.g. 1; 3-5; 3,4,5. Defaults to the first seed (1); several seeds render as a grid.
- pydantic model bragi_quantum.experiments.nodes.characterization.randomized_benchmarking.parameters.RBQOI[source]#
Bases:
BaseQoiQuantities of Interest from randomized benchmarking.
- Fields:
- to_dict()[source]#
Returns the calculated QOIs as a dictionary. The keys should match the attribute paths in the bragi_quantum.datalayer models (e.g., {‘rxy.amp180’: 0.5}).
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
Module containing the class that classifies, fits and plots data from a randomized benchmarking (RB) experiment.
- class bragi_quantum.experiments.nodes.characterization.randomized_benchmarking.analysis.RBAnalysis(parameters, qoi_cls)[source]#
Bases:
AnalysisAnalysis that classifies single-shot RB data into states 0/1/2 and fits the resulting population decays.
Every shot is classified via nearest-centroid (Voronoi) comparison built from three pairwise calibration-axis projections (
bragi_quantum.experiments.utils.calibration_points.project_onto_calibrationwith(low, high)= (0, 1), (1, 2) and (0, 2)): treating each state’s calibration population as bivariate Gaussian with shared covariance, each pairwise axis’s 0.5 threshold is exactly that pair’s Bayes decision boundary, so the state that wins both of its relevant pairwise comparisons is the globally nearest centroid (see_classify_shots). All three axes are needed — |2> is not generally collinear with |0>-|1>, so a sequential two-axis check would silently misclassify. If the qubit’s 1->2 pulse isn’t calibrated (noCAL=2point), classification falls back to 0-vs-1 only and leakage/seepage are left unmeasured (NaN).Every one of the
n_seedsindependent random-Clifford realizations carries its OWN calibration points (never an average across seeds), so each seed’s shots are classified against calibration measured in that same compiled schedule. State populations are then averaged across seeds; the seed-to-seed standard deviation is used as the fit weight — a sequence length whose population is well-determined across seeds pulls harder on the fit.- Parameters:
parameters (RBParameters)
- parameters: RBParameters#
- compute_qoi()[source]#
Compute the QOI for the current element.
Runs against
self.dataset/self.magnitudes/self.data_var(already set for the current element) and should store whatever stateadd_traces()needs onself.- Return type:
- plot_title()[source]#
Title for this element’s (sub)plot. Override per node if desired.
- Return type:
Purity benchmarking#
Node implementation for single-qubit purity benchmarking.
- class bragi_quantum.experiments.nodes.characterization.purity_benchmarking.node.PurityBenchmarking(parameters, qoi_cls=<class 'bragi_quantum.experiments.nodes.characterization.purity_benchmarking.parameters.PurityBenchmarkingQOI'>)[source]#
Bases:
ScheduleQubitNodeExecution node for single-qubit purity benchmarking.
As in
RandomizedBenchmarking, each of then_seedsindependent random-Clifford realizations needs its own compiled schedule (the random sequence is baked directly into the pulses), so this node drives its outer loop viaScheduleNode.outer_schedule_samplespace(recompile fresh per seed) rather thanExternalParameterFixedScheduleQubitNode.seedsis the outer dimension;clifford_sequence_lengthsand the three measurement bases are inner, expressed as plain Python loops within each seed’s own compiled schedule. Every per-seed compile also gets its own automatic calibration-points block, so each seed’s populations are normalized against its own calibration, never an average across seeds.- Parameters:
parameters (PurityBenchmarkingParameters)
qoi_cls (type[PurityBenchmarkingQOI])
- measurement_cls#
alias of
PurityBenchmarkingMeasurement
- analysis_cls#
alias of
PurityBenchmarkingAnalysis
- parameters: PurityBenchmarkingParameters#
- pydantic model bragi_quantum.experiments.nodes.characterization.purity_benchmarking.parameters.PurityBenchmarkingParameters[source]#
Bases:
BaseParametersParameters for single-qubit purity benchmarking.
- field n_seeds: int = 10#
Number of independent random-Clifford-sequence realizations (a fresh, differently seeded sequence per sequence length). Recompiled and executed once per seed; purity is fit against their seed-averaged values, weighted by the seed-to-seed spread at each sequence length.
- field repetitions: int = 1024#
Hardware-averaged shots per (seed, sequence length, basis) point, and for the automatic calibration-points block appended by BaseNode.precompile.
- pydantic model bragi_quantum.experiments.nodes.characterization.purity_benchmarking.parameters.PurityBenchmarkingQOI[source]#
Bases:
BaseQoiQuantities of Interest from purity benchmarking.
purity_fidelityis the raw purity-decay fit parameter, i.e. the unitarityuof Wallman et al. (“Estimating the coherence of noise”, New J. Phys. 17 113020) / Zhu et al. (arXiv:2407.07960) — the name is kept for backward compatibility with the original tergite-autocalibration node.incoherent_erroris the decoherence-limited error bound derived fromualone (Zhu et al. eq. 13).coherent_erroradditionally needs a companion randomized-benchmarking result for the same qubit (read back from Redis, seePurityBenchmarkingAnalysis); it isfloat("nan")when no such result is available.- Fields:
- to_dict()[source]#
Returns the calculated QOIs as a dictionary. The keys should match the attribute paths in the bragi_quantum.datalayer models (e.g., {‘rxy.amp180’: 0.5}).
- model_post_init(context, /)#
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
Module containing the class that computes, fits and plots purity from a purity benchmarking experiment.
- class bragi_quantum.experiments.nodes.characterization.purity_benchmarking.analysis.PurityBenchmarkingAnalysis(parameters, qoi_cls)[source]#
Bases:
AnalysisAnalysis that combines per-basis Pauli expectation values into a purity and fits its decay against the number of Cliffords.
Every shot is hardware-averaged (never classified), and each of the
n_seedsindependent random-Clifford realizations carries its OWN calibration points (never an average across seeds — mirrorsRBAnalysis): each seed’s three basis measurements are projected onto the |0>-|1> axis using calibration measured in that same compiled schedule, converted to Pauli expectation values (x_exp = 2 * p_x - 1etc.) and combined intopurity = x_exp**2 + y_exp**2 + z_exp**2. Purity is then averaged across seeds; the seed-to-seed standard deviation is used as the fit weight, same asRBAnalysis.The purity decay parameter
u(unitarity) alone already bounds the incoherent (decoherence-limited) error, independent of any other measurement — Wallman et al. (“Estimating the coherence of noise”, New J. Phys. 17 113020), restated as eq. 13 of Zhu et al. (arXiv:2407.07960):incoherent_error = (1/2)(1 - sqrt(u))for a single qubit. Combining that with a companion randomized-benchmarking (RB) result for the same qubit additionally isolates the coherent (“true”, systematic / calibration) error:coherent_error = total_error - incoherent_error(Zhu et al. eq. 14), wheretotal_error = 1 - rb_fidelityis RB’s average gate error rate (Zhu et al. eq. 4). RB’s result is read back from Redis (therb_fidelitytrusted value written byRandomizedBenchmarkingfor this same qubit) — if none is found (RB hasn’t been run yet, or no active session),coherent_erroris reported asfloat("nan")rather than failing the analysis:incoherent_errornever depends on it.- Parameters:
parameters (PurityBenchmarkingParameters)
qoi_cls (type[PurityBenchmarkingQOI])
- parameters: PurityBenchmarkingParameters#
- compute_qoi()[source]#
Compute the QOI for the current element.
Runs against
self.dataset/self.magnitudes/self.data_var(already set for the current element) and should store whatever stateadd_traces()needs onself.- Return type:
Registry#
See also the Node Registry guide.
Access to the bragi_quantum.experiments node registry.
- pydantic model bragi_quantum.experiments.registry.RequiresSpec[source]#
Bases:
BaseModelA variant’s dependency on gates/parameters. See schema in nodes.yaml
- Fields:
- pydantic model bragi_quantum.experiments.registry.VariantEntry[source]#
Bases:
BaseModelOne concrete variant of a node entry. See schema in nodes.yaml
- Fields:
- field requires: RequiresSpec | None = None#
- pydantic model bragi_quantum.experiments.registry.NodeEntry[source]#
Bases:
BaseModelOne registry entry. See schema in nodes.yaml
- Fields:
- field variants: list[VariantEntry] [Required]#
- Constraints:
min_length = 1
- pydantic model bragi_quantum.experiments.registry.NodeCategory[source]#
Bases:
BaseModelA group of entries sharing an import root (e.g.
readout).
- pydantic model bragi_quantum.experiments.registry.NodeRegistryFile[source]#
Bases:
BaseModelThe validated shape of
nodes.yaml.- field nodes: dict[str, NodeCategory] [Required]#
- class bragi_quantum.experiments.registry.ExperimentNodeVariant(name, node_cls, qoi_cls, analysis_cls, category, parameters=<factory>, requires=None, calibrates=<factory>, doc=None, show_in_graph=True)[source]#
Bases:
objectA registered node variant, ready to be instantiated.
- Variables:
name (str) – The stable registry name of the variant.
node_cls (type) – The node class to instantiate.
qoi_cls (type) – QOI class injected as
qoi_cls.analysis_cls (type) – Analysis class injected as
analysis_cls.category (str) – The top-level
nodes.yamlcategory this variant’s entry lives under (e.g."readout").parameters (dict[str, Any]) – Fixed parameter values that define the variant (e.g.
{"state": 1, "transition": "12"}). These always win over caller-supplied overrides increate().requires (bragi_quantum.experiments.registry.RequiresSpec | None) – The variant’s declared gate/parameter dependencies, if any.
calibrates (list[str]) – The redis keys this variant’s QOI writes.
doc (str | None) – The entry’s
docs/node-library/nodes/<doc>.mdstem, if any.show_in_graph (bool) – Whether this variant should appear in the docs dependency graph.
- Parameters:
- requires: RequiresSpec | None = None#
- create(**parameter_overrides)[source]#
Build the node: validate parameters, inject QOI/analysis classes.
Must be called inside an active calibration session (node
__init__requires it).parameter_overridesare free (sweep sizes, qubits, …) but cannot override the spec’s ownparameters— those define the variant’s identity.- Parameters:
parameter_overrides (Any)
- bragi_quantum.experiments.registry.load_node_registry()[source]#
Return the registered node variants as
{variant_name: ExperimentNodeVariant}.Reads
bragi_quantum.experiments/nodes.yaml, validates it againstNodeRegistryFile, then imports each referenced class. Every entry’svariantsare flattened into this one dict, keyed by each variant’s ownname.- Return type:
Utilities#
Deprecated compatibility shim.
Every declaration formerly defined in this module has moved to
bragi_quantum.experiments.fitting_tools (split into fitting_tools.models and
fitting_tools.functions). Importing from here still works, but emits a
FutureWarning pointing at the new location.
Calibration-points block: schedule-side detection, dataset-side lookup and projection, and the exceptions raised when it can’t be found.
Import wholesale: from bragi_quantum.experiments.utils import calibration_points as cal.
- exception bragi_quantum.experiments.utils.calibration_points.CalibrationPointsError[source]#
Bases:
KeyErrorBase class for calibration-point lookup failures.
Subclasses
KeyErrorso existingexcept KeyErrorsites still work.
- exception bragi_quantum.experiments.utils.calibration_points.NoCalibrationPointsError[source]#
Bases:
CalibrationPointsErrorNo
<element>_CALdata variable found in the dataset.
- exception bragi_quantum.experiments.utils.calibration_points.PartialCalibrationPointsError[source]#
Bases:
CalibrationPointsError<element>_CALexists but is missing a requiredCALstate.
- bragi_quantum.experiments.utils.calibration_points.has_calibration_points(schedule)[source]#
Whether
schedulecontains a schedulable labeledCALIBRATION_POINTS_LABEL.- Parameters:
schedule (TimeableScheduleBase) – A schedule, typically already compiled (see
BaseNode.precompile).- Return type:
- bragi_quantum.experiments.utils.calibration_points.element_has_calibration_data(dataset, element_name)[source]#
Whether
datasetcarries a<element_name>_CALvariable at all.
- bragi_quantum.experiments.utils.calibration_points.available_calibration_states(dataset, element_name)[source]#
The
CALstate values present forelement_name.
- bragi_quantum.experiments.utils.calibration_points.get_calibration_complex(dataset, element_name, *, required_states=frozenset({0.0, 1.0}))[source]#
Return
element_name’s calibration IQ values as complex numbers.- Parameters:
- Returns:
Complex IQ values, one per
CALstate (and any outer dimensions, e.g. repetitions, preserved unaveraged).- Return type:
xr.DataArray
- Raises:
NoCalibrationPointsError – No
<element_name>_CALvariable at all.PartialCalibrationPointsError – The variable exists but is missing one or more of
required_states.
- bragi_quantum.experiments.utils.calibration_points.project_onto_calibration(complex_data, calib, *, low=0, high=1)[source]#
Rotate and normalize IQ data onto the low-high axis
calibdefines.CAL=lowmaps to 0,CAL=highmaps to 1. Normalization is applied per slice of any outer dimensionscalibcarries (e.g. repetitions): xarray broadcasting pairs each slice ofcomplex_datawith its own calibration points, never an average of them.- Parameters:
complex_data (xr.DataArray) – Complex-valued IQ data whose outer dimensions align with
calib. Typicallyself.S21[self.data_var].calib (xr.DataArray) – This element’s calibration points, from
get_calibration_complex.low (float, optional) – Calibrated state mapped to 0. By default the ground state (0).
high (float, optional) – Calibrated state mapped to 1. By default the first excited state (1).
- Returns:
Real-valued, same shape as
complex_data, near 0 at low and near 1 at high.- Return type:
xr.DataArray
- bragi_quantum.experiments.utils.calibration_points.dataset_has_calibration_points_for_all_qubits(dataset, element_name, *, required_states=frozenset({0.0, 1.0}))[source]#
Whether
get_calibration_complexwould succeed forelement_name.Never raises; use to decide upfront (e.g. to label a plot axis) without needing to catch
project’sCalibrationPointsError.
- bragi_quantum.experiments.utils.calibration_points.project(dataset, element_name, complex_data, *, low=0, high=1)[source]#
get_calibration_complex+project_onto_calibration.- Parameters:
dataset (xr.Dataset) – This element’s (already-sliced) dataset.
element_name (str) – The qubit/coupler name, e.g.
"q06".complex_data (xr.DataArray) – Complex-valued IQ data. Typically
self.S21[self.data_var].low (float, optional) – Calibrated state mapped to 0. By default the ground state (0).
high (float, optional) – Calibrated state mapped to 1. By default the first excited state (1).
- Returns:
Real-valued, same shape as
complex_data, near 0 at low and near 1 at high.- Return type:
xr.DataArray
- Raises:
CalibrationPointsError – Calibration data for
element_nameis missing or doesn’t cover bothlowandhigh. Callers that want to degrade gracefully (e.g. fall back to raw magnitude) should catch this themselves — that’s a judgment call for the analysis, not this module.
Ported from tergite-autocalibration (lib/utils/classification_functions).
Classifies raw IQ points into the |0>, |1>, |2> states using the three
angular boundaries (omega_01, omega_12, omega_20) and centroid produced by a
3-state readout calibration (see
bragi_quantum.experiments.fitting_tools.models.classification.ThreeClassBoundary). Unlike the tergite
original, the boundary values are passed in explicitly rather than read from
Redis inside this function, so callers control where those values come from
(Redis, the device model, or a test fixture) and the classifier itself stays
pure and easily testable.
- bragi_quantum.experiments.utils.classification_functions.assign_state(iq_values, *, centroid_i, centroid_q, omega_01, omega_12, omega_20)[source]#
Classify each point in
iq_valuesinto state 0, 1, or 2.The three angular boundaries divide the IQ plane (relative to the centroid) into three sectors, one per state;
iq_valuesis translated so the centroid sits at the origin, converted to an angle, and each angle is assigned to the sector it falls into.
The single-qubit Clifford group (24 elements) decomposed into physical XY rotations, used to find the recovery/inverse operation of a random Clifford sequence for randomized benchmarking.
Correctness is enforced at the group level, not the element level:
S4ElementXY just turns its physical pulses into a Pauli Transfer Matrix
(PTM), while S4GroupPTM validates that its tabulated elements actually
form a group (closed, contains the identity, every element has an inverse)
rather than checking each element’s angles in isolation.
S4GroupPTM also builds a PTM -> index lookup table lazily on first use
and caches it for the group’s lifetime (functools.cached_property). At
24 elements this barely matters, but it’s built this way because it will:
the two-qubit Clifford group has 11,520 elements, and recovery() gets
called once per random RB sequence – a linear scan over that many elements,
every time, is not something you want to pay for repeatedly.
Ported from tergite-autocalibration’s
utils/clifford_elements_decomposition.py.
- pydantic model bragi_quantum.experiments.utils.clifford_elements_decomposition.Clifford1XYdecomp_pulse[source]#
Bases:
BaseModelA single physical rotation
Rxy(theta, phi), in degrees.- Fields:
- pydantic model bragi_quantum.experiments.utils.clifford_elements_decomposition.S4ElementXY[source]#
Bases:
BaseModelOne of the 24 single-qubit Cliffords, decomposed into 1-3 physical XY pulses.
Modulo global phase, the single-qubit Clifford group is exactly the rotational symmetry group of the octahedron whose vertices are the six Pauli eigenstates on the Bloch sphere – a group of order 24 isomorphic to S4, the symmetric group on 4 elements.
- field pulses: tuple[Clifford1XYdecomp_pulse, ...] [Required]#
- classmethod from_angles(*pulses)[source]#
Build from
(theta, phi)pairs, e.g.(90, 0).- Parameters:
- Return type:
- to_ptm()[source]#
The 4x4 Pauli Transfer Matrix of the composed physical pulses.
Unlike the raw 2x2 unitary, the PTM represents conjugation
rho -> U rho U^daggerrather thanUitself, so any global phase onUcancels out; this makes the PTM a faithful representation of PU(2) (unitaries modulo global phase) instead of U(2), which is what “which Clifford is this” actually means physically.- Return type:
- pydantic model bragi_quantum.experiments.utils.clifford_elements_decomposition.S4GroupPTM[source]#
Bases:
BaseModelThe 24-element single-qubit Clifford group.
Rather than checking each
S4ElementXY’s angles in isolation, this validates that the tabulated elements actually satisfy the group axioms as PTMs: exactly 24 distinct elements, closed under composition, containing the identity, and every element has an inverse within the set.elementsis aClassVar, not a field: there is exactly one single-qubit Clifford group, its 24 elements are a fixed mathematical fact, not per-instance configuration.- elements: ClassVar[tuple[S4ElementXY, ...]] = (S4ElementXY(pulses=(Clifford1XYdecomp_pulse(theta=0, phi=0),)), S4ElementXY(pulses=(Clifford1XYdecomp_pulse(theta=90, phi=90), Clifford1XYdecomp_pulse(theta=90, phi=0))), S4ElementXY(pulses=(Clifford1XYdecomp_pulse(theta=-90, phi=0), Clifford1XYdecomp_pulse(theta=-90, phi=90))), S4ElementXY(pulses=(Clifford1XYdecomp_pulse(theta=180, phi=0),)), S4ElementXY(pulses=(Clifford1XYdecomp_pulse(theta=-90, phi=90), Clifford1XYdecomp_pulse(theta=-90, phi=0))), S4ElementXY(pulses=(Clifford1XYdecomp_pulse(theta=90, phi=0), Clifford1XYdecomp_pulse(theta=-90, phi=90))), S4ElementXY(pulses=(Clifford1XYdecomp_pulse(theta=180, phi=90),)), S4ElementXY(pulses=(Clifford1XYdecomp_pulse(theta=-90, phi=90), Clifford1XYdecomp_pulse(theta=90, phi=0))), S4ElementXY(pulses=(Clifford1XYdecomp_pulse(theta=90, phi=0), Clifford1XYdecomp_pulse(theta=90, phi=90))), S4ElementXY(pulses=(Clifford1XYdecomp_pulse(theta=180, phi=0), Clifford1XYdecomp_pulse(theta=180, phi=90))), S4ElementXY(pulses=(Clifford1XYdecomp_pulse(theta=90, phi=90), Clifford1XYdecomp_pulse(theta=-90, phi=0))), S4ElementXY(pulses=(Clifford1XYdecomp_pulse(theta=-90, phi=0), Clifford1XYdecomp_pulse(theta=90, phi=90))), S4ElementXY(pulses=(Clifford1XYdecomp_pulse(theta=90, phi=90), Clifford1XYdecomp_pulse(theta=180, phi=0))), S4ElementXY(pulses=(Clifford1XYdecomp_pulse(theta=-90, phi=0),)), S4ElementXY(pulses=(Clifford1XYdecomp_pulse(theta=90, phi=0), Clifford1XYdecomp_pulse(theta=-90, phi=90), Clifford1XYdecomp_pulse(theta=-90, phi=0))), S4ElementXY(pulses=(Clifford1XYdecomp_pulse(theta=-90, phi=90),)), S4ElementXY(pulses=(Clifford1XYdecomp_pulse(theta=90, phi=0),)), S4ElementXY(pulses=(Clifford1XYdecomp_pulse(theta=90, phi=0), Clifford1XYdecomp_pulse(theta=90, phi=90), Clifford1XYdecomp_pulse(theta=90, phi=0))), S4ElementXY(pulses=(Clifford1XYdecomp_pulse(theta=-90, phi=90), Clifford1XYdecomp_pulse(theta=180, phi=0))), S4ElementXY(pulses=(Clifford1XYdecomp_pulse(theta=90, phi=0), Clifford1XYdecomp_pulse(theta=180, phi=90))), S4ElementXY(pulses=(Clifford1XYdecomp_pulse(theta=90, phi=0), Clifford1XYdecomp_pulse(theta=-90, phi=90), Clifford1XYdecomp_pulse(theta=90, phi=0))), S4ElementXY(pulses=(Clifford1XYdecomp_pulse(theta=90, phi=90),)), S4ElementXY(pulses=(Clifford1XYdecomp_pulse(theta=-90, phi=0), Clifford1XYdecomp_pulse(theta=180, phi=90))), S4ElementXY(pulses=(Clifford1XYdecomp_pulse(theta=90, phi=0), Clifford1XYdecomp_pulse(theta=90, phi=90), Clifford1XYdecomp_pulse(theta=-90, phi=0))))#
- index_of(ptm)[source]#
The index of the element whose PTM is
ptm.Only meaningful for a PTM that is actually one of the group’s own elements (e.g. a product or inverse of tabulated PTMs) – guaranteed to be found by the group axioms checked in
_check_group_axioms.
- net_ptm(rng_sequence)[source]#
The composed PTM of the physical pulses for a sequence of element indices.
- recovery(rng_sequence)[source]#
Find the Clifford (and its index) that inverts the net Clifford operation of
rng_sequence, so appending it recovers the identity.The group is closed and every element has an inverse (checked once, by
_check_group_axioms), so the recovery element is guaranteed to exist – no defensive “not found” handling needed. Since every PTM here is an orthogonal integer matrix, its inverse is just its transpose, so there’s no need fornp.linalg.inveither.- Parameters:
rng_sequence (ndarray)
- Return type:
- bragi_quantum.experiments.utils.cluster_snapshots.cluster_metadata_dir(data_path, measurement)[source]#
Return (and create) the per-submeasurement metadata root.
Structure:
<data_path>/cluster_metadata/measurement_<N>/
- bragi_quantum.experiments.utils.cluster_snapshots.take_cluster_snapshots(data_path, measurement, cluster_names, *, label)[source]#
Save a JSON snapshot of every cluster under cluster_metadata/.
Each cluster gets its own subfolder inside the per-submeasurement directory:
cluster_metadata/measurement_<N>/<cluster_name>/before.json cluster_metadata/measurement_<N>/<cluster_name>/after.json cluster_metadata/measurement_<N>/<cluster_name>/snapshot.diff
Helpers to load a saved node dataset and run a single-element analysis on it.
A node’s HDF5 stores every element (qubit or coupler) as its own data variable
named after the element (q06, q06_q07, …). Before an analysis can run,
that full dataset must be sliced down to one element — the same operation the
node does internally in _analyze_all_qubits and that bragi_quantum.gui does when it
replays a plot. These helpers centralise that slicing so callers (scripts,
notebooks, reanalysis tooling) never have to touch xarray by hand.
- bragi_quantum.experiments.utils.dataset_utils.as_dataset(dataset)[source]#
Return an open dataset, accepting either an
xr.Datasetor a file path.
- bragi_quantum.experiments.utils.dataset_utils.slice_element(dataset, element, *, kind='qubit', node_name=None)[source]#
Slice a single element out of a full node dataset.
Merges the data variable(s) named after
element, tags the result, and — for qubits — restricts it to the element’s own sweep coordinate. The returned dataset is exactly whatprocess_qubit/process_couplerexpect.Also picks up
element’s own"<element>_CAL"companion variable (if present), so calibration-point data travels with its owning qubit rather than being dropped by the slice — seebragi_quantum.experiments.utils.calibration_points.get_calibration_complex/project.- Parameters:
- Returns:
The single-element dataset. If
elementis not present as a variable (already a single-element dataset), it is returned unchanged.- Return type:
Dataset
- bragi_quantum.experiments.utils.dataset_utils.validate_raw_dataset(raw_ds, transmons)[source]#
Raise/log on an empty or suspicious raw dataset before any processing.
- Parameters:
raw_ds (Dataset)
transmons (dict[str, ExtendedTransmon])
- Return type:
None
- bragi_quantum.experiments.utils.dataset_utils.drop_active_reset_and_extra_coords(raw_ds, schedule_samplespace)[source]#
Drop AR (active reset) sample channels and coords outside the inner sweep.
The coordinate ‘acq_index_<i>’ is special: it corresponds to the flat measurement-index dimension of channel <i> and must always be kept.
- bragi_quantum.experiments.utils.dataset_utils.sorted_by_acq_channel(transmons)[source]#
- Parameters:
transmons (dict[str, ExtendedTransmon])
- Return type:
- bragi_quantum.experiments.utils.dataset_utils.rename_channels_to_qubit_names(ds, transmons)[source]#
Invert the acquisition-channel-to-qubit-name mapping on the dataset’s data vars.
The acquisition dimensions are created by measure_system using int(acq_channel), so the cast here must match: an acq_channel overlaid from Redis can arrive as a float (e.g. 0.0), which would otherwise produce “acq_index_0.0” and mismatch the “acq_index_0” dimension the cluster actually returns.
- Parameters:
ds (Dataset)
transmons (dict[str, ExtendedTransmon])
- Return type:
Dataset
- bragi_quantum.experiments.utils.dataset_utils.resolve_dimension_names(schedule_samplespace, raw_ds)[source]#
The sweep dimensions to reshape the flat acquisition index into.
Appends ‘shot_index’ when the dataset carries single-shot data, so the multi-index built from it is aware of that extra dimension.
- bragi_quantum.experiments.utils.dataset_utils.get_acq_index_dim_name(da, acq_channel)[source]#
Return the acquisition-index dimension name for da.
qblox-scheduler records the authoritative name in
da.attrs["acq_index_dim_name"]— acquisition channels that share identicalcoordsin the schedule are merged into one such shared dimension (e.g."acq_index_0_1"), so it is no longer safe to assume every channel owns its own privateacq_index_<channel>dimension. Falls back to that legacy convention when the attribute is absent.
- bragi_quantum.experiments.utils.dataset_utils.filter_rows_for_channel(da, acq_dim, anchor_coord)[source]#
Keep only the rows of a (possibly shared) acquisition dimension for one channel.
When several channels share
acq_dim, rows belonging to other channels carry NaN at anchor_coord.anchor_coordmust be per-qubit distinct — the first schedule_samplespace coordinate, built via make_linear_domains, satisfies this. A no-op when the channel ownsacq_dimoutright (no NaNs present).
Drop every non-dimension coordinate on da except
coord_names.
- bragi_quantum.experiments.utils.dataset_utils.reshape_flat_acquisition_dim(da, acq_dim, coord_names)[source]#
Replace the flat acquisition dimension with proper named coordinate dimensions.
For a single coordinate
swap_dimsis used to avoid xarray’s single-level-MultiIndex restriction onunstack. For multiple coordinatesset_index+unstackbuilds an N-D grid.
- bragi_quantum.experiments.utils.dataset_utils.build_channel_dataset(ds, transmon, dimension_names)[source]#
Isolate and reshape one qubit’s acquisition data out of its flat dim.
- Parameters:
ds (Dataset)
transmon (ExtendedTransmon)
- Return type:
Dataset
- bragi_quantum.experiments.utils.dataset_utils.build_channel_datasets(ds, transmons, dimension_names)[source]#
- Parameters:
ds (Dataset)
transmons (list[ExtendedTransmon])
- Return type:
list[Dataset]
- bragi_quantum.experiments.utils.dataset_utils.merge_channel_datasets(datasets)[source]#
- Parameters:
datasets (list[Dataset])
- Return type:
Dataset
- bragi_quantum.experiments.utils.deprecation.deprecated(replacement)[source]#
Mark a callable or class as deprecated, pointing callers to replacement.
- bragi_quantum.experiments.utils.measurement_utils.reduce_samplespace(iteration, samplespace)[source]#
- bragi_quantum.experiments.utils.q1asm_dump.plot_module_waveforms(module_dir, measurement_id, seq_waveforms)[source]#
Plot waveforms for all sequencers of a module into a single figure.
Create one subplot per sequencer that has waveforms (up to 6), arranged in a single column with a shared x axis. Each subplot title is the sequencer index; each line label (sequencer-prefixed, in the shared legend) is the waveform index field. The figure title is the measurement ID.
Safe to call from a background thread.
Return the path to the written
waveforms.jpg, orNonewhen there is nothing to plot.
- bragi_quantum.experiments.utils.q1asm_dump.dump_q1asm_programs(data_path, compiled_schedule, measurement)[source]#
Dump compiled q1asm programs to data_path/q1asm_programs/<cluster>/<module>/<sequencer>.json.
- The folder hierarchy mirrors the hardware topology:
data_path/q1asm_programs/<cluster_name>/<module_name>/<sequencer_name>.json
- For each sequencer the following files are written:
sequencerX.json— full serialised sequencer datasequencerX.q1asm— extracted assembly program textwaveforms.jpg— one subplot per sequencer with waveforms (per module)
Utility functions for generating sample space arrays for spectroscopy measurements.
- bragi_quantum.experiments.utils.samplespace.resonator_samples(qubit, state=0, samples=None, half_width=None)[source]#
Dynamically generates the frequency sweep array for a resonator spectroscopy measurement.
Fetches the central readout frequency for the targeted qubit directly from the active SessionContext’s device, applying a state-dependent shift, and generating a linear space around it.
- Parameters:
qubit (str) – The name of the target qubit (e.g., ‘q16’).
state (int) – The target qubit state (0 for ground, 1 for first excited, etc.).
samples (Optional[int]) – Number of points in the sweep. Defaults to 100 if None.
half_width (Optional[float]) – The half-width of the sweep window in Hz. Defaults to 1 MHz if None.
- Returns:
A linear array of frequencies to sweep.
- Return type:
np.ndarray
- Raises:
KeyError – If the qubit is not found in the device.
- bragi_quantum.experiments.utils.samplespace.qubit_samples(qubit, transition='01', samples=None, half_width=None, use_freq_12_from_config=None)[source]#
Dynamically generates the frequency sweep array for a qubit spectroscopy measurement.
Fetches the central transition frequency for the targeted qubit directly from the active SessionContext’s device, applying detuning logic for higher transitions.
- Parameters:
qubit (str) – The name of the target qubit (e.g., ‘q16’).
transition (str) – The target transition (‘01’ or ‘12’). Defaults to ‘01’.
samples (Optional[int]) – Number of points in the sweep. Defaults to 100 if None.
half_width (Optional[float]) – The half-width of the sweep window in Hz. Defaults to 5 MHz if None.
use_freq_12_from_config (Optional[bool]) – If True, attempts to use explicit f12 from config.
- Returns:
A linear array of frequencies to sweep.
- Return type:
np.ndarray
- Raises:
ValueError – If an unknown transition is provided.
KeyError – If the qubit is not found in the device.
- bragi_quantum.experiments.utils.schedule_execution.execute_schedule(compiled_schedule, hardware_agent, *, execution_mode, measurement=(0, 1), data_path=None, cluster_names=None, save_cluster_metadata_to_disk=False)[source]#
- bragi_quantum.experiments.utils.timing.timed(label, suffix_fn=None, timing_category=None, timing_trace_args=None)[source]#
Context manager that logs the wall-clock duration of the wrapped block.
Also records this span into the active session’s Chrome/Perfetto timing trace (
timing_trace_events.json), on top of the human-readable log line.Usage:
with timed("Measurement took: "): hardware_agent.run(compiled_schedule)
Pass
suffix_fnto append a string computed from the elapsed time:with timed("Measurement took: ", suffix_fn=lambda d: f" ({d - expected:+.5g} sec)"): thread_lab.join()
Pass
timing_category(timing categories defined inbragi_quantum.datalayer.managing.time_tracing) to bucket it under one of the four named categories; defaults toTIMING_OTHERif not specified.
- pydantic model bragi_quantum.experiments.utils.validators.SimpleSamplespace[source]#
Bases:
RootModel
- pydantic model bragi_quantum.experiments.utils.validators.MixedSamplespace[source]#
Bases:
RootModel
- pydantic model bragi_quantum.experiments.utils.validators.Samplespace[source]#
Bases:
RootModel- field root: SimpleSamplespace | MixedSamplespace [Required]#
- pydantic model bragi_quantum.experiments.utils.validators.BatchedArray[source]#
Bases:
RootModel- Fields:
- pydantic model bragi_quantum.experiments.utils.validators.SimpleArray[source]#
Bases:
RootModel- Fields:
- pydantic model bragi_quantum.experiments.utils.validators.Array[source]#
Bases:
RootModel- field root: BatchedArray | SimpleArray [Required]#
- bragi_quantum.experiments.utils.validators.get_number_of_batches(samplespace)[source]#
if the samplespace is a list of NDarrays, return the number of individual arrays per qubit