Experiments

The experiments subpackage includes convenience classes to implement common quantum protocols.

keysight.qcs.experiments.BaseExperiment

A class enabling convenient execution of programs on hardware and analysis of the results.

keysight.qcs.experiments.CalibrationExperiment

A class enabling the calibration of an operation specified in the calibration set.

keysight.qcs.experiments.DispersiveShift

Initializes an experiment to determine the dispersive shift of the resonant frequencies of the readout resonators associated with qubits.

keysight.qcs.experiments.DynamicalDecouplingExperiment

A class representing a dynamical decoupling experiment on single qubits.

keysight.qcs.experiments.EchoExperiment

Initializes a Hahn echo experiment to characterize the decoherence time of the system.

keysight.qcs.experiments.ErrorAmplification

Initializes an Error Amplification experiment, which consists of a sequence of pairs of X gates, with varying amplitude between sweeps.

keysight.qcs.experiments.Experiment

A class enabling convenient execution of programs on hardware and analysis of the results.

keysight.qcs.experiments.IQDistributionExperiment

Initializes an IQ Distribution experiment to measure the ground and excited states by preparing each in turn.

keysight.qcs.experiments.QubitSpectroscopy

Initializes a qubit spectroscopy experiment to measure the resonant frequencies of qubits.

keysight.qcs.experiments.RabiExperiment

Initializes a Rabi experiment to measure the Rabi oscillations between ground and excited state populations by varying the amplitude of the drive signal.

keysight.qcs.experiments.RamseyExperiment

Initializes a Ramsey experiment to measure the relaxation time of a qubit.

keysight.qcs.experiments.ResonatorSpectroscopy

Initializes an experiment to measure the resonant frequencies of the readout cavities associated with qubits.

keysight.qcs.experiments.ResonatorSpectroscopy2D

Initializes an experiment to measure the resonant frequencies of the readout resonators associated with qubits while varying the amplitude of the readout pulse.

keysight.qcs.experiments.T1Experiment

Initializes an experiment to measure the relaxation time of a qubit system.

keysight.qcs.experiments.make_calibration_set

Returns a CalibrationSet that is compatible with pre-defined Experiments.

Experiments

class keysight.qcs.experiments.BaseExperiment(backend: ChannelMapper | HclBackend | Path | str, calibration_set: CalibrationSet | Path | str, name: str | None = None, save_path: str | Path | None = None)

Bases: Serializable

A class enabling convenient execution of programs on hardware and analysis of the results.

Parameters:
  • backend – The backend to run the experiment on, or a channel mapper used to construct the backend.

  • calibration_set – The calibration of the system.

  • name – The name of the experiment.

  • save_path – The path to save the experiment to.

property backend: HclBackend

The backend to run the experiment on.

property calibration_set: CalibrationSet

The calibration of the system.

property history: list[str]

A list of the time stamps at which the experiment has been run.

property name: str

Name of the experiment.

property save_path: Path | None

The folder experiments are saved in.

class keysight.qcs.experiments.CalibrationExperiment(backend: ChannelMapper | HclBackend | Path | str, calibration_set: CalibrationSet | Path | str, qudits: Qudits | MultiQudits, program: Program, operation: str, fitter: BaseFitter | None = None, pre_processor: Preprocessor | None = None, name: str | None = None, save_path: str | Path | None = None)

Bases: Experiment

A class enabling the calibration of an operation specified in the calibration set.

In addition to sweeping variables on the program, this class allows for and handles sweeping and indexing variables contained on the ParameterizedLinkerfor the given operation.

Parameters:
  • backend – The backend to run the experiment on, or a channel mapper used to construct the backend.

  • calibration_set – The calibration of the system.

  • qudits – A subset of the calibration_set’s targets to calibrate the operation on.

  • program – The program to run.

  • operation – The operation to calibrate, specified as a string. A linker with the same name must exist in the calibration_set to compile this operation.

  • fitter – The fitter to fit the experimental data to.

  • pre_processor – A Preprocessor to apply to the data before fitting.

  • name – The name of the experiment.

  • save_path – The path to save the experiment to.

Raises:

ValueError – If the specified operation does not exist in the calibration_set.

property idx: int | list[int]

The index of the targets in this experiment.

property linker: BaseLinker

The linker to calibrate.

get_updated_calibration_values(timestamp: str | int | None = None) dict[str, float | Iterable[float]]

Calculates the new values for the calibration variable(s) of this experiment.

Parameters:

timestamp – The timestamp of the program to use in fitting. By default, fits the most recent program.

set_updated_calibration_values(values: dict[str, float | Iterable[float]] | None = None, timestamp: str | int | None = None)

