spin_pulse.characterization.ramsey¶
Helper functions to carry out Ramsey experiments.
Functions¶
|
Construct a pulse-level Ramsey experiment. |
|
Compute the population contrast of a Ramsey experiment. |
|
Compute the average Ramsey contrast over multiple noise realizations. |
Module Contents¶
- spin_pulse.characterization.ramsey.get_ramsey_circuit(duration, hardware_specs, exp_env=None)[source]¶
Construct a pulse-level Ramsey experiment.
This function builds a single-qubit Ramsey sequence consisting of a Hadamard gate, an idle period of a specified duration, and a second Hadamard gate. The circuit is transpiled into the hardware native gate set and converted into a PulseCircuit. If an experimental environment is provided, noise time traces are attached to the resulting pulse-level circuit.
- Parameters:
duration (int) – Duration of the free-evolution period (in the discrete time unit used by the hardware model).
hardware_specs (HardwareSpecs) – Hardware configuration used to transpile the logical Ramsey sequence into native instructions, and to generate the pulse sequences of the PulseCircuit.
exp_env (ExperimentalEnvironment | None) – Optional noise environment from which time traces are created and attached to the PulseCircuit.
- Returns:
Pulse-level representation of the Ramsey experiment, optionally including noise time traces.
- Return type:
- spin_pulse.characterization.ramsey.get_contrast(pulse_circuit)[source]¶
Compute the population contrast of a Ramsey experiment.
The pulse-level circuit is converted back to a unitary qiskit.QuantumCircuit, and the resulting unitary matrix is applied to the input state 0. The contrast is defined as the population difference between state 0 and state 1, that is: C = P0 - P1
- Parameters:
pulse_circuit (PulseCircuit) – Pulse-level Ramsey circuit.
- Returns:
Population contrast.
- Return type:
- spin_pulse.characterization.ramsey.get_average_ramsey_contrast(hardware_specs, exp_env, durations)[source]¶
Compute the average Ramsey contrast over multiple noise realizations.
For each free-evolution duration given, a Ramsey pulse circuit is constructed and its population contrast is computed by averaging over multiple noise realizations drawn from the experimental environment. After each duration, the environment time traces are regenerated to ensure independence between samples.
- Parameters:
hardware_specs (HardwareSpecs) – Hardware configuration used to construct pulse-level Ramsey circuits.
exp_env (ExperimentalEnvironment) – Noise environment providing time traces for each sample.
durations (list[int]) – List of free-evolution durations for which the Ramsey contrast is evaluated.
- Returns:
- Array containing the average Ramsey contrast for each
duration in
durations.
- Return type:
np.ndarray