Update the calibration set with new values.

Parameters:

values – The new values to update the calibration set with. The dictionary keys need to match the names of actual variables in the calibration set, and the idx attribute of this class determines which values get updated.

class keysight.qcs.experiments.DispersiveShift(backend: ChannelMapper | HclBackend | Path | str, calibration_set: CalibrationSet | Path | str, qubits: Qudits, frequencies: Iterable[float] | Array[float] | np.ndarray | None = None, fitter: BaseFitter | None = None, n_shots: int = 500, frequency_name: str = 'readout_frequencies', name: str | None = 'DispersiveShift', save_path: str | Path | None = None)

Bases: Experiment

Initializes an experiment to determine the dispersive shift of the resonant frequencies of the readout resonators associated with qubits.

The program in this experiment consists of two scenarios. Either an X gate is applied to initialize the qubit in the excited state, shifting the readout resonator frequency, or no pulse is applied. In both cases a measurement is applied subsequently with varying readout frequency to perform a spectroscopy.

Parameters:
  • backend – The backend to run the experiment on, or a channel mapper used to construct the backend.

  • calibration_set – The calibration of the system.

  • qubits – The qubits to perform the experiment on.

  • frequencies – The frequencies to sweep over.

  • n_shots – The number of times to repeat the program.

  • fitter – The fitter model for post-processing.

  • frequency_name – The name of the frequency variable on linker to sweep.

  • name – The name of the experiment.

  • save_path – The path to save the experiment to.

configure_repetitions(x_amplitudes: Array[float], frequencies: Iterable[float] | Array[float] | np.ndarray, n_shots: int = 100, hw_sweep: bool = True, frequency_name: str = 'readout_frequencies')

Configures the repetitions of this experiment.

Parameters:
  • frequencies – The frequencies to sweep over.

  • x_amplitudes – The amplitude of the applied X gate.

  • n_shots – The number of times to repeat the program.

  • hw_sweep – Whether to perform the sweep on hardware.

  • frequency_name – The name of the frequency variable on the measurement linker to sweep.

class keysight.qcs.experiments.DynamicalDecouplingExperiment(backend: ChannelMapper | HclBackend | Path | str, calibration_set: CalibrationSet | Path | str, qubits: Qudits, total_duration: float | Variable, sequence_type: SequenceType = SequenceType.CPMG, number_of_pulses: int | None = None, pulse_interval: float | Variable | None = None, pulse_operation: BaseOperation | Iterable[BaseOperation] = Gate(matrix=[[0j, 1 + 0j], [1 + 0j, 0j]], name=X), enforce_even_pulse_number: bool = True, n_shots: int = 100, name: str = 'DecouplingExperiment', save_path: str | Path | None = None)

Bases: Experiment

A class representing a dynamical decoupling experiment on single qubits.

Parameters:
  • backend – The backend to run the experiment on, or a channel mapper used to construct the backend.

  • calibration_set – The calibration of the system.

  • total_duration – The total duration of the decoupling sequence in seconds.

  • sequence_type – The type of dynamical decoupling sequence to use.

  • number_of_pulses – The number of pulses to insert into the sequence if applicable. Note that only even numbers of pulses will result in preservation of the original qubit state.

  • pulse_interval – The delay in seconds to insert between pulses.

  • pulse_operation – Which operations to perform as decoupling pulses.

  • n_shots – The number of times to repeat the program.

  • name – The name of the experiment. Defaults to DecouplingExperiment.

  • save_path – The path to save the experiment to.

Qubits:

The qubits to perform the experiment on.

class keysight.qcs.experiments.EchoExperiment(backend: ChannelMapper | HclBackend | Path | str, calibration_set: CalibrationSet | Path | str, qubits: Qudits, delays: Iterable[float] | Array[float] | np.ndarray | None = None, n_shots: int = 500, fitter: BaseFitter | None = <keysight.qcs.analysis.fitter.Exponential object>, name: str | None = 'EchoExperiment', save_path: str | Path | None = None)

Bases: Experiment

Initializes a Hahn echo experiment to characterize the decoherence time of the system.

The program in this experiment consists of three pulses spaced out equally by a variable delay time. The first X90 gate initializes the system in the equator of the Bloch sphere, where it starts dephasing. An X gate is applied in order to refocus the system back to its initial state, if it has not decayed yet. A final X90 gate is applied, followed by a measurement.

Parameters:
  • backend – The backend to run the experiment on, or a channel mapper used to construct the backend.

  • calibration_set – The calibration of the system.

  • qubits – The qubits to perform the experiment on.

  • delays – The time delay between pulses to sweep over.

  • n_shots – The number of times to repeat the program.

  • fitter – The fitter model for post-processing.

  • name – The name of the experiment.

  • save_path – The path to save the experiment to.

configure_repetitions(delays: Iterable[float] | Array[float] | np.ndarray, n_shots: int = 500, hw_sweep: bool = True) None

Configures the repetitions of this experiment.

Parameters:
  • delays – The time delay between pulses to sweep over.

  • n_shots – The number of times to repeat the program.

  • hw_sweep – Whether to perform the sweep on hardware.

class keysight.qcs.experiments.ErrorAmplification(backend: ChannelMapper | HclBackend | Path | str, calibration_set: CalibrationSet | Path | str, qubits: Qudits, amplitudes: Iterable[float] | Array[float] | np.ndarray | None = None, amplitude_name: str = 'x180_pulse_amplitudes', n_amplifications: int = 5, n_shots: int = 100, fitter: BaseFitter | None = None, name: str | None = 'ErrorAmplification', save_path: str | Path | None = None)

Bases: Experiment

Initializes an Error Amplification experiment, which consists of a sequence of pairs of X gates, with varying amplitude between sweeps.

When the amplitude is not precise, the rotation is not perfect and a pair of pulses does not get the system back to its initial state. Increasing the number of pairs accumulates the errors and increases the deviation, making it more prominent to the user.

Parameters:
  • backend – The backend to run the experiment on, or a channel mapper used to construct the backend.

  • calibration_set – The calibration of the system.

  • qubits – The qubits to perform the experiment on.

  • amplitudes – The pulse amplitudes to sweep over.

  • amplitude_name – The name in the calibration set of the amplitude variable of the operation to sweep.

  • n_amplifications – The maximum number of pairs of drive signals sent.

  • n_shots – The number of times to repeat the program.

  • fitter – The fitter model for post-processing.

  • name – The name of the experiment.

  • save_path – The path to save the experiment to.

amplitude_to_angle(amplitudes: Iterable[float] | Array[float] | np.ndarray, amplitude_name: str = 'x180_pulse_amplitudes')

Converts input amplitude array into angles before intializing the X rotation gates. This is required as PAULIS.rx only takes angles in its definition in make_calibration_set().

Parameters:
  • amplitude – The amplitudes to sweep over.

  • amplitude_name – The name in the calibration set of the amplitude variable of the operation to sweep.

configure_repetitions(amplitudes: Iterable[float] | Array[float] | np.ndarray, amplitude_name: str = 'x180_pulse_amplitudes', n_shots: int = 100, hw_sweep: bool = True) None

Configures the repetitions of this experiment.

Parameters:
  • amplitudes – The amplitudes to sweep over.

  • n_shots – The number of times to repeat the program.

  • hw_sweep – Whether to perform the sweep on hardware.

generate_pulse_sequence_matrix() Array[int]

Generates an array containing the sequences of pairs of pi pulses to sweep over.

For instance, with n_amplifications = 3, this returns

\[\begin{split}\begin{bmatrix} 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 1 & 1 \\ 0 & 0 & 1 & 1 & 1 & 1 \\ 1 & 1 & 1 & 1 & 1 & 1 \end{bmatrix}\end{split}\]

where 0 and 1 represent whether a pulse is sent or not.

class keysight.qcs.experiments.Experiment(backend: ChannelMapper | HclBackend | Path | str, calibration_set: CalibrationSet | Path | str, targets: Targets, program: Program, fitter: BaseFitter | None = None, pre_processor: Preprocessor | None = None, name: str | None = None, save_path: str | Path | None = None)

Bases: BaseExperiment

A class enabling convenient execution of programs on hardware and analysis of the results.

Parameters:
  • backend – The backend to run the experiment on, or a channel mapper used to construct the backend.

  • calibration_set – The calibration of the system.

  • targets – The targets of the experiment.

  • program – The program to run.

  • fitter – The fitter to fit the experimental data to.

  • pre_processor – A Preprocessor to apply to the data before fitting.

  • name – The name of the experiment.

  • save_path – The path to save the experiment to.

property accession_ids: dict[str, str]

A dictionary of timestamps to accession ids.

property compiled_program: Program

The program expressed as hardware operations.

property fitter: BaseFitter | None

The fitter for the experimental data.

property fitted_parameters: EstimateCollection

The fitted parameters for the experimental data.

property pre_processor: Preprocessor | None

The pre-processor for the experimental data, to be applied before fitting.

property idx: int | list[int]

The index of the targets in this experiment.

property program: Program

The program to be run.

property targets: Targets

The targets of this experiment.

configure_repetitions(n_shots: int, hw_sweep: bool, **kwargs) None

Configures the repetitions of this experiment.

Parameters:
  • n_shots – The number of times to repeat the program.

  • hw_sweep – Whether to perform the sweep on hardware.

  • kwargs – Any keyword arguments representing a variable and its sweep.

draw(filename: str = 'qcs_program.html', display: bool = True) None

Creates a HTML representation of this Program and saves it to a file.

Parameters:
  • filename – The filename to write the HTML to (if executing in a script).

  • display – Whether to display the HTML. When set to False, this will only save the file to the specified filename.

execute(hw_demod: bool | None = None, auto_save: bool = False) None

Execute the program on hardware.

Parameters:
  • hw_demod – Whether or not to demodulate trace data directly in hardware. If set, it will temporarily override the value of self.backend.hw_demod.

  • auto_save – Whether to save the experiment as a .qcs file.

Raises:

ValueError – If auto_save is True but no save_path has been set.

get_classified(channels: Channels | Qudits | None = None, avg: bool | int = False, stack_channels: bool = False, classifier: MinimumDistanceClassifier | None = None, integration_filter: IntegrationFilter | None = None, timestamp: str | int | None = None, acq_index: int = -1) pd.DataFrame

Get the classified data for specified channels or qudits.

Parameters:
  • channels – The channels or qudits to get the data for.

  • avg – Whether to average the data or the axis to average it over. Setting avg=True will average over the last axis.

  • stack_channels – Whether to stack the channel index as rows.

  • classifier – An optional classifier to classify the IQ data.

  • integration_filter – An optional integration filter to generate IQ data from trace data.

  • timestamp – The timestamp created when the program was run, or an integer referring to a timestamp index in the experiment’s history.

  • acq_index – The index of the acquisition to get. Default -1 returns the last acquisition, None returns all acquisitions.

Raises:

TypeError – If stack_channels is True but the installed pandas version is below 2.1.

fit(x_values: np.ndarray, channels: Channels | Qudits | None = None, avg: bool | int = True, timestamp: str | int | None = None, data_type: str = 'iq') EstimateCollection

Fits the data from the experiment.

Parameters:
  • x_values – The independent data for the fit.

  • channels – The channels or qudits to pull the data from.

  • avg – Whether to average the data.

  • timestamp – The timestamp of the program to use in fitting. By default, fits the most recent program.

  • data_type – What type of data to fit. Valid options are classified, iq, or trace.

Raises:
  • ValueError – If this experiment has no fitter.

  • ValueError – If data_type is not one of classified, iq, or trace.

  • ValueError – If x_values and the data are incompatible shapes.

plot(x_values: np.ndarray, channels: Channels | Qudits | None = None, avg: bool | int = True, timestamp: str | int | None = None, data_type: str = 'iq', x_axis_label: str | None = None, y_axis_label: str | None = None) go.Figure

Plots the Experiment’s data and fit (if applicable). Defaults to plotting I/Q data if no Preprocessor or Fitter has been defined, and to trace data if no I/Q data exists.

Parameters:
  • x_values – The independent data for the fit.

  • channels – The channels or qudits to pull the data from.

  • avg – Whether to average the data.

  • timestamp – The timestamp of the program to use in fitting. By default, fits the most recent program.

  • data_type – What type of data to fit. Valid options are classified, iq, or trace.

Raises:

ValueError – If data_type is not one of classified, iq, or trace.

get_iq(channels: Channels | Qudits | None = None, avg: bool | int = False, stack_channels: bool = False, integration_filter: IntegrationFilter | None = None, timestamp: str | int | None = None, acq_index: int = -1) pd.DataFrame

Get the IQ data.

Parameters:
  • channels – The channels or qudits to get the data for.

  • avg – Whether to average the data or the axis to average it over. Setting avg=True will average over the last axis.

  • stack_channels – Whether to stack the channel index as rows.

  • integration_filter – An optional integration filter to generate IQ data from trace data.

  • timestamp – The timestamp created when the program was run, or an integer referring to a timestamp index in the experiment’s history.

  • acq_index – The index of the acquisition to get. Default -1 returns the last acquisition, None returns all acquisitions.

get_spectrum(channels: Channels | Qudits | None = None, avg: bool | int = False, window: None | Callable[[int], np.ndarray] | np.ndarray | Iterable[np.ndarray] = None, pad: None | int = None, timestamp: str | int | None = None) pd.DataFrame

Get the power spectrum of the trace data for specified channels or qudits using the discrete Fourier transform.

Parameters:
  • channels – The channels or qudits to get the data for.

  • avg – Whether to average the data or the axis to average it over. Setting avg=True will average over the last axis.

  • window – An optional window function to multiply the trace data with before calculating the Fourier transfrom.

  • pad – Whether to pad the traces with zeros before taking the Fourier transform. If an integer n is passed, the traces will be cropped or extended (with zeros) to length n depending on the length of the traces.

  • timestamp – The timestamp created when the program was run, or an integer referring to a timestamp index in the experiment’s history.

Raises:

ValueError – If program was executed with hardware demodulation.

get_trace(channels: Channels | Qudits | None = None, avg: bool | int = False, timestamp: str | int | None = None) pd.DataFrame

Get the trace data for specified channels or qudits.

Parameters:
  • channels – The channels or qudits to get the data for.

  • avg – Whether to average the data or the axis to average it over. Setting avg=True will average over the last axis.

  • timestamp – The timestamp created when the program was run, or an integer referring to a timestamp index in the experiment’s history.

Raises:

ValueError – If program was executed with hardware demodulation.

plot_iq(channel_subplots: bool = True, avg: bool | int = True, plot_type: str = 'linear', plot_axis: int = 0, group_scatter: bool = True, channels: Channels | None = None, timestamp: str | int | None = None) go.Figure

Plots the IQ data.

Parameters:
  • channel_subplots – Whether to generate subplots for different channels.

  • avg – Whether to average the data or the axis to average it over. Setting avg=True will average over the last axis.

  • plot_type – Whether to plot the I/Q data as a linear plot or a scatter plot.

  • plot_axis – The axis of the dataframe over which to plot the IQ data.

  • group_scatter – Groups scatter points using the same color and markers.

  • channels – Which channels to plot. Defaults to all channels.

  • timestamp – The timestamp created when the program was run, or an integer referring to a timestamp index in the experiment’s history.

Raises:

ValueError – When the plot_axis is out of bounds.

plot_spectrum(channel_subplots: bool = True, avg: bool | int = True, window: None | Callable[[int], np.ndarray] | np.ndarray | Iterable[np.ndarray] = None, pad_zeros: bool | int | Iterable[int] = True, channels: Channels | None = None, timestamp: str | int | None = None) go.Figure

Plots the power spectrum of the trace data.

Parameters:
  • channel_subplots – Whether to generate subplots for different channels.

  • avg – Whether to average the data or the axis to average it over. Setting avg=True will average over the last axis.

  • window – An optional window function to multiply the trace data with before calculating the Fourier transfrom.

  • pad_zeros – Whether to pad the traces with zeros to interpolate the spectrum. The default value True will pad each trace to 5x the trace length. If an integer or a list of integers is passed, each trace will be padded (or truncated) to that number.

  • channels – Which channels to plot. Defaults to all channels.

  • timestamp – The timestamp created when the program was run, or an integer referring to a timestamp index in the experiment’s history.

plot_trace(channel_subplots: bool = True, avg: bool | int = True, channels: Channels | None = None, timestamp: str | int | None = None) go.Figure

Plots the trace data.

Parameters:
  • channel_subplots – Whether to generate subplots for different channels.

  • avg – Whether to average the data or the axis to average it over. Setting avg=True will average over the last axis.

  • channels – Which channels to plot. Defaults to all channels.

  • timestamp – The timestamp created when the program was run, or an integer referring to a timestamp index in the experiment’s history.

plot_classified(acq_index: int = -1, channel_subplots: bool = True, channels: Channels | None = None, sweep_index: int | tuple[int] | None = None, timestamp: str | None = None) go.Figure

Plots the Classified data.

Parameters:
  • acq_index – The index of the acquisition to get. Default -1 returns the last acquisition.

  • channel_subplots – Whether to generate subplots for different channels.

  • channels – Which channels to plot. Defaults to all channels.

  • sweep_index – The sweep point to plot. For nested sweeps, provide the index as a tuple where the leftmost index is the outermost sweep.

  • timestamp – The timestamp created when the program was run.

render(channel_subplots: bool = True, channels: Channels | Iterable[Channels] | None = None, lo_frequency: float = 0.0, sample_rate: float = 1000000000.0, plot_imaginary: bool = False, sweep_index: int | tuple[int] | None = None) go.Figure

Renders the waveforms in this program with the current values of variables or, if this program has sweeps, the value at the sweep point specified by sweep_idx, with a value of None corresponding to the first sweep point their values at the first sweep point.

Parameters:
  • channel_subplots – Whether to split each channel into its own subplot.

  • channels – The channels to include when rendering waveforms. If None, all channels on the program are included.

  • lo_frequency – The LO frequency used to render, in case the given mapper does not specify one for the channels being plotted.

  • sample_rate – The sample rate used to render, in case the given mapper does not specify one for the channels being plotted.

  • plot_imaginary – Whether to render the imaginary part of the waveforms. This option is included because the imaginary portion is often zero and omitting it reduces the time required to render by half.

  • sweep_index – The sweep point to render. For nested sweeps, provide the index as a tuple where the leftmost index is the outermost sweep.

Raises:

ValueError – If the sweep_index is out of bounds for this program’s repetitions.

class keysight.qcs.experiments.IQDistributionExperiment(backend: ChannelMapper | HclBackend | Path | str, calibration_set: CalibrationSet | Path | str, qubits: Qudits, n_shots: int = 100, name: str = 'IQDistribution', save_path: str | Path | None = None)

Bases: Experiment

Initializes an IQ Distribution experiment to measure the ground and excited states by preparing each in turn.

The program in this class consists of a parametric sequence consisting of a X(angle) pulse followed by a measurement. The program is executed for angle values of 0 and 180 degrees.

Parameters:
  • backend – The backend to run the experiment on, or a channel mapper used to construct the backend.

  • calibration_set – The calibration of the system.

  • qubits – The qubits to perform the experiment on.

  • n_shots – The number of times to repeat the program.

  • name – The name of the experiment. Defaults to IQDistribution.

  • save_path – The path to save the experiment to.

configure_repetitions(n_shots: int = 100, hw_sweep: bool = True) None

Configures the repetitions (sweeps and shots) of this experiment.

Parameters:
  • n_shots – The number of times to repeat the program.

  • hw_sweep – Whether to perform the sweep in hardware (requires hw_demod=True on the backend).

class keysight.qcs.experiments.QubitSpectroscopy(backend: ChannelMapper | HclBackend | Path | str, calibration_set: CalibrationSet | Path | str, qubits: Qudits, frequencies: Iterable[float] | Array[float] | np.ndarray | None = None, n_shots: int = 100, operation: str = 'x', frequency_name: str = 'xy_pulse_frequencies', name: str | None = 'QubitSpectroscopy', save_path: str | Path | None = None)

Bases: CalibrationExperiment

Initializes a qubit spectroscopy experiment to measure the resonant frequencies of qubits.

Parameters:
  • backend – The backend to run the experiment on, or a channel mapper used to construct the backend.

  • calibration_set – The calibration of the system.

  • qubits – The qubits to perform the experiment on.

  • frequencies – The frequencies to sweep over.

  • operation – The operation to calibrate, specified as a string. A linker with the same name must exist in the calibration_set to compile this operation.

  • frequency_name – The name of the frequency variable on the operation to sweep.

  • name – The name of the experiment.

  • save_path – The path to save the experiment to.

configure_repetitions(frequencies: Iterable[float] | Array[float] | ndarray, n_shots: int = 100, hw_sweep: bool = True, frequency_name: str = 'xy_pulse_frequencies')

Configures the repetitions of this experiment.

Parameters:
  • frequencies – The frequencies to sweep over.

  • n_shots – The number of times to repeat the program.

  • hw_sweep – Whether to perform the sweep on hardware.

  • frequency_name – The name of the frequency variable on the operation to sweep.

fit(x_values: np.ndarray | None = None, qudits: Qudits | None = None, timestamp: str | int | None = None) EstimateCollection

Fits the Qubit spectroscopy experiment data.

Parameters:
  • qudits – The qudits to pull the data from.

  • timestamp – The timestamp of the program to use in fitting. By default, fits the most recent program.

get_updated_calibration_values(timestamp: str | int | None = None) dict[str, float | Iterable[float]]

Calculates the new values for the calibration variable(s) of this experiment.

Parameters:

timestamp – The timestamp of the program to use in fitting. By default, fits the most recent program.

plot(qudits: Qudits | None = None, timestamp: str | int | None = None) go.Figure

Plots the pre-processed and fitted data.

Parameters:
  • qudits – The qudits to pull the data from.

  • timestamp – The timestamp of the program to use in fitting. By default, fits the most recent program.

class keysight.qcs.experiments.RabiExperiment(backend: ChannelMapper | HclBackend | Path | str, calibration_set: CalibrationSet | Path | str, qubits: Qudits, amplitudes: Iterable[float] | Array[float] | ndarray | None = None, n_shots: int = 100, operation: str = 'x', amplitude_name: str = 'x180_pulse_amplitudes', name: str | None = 'RabiExperiment', save_path: str | Path | None = None)

Bases: CalibrationExperiment

Initializes a Rabi experiment to measure the Rabi oscillations between ground and excited state populations by varying the amplitude of the drive signal.

The program in this experiment consists of a variable amplitude X pulse followed by a measurement.

Parameters:
  • backend – The backend to run the experiment on, or a channel mapper used to construct the backend.

  • calibration_set – The calibration of the system.

  • qubits – The qubits to perform the experiment on.

  • amplitudes – The amplitudes to sweep over.

  • n_shots – The number of times to repeat the program.

  • operation – The operation to calibrate, specified as a string. A linker with the same name must exist in the calibration_set to compile this operation.

  • amplitude_name – The name of the amplitude variable in the calibration_set that is used by the specified operation.

  • name – The name of the experiment.

  • save_path – The path to save the experiment to.

configure_repetitions(amplitudes: Iterable[float] | Array[float] | ndarray, n_shots: int = 100, amplitude_name: str = 'x180_pulse_amplitudes', hw_sweep: bool = True) None

Configures the repetitions of this experiment.

Parameters:
  • amplitudes – The amplitudes to sweep over.

  • n_shots – The number of times to repeat the program.

  • amplitude_name – The name of the amplitude variable on the operation to sweep.

  • hw_sweep – Whether to perform the sweep on hardware.

fit(x_values: np.ndarray | None = None, qudits: Qudits | None = None, timestamp: str | int | None = None) EstimateCollection

Fits the Rabi experiment data.

Parameters:
  • qudits – The qudits to pull the data from.

  • timestamp – The timestamp of the program to use in fitting. By default, fits the most recent program.

get_updated_calibration_values(timestamp: str | int | None = None) dict[str, float | Iterable[float]]

Calculates the new values for the calibration variable(s) of this experiment.

Parameters:

timestamp – The timestamp of the program to use in fitting. By default, fits the most recent program.

plot(qudits: Qudits | None = None, timestamp: str | int | None = None) go.Figure

Plots the pre-processed and fitted data.

Parameters:
  • qudits – The qudits to pull the data from.

  • timestamp – The timestamp of the program to use in fitting. By default, fits the most recent program.

class keysight.qcs.experiments.RamseyExperiment(backend: ChannelMapper | HclBackend | Path | str, calibration_set: CalibrationSet | Path | str, qubits: Qudits, delays: Iterable[float] | Array[float] | np.ndarray | None = None, n_shots: int = 100, name: str | None = 'RamseyExperiment', save_path: str | Path | None = None)

Bases: Experiment

Initializes a Ramsey experiment to measure the relaxation time of a qubit.

The program in this class consists of two X90 gates separated by a variable delay.

Parameters:
  • backend – The backend to run the experiment on, or a channel mapper used to construct the backend.

  • calibration_set – The calibration of the system.

  • qubits – The qubits to perform the experiment on.

  • delays – The delays to sweep over.

  • n_shots – The number of times to repeat the program.

  • name – The name of the experiment.

  • save_path – The path to save the experiment to.

configure_repetitions(delays: Iterable[float] | Array[float] | np.ndarray, n_shots: int = 100, hw_sweep: bool = True) None

Configures the repetitions of this experiment.

Parameters:
  • delays – The delays to sweep over.

  • n_shots – The number of times to repeat the program.

  • hw_sweep – Whether to perform the sweep on hardware.

class keysight.qcs.experiments.ResonatorSpectroscopy(backend: ChannelMapper | HclBackend | Path | str, calibration_set: CalibrationSet | Path | str, qubits: Qudits, frequencies: Iterable[float] | Array[float] | ndarray | None = None, n_shots: int = 100, operation: str = 'measurement', frequency_name: str = 'readout_frequencies', name: str | None = 'ReadoutSpectroscopy', save_path: str | Path | None = None)

Bases: CalibrationExperiment

Initializes an experiment to measure the resonant frequencies of the readout cavities associated with qubits.

Parameters:
  • backend – The backend to run the experiment on, or a channel mapper used to construct the backend.

  • calibration_set – The calibration of the system.

  • qubits – The qubits to perform the experiment on.

  • frequencies – The frequencies to sweep over.

  • n_shots – The number of times to repeat the program.

  • operation – The operation to calibrate, specified as a string. A linker with the same name must exist in the calibration_set to compile this operation.

  • frequency_name – The name of the frequency variable on the operation to sweep.

  • name – The name of the experiment.

  • save_path – The path to save the experiment to.

configure_repetitions(frequencies: Iterable[float] | Array[float] | ndarray, n_shots: int = 100, hw_sweep: bool = False, frequency_name: str = 'readout_frequencies')

Configures the repetitions of this experiment.

Parameters:
  • frequencies – The frequencies to sweep over.

  • n_shots – The number of times to repeat the program.

  • hw_sweep – Whether to perform the sweep on hardware.

  • frequency_name – The name of the frequency variable on the measurement to sweep.

fit(x_values: np.ndarray | None = None, qudits: Qudits | None = None, timestamp: str | int | None = None) EstimateCollection

Fits the Resonator spectroscopy experiment data.

Parameters:
  • qudits – The qudits to pull the data from.

  • timestamp – The timestamp of the program to use in fitting. By default, fits the most recent program.

get_updated_calibration_values(timestamp: str | int | None = None) dict[str, float | Iterable[float]]

Calculates the new values for the calibration variable(s) of this experiment.

Parameters:

timestamp – The timestamp of the program to use in fitting. By default, fits the most recent program.

plot(qudits: Qudits | None = None, timestamp: str | int | None = None) go.Figure

Plots the pre-processed and fitted data.

Parameters:
  • qudits – The qudits to pull the data from.

  • timestamp – The timestamp of the program to use in fitting. By default, fits the most recent program.

class keysight.qcs.experiments.ResonatorSpectroscopy2D(backend: ChannelMapper | HclBackend | Path | str, calibration_set: CalibrationSet | Path | str, qubits: Qudits, frequencies: Iterable[float] | Array[float] | ndarray | None = None, amplitudes: Iterable[float] | Array[float] | ndarray | None = None, n_shots: int = 100, operation: str = 'measurement', frequency_name: str = 'readout_frequencies', amplitude_name: str = 'readout_pulse_amplitudes', name: str | None = 'ReadoutSpectroscopy2D', save_path: str | Path | None = None)

Bases: CalibrationExperiment

Initializes an experiment to measure the resonant frequencies of the readout resonators associated with qubits while varying the amplitude of the readout pulse.

Parameters:
  • backend – The backend to run the experiment on, or a channel mapper used to construct the backend.

  • calibration_set – The calibration of the system.

  • qubits – The qubits to perform the experiment on.

  • frequencies – The resonator frequencies to sweep over.

  • amplitudes – The readout pulse amplitudes to sweep over.

  • n_shots – The number of times to repeat the program.

  • operation – The operation to calibrate, specified as a string. A linker with the same name must exist in the calibration_set to compile this operation.

  • frequency_name – The name of the frequency variable on the operation to sweep.

  • amplitude_name – The name of the amplitude variable on the operation to sweep.

  • name – The name of the experiment.

  • save_path – The path to save the experiment to.

configure_repetitions(frequencies: Iterable[float] | Array[float] | ndarray, amplitudes: Iterable[float] | Array[float] | ndarray, n_shots: int = 100, hw_sweep: bool = False, frequency_name: str = 'readout_frequencies', amplitude_name: str = 'readout_pulse_amplitudes')

Configures the repetitions of this experiment.

Parameters:
  • frequencies – The frequencies to sweep over.

  • amplitudes – The amplitudes to sweep over.

  • n_shots – The number of times to repeat the program.

  • hw_sweep – Whether to perform the sweep on hardware.

  • frequency_name – The name of the frequency variable on the measurement to sweep.

  • amplitude_name – The name of the amplitude variable on the measurement to sweep.

class keysight.qcs.experiments.T1Experiment(backend: ChannelMapper | HclBackend | Path | str, calibration_set: CalibrationSet | Path | str, qubits: Qudits, delays: Iterable[float] | Array[float] | np.ndarray | None = None, n_shots: int = 100, fitter: BaseFitter = <keysight.qcs.analysis.fitter.Exponential object>, name: str | None = 'T1Experiment', save_path: str | Path | None = None)

Bases: Experiment

Initializes an experiment to measure the relaxation time of a qubit system.

Parameters:
  • backend – The backend to run the experiment on, or a channel mapper used to construct the backend.

  • calibration_set – The calibration of the system.

  • qubits – The qubits to perform the experiment on.

  • delays – The delays to sweep over.

  • n_shots – The number of times to repeat the program.

  • name – The name of the experiment.

  • save_path – The path to save the experiment to.

configure_repetitions(delays: Iterable[float] | Array[float] | np.ndarray, n_shots: int = 100, hw_sweep: bool = True) None

Configures the repetitions of this experiment.

Parameters:
  • delays – The delays to sweep over.

  • n_shots – The number of times to repeat the program.

  • hw_sweep – Whether to perform the sweep on hardware.

keysight.qcs.experiments.make_calibration_set(qubits: int | Iterable[int] | Qudits = 10)

Returns a CalibrationSet that is compatible with pre-defined Experiments.

Parameters:

n_qubits – The number of qubits to generate a calibration set for.

On this page