Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cr sequences #994

Open
wants to merge 111 commits into
base: cross_resonance
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
f21b1a8
Idea: Phase delay correction on resonaor spectroscopy.
jevillegasd Jun 15, 2024
4e6274a
Phase dispersion correction for punchout
jevillegasd Jun 17, 2024
bb5ca9a
phase delay for resonator flux dependance
jevillegasd Jun 17, 2024
6f211fe
Add slope to background offset in lorentzian fit.
jevillegasd Jun 20, 2024
53bc9ab
fix: Fix T1 fit
andrea-pasquale Jun 14, 2024
695a084
fix: Make crosstalk test less restrictive
andrea-pasquale Jun 14, 2024
d0f4852
chore(deps): bump urllib3 from 2.2.1 to 2.2.2
dependabot[bot] Jun 17, 2024
681329f
different bounds in rabi signal
rodolfocarobene Jun 17, 2024
b76d4ec
feat: 2qrb with some inverse failing
Jacfomg Apr 30, 2024
2ff9751
fix on the gate names
Jacfomg May 2, 2024
0a1757e
fix the Z gates
Jacfomg May 2, 2024
42bb62b
fix: Single 2q cliffs find their inverse
Jacfomg May 3, 2024
c47174d
fix: transpiler
Jacfomg May 9, 2024
2983a1d
feat: 2qrb working prototype
Jacfomg May 9, 2024
e018ab5
fix: remove prints
Jacfomg May 9, 2024
14526d4
fix: some tests
Jacfomg May 9, 2024
af26120
fix: tests
Jacfomg May 9, 2024
71b149c
feat: files as params
Jacfomg May 9, 2024
e9da312
feat: inverse matrices file generation
Jacfomg May 9, 2024
255d9c4
feat: counting pulses draft
Jacfomg May 9, 2024
c4cfd2a
fix: improve cov
Jacfomg May 10, 2024
dac5eb7
fix: cov
Jacfomg May 10, 2024
0e18c5d
fix: post process survival probability
Jacfomg May 10, 2024
1e07990
feat: helper functions
Jacfomg May 10, 2024
fe51b38
feat: load_cliffords
Jacfomg May 13, 2024
561f832
fix: refactor 2qRB
Jacfomg May 22, 2024
e2ba218
fix: this shouldn't be here yet
Jacfomg May 22, 2024
03a5356
fix: reduce code duplication
Jacfomg May 22, 2024
62a62de
style: improve format
Jacfomg May 22, 2024
2110a53
docs: add docs
Jacfomg May 23, 2024
4b69506
refactor: simplify dict_utils
Jacfomg May 27, 2024
26a72df
fix: review
Jacfomg May 30, 2024
54ea707
unify execution pars for dispersive shift
rodolfocarobene Jun 19, 2024
8eb4083
fix: Fix bug in calculation of virtual phases
andrea-pasquale Aug 30, 2024
0bc8831
refactor: minor fixes
andrea-pasquale Aug 30, 2024
3dad308
fix: Modify ramsey update
andrea-pasquale Sep 4, 2024
5abc5d6
docs: write readout mitigation matrix docs
Edoardo-Pedicillo Sep 13, 2024
c8465e9
docs: write avoided crossing docs
Edoardo-Pedicillo Sep 13, 2024
695df02
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 13, 2024
b6bfeb7
docs: write readout optimization docs
Edoardo-Pedicillo Sep 13, 2024
861d279
Merge branch 'protocol_docs' of github.com:qiboteam/qibocal into prot…
Edoardo-Pedicillo Sep 13, 2024
1f3dd24
refactor: Improvements in state tomography
andrea-pasquale Sep 15, 2024
f9b5e4b
feat: Compute for all qubits using partial trace
andrea-pasquale Sep 16, 2024
f1db5c7
feat: Convert from qasm to raw
andrea-pasquale Sep 17, 2024
8597df3
Sequences (signal) version of the cross resoannce pulse legth calibra…
jevillegasd Sep 17, 2024
39292ed
Using non native pulses
jevillegasd Sep 19, 2024
7aea94e
add target setting
jevillegasd Sep 20, 2024
88d840e
Changes in pulse sequences of sweeping routines
jevillegasd Sep 21, 2024
a2707d5
Update docs
jevillegasdatTII Sep 21, 2024
585e758
refactor: improve readability
andrea-pasquale Sep 23, 2024
de9db23
refactor: Use None instead of 0 for detuning
andrea-pasquale Sep 24, 2024
1140079
refactor: Reduce code duplication in Ramsey experiments
andrea-pasquale Sep 24, 2024
fed7108
fix: Add back chi2 to Ramsey experiment
andrea-pasquale Sep 24, 2024
7d52484
doc: Update Ramsey doc
andrea-pasquale Sep 24, 2024
41baa99
Update doc/source/protocols/ramsey/ramsey.rst
andrea-pasquale Sep 24, 2024
4902a18
feat: Add detuning attribute
andrea-pasquale Sep 24, 2024
818be53
refactor: updating qq actions diagram
MatteoRobbiati Sep 24, 2024
52d4992
Updates in documentation and chevron frequency
jevillegasdatTII Sep 25, 2024
d0a4744
Merge pull request #986 from qiboteam/qq-diagram
andrea-pasquale Sep 26, 2024
7985fb1
docs: improve the readout optimization docs
Edoardo-Pedicillo Sep 26, 2024
a45c420
Merge pull request #972 from qiboteam/fix_2q_gates_protocols
andrea-pasquale Sep 27, 2024
b6a3a0a
Merge pull request #984 from qiboteam/refactor_tomography
andrea-pasquale Sep 27, 2024
7d6024c
Merge pull request #976 from qiboteam/fix_ramsey_update
andrea-pasquale Sep 27, 2024
1da4d51
remove test not ready for PR
jevillegasdatTII Sep 27, 2024
b819c69
docs: write standard rb docs
Edoardo-Pedicillo Sep 27, 2024
22eddc5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 27, 2024
c811d5c
Merge pull request #983 from qiboteam/protocol_docs
scarrazza Sep 27, 2024
3a8368c
Update pyproject.toml
scarrazza Sep 27, 2024
c77f563
Update pyproject.toml
scarrazza Sep 27, 2024
42a161c
revert change
jevillegasdatTII Oct 2, 2024
a97cfad
Change Sequenced routine to use signal instead of probailities
jevillegasdatTII Oct 2, 2024
1aac948
fix: coupling units
Edoardo-Pedicillo Oct 2, 2024
3377b87
fix: Rabi 2D fit working
andrea-pasquale Oct 2, 2024
89db80b
fix: move change of units
Edoardo-Pedicillo Oct 2, 2024
4f85182
update doc
jevillegasdatTII Oct 4, 2024
8911e60
test: add Runtime Error in resonator+crosstalk
Edoardo-Pedicillo Oct 4, 2024
a4b2ebe
Merge branch 'main' into cr_sequences
jevillegasdatTII Oct 4, 2024
a1d134b
Merge branch 'main' into cr_sequences
jevillegasdatTII Oct 4, 2024
2a7062c
Merge pull request #997 from qiboteam/fix_rabi_2D_fit
Edoardo-Pedicillo Oct 7, 2024
593e11b
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Oct 8, 2024
ed9fb0b
Merge pull request #1001 from qiboteam/pre-commit-ci-update-config
alecandido Oct 8, 2024
f2f7947
Make RB circuits actually random
hay-k Oct 2, 2024
48bd6b1
RB circuit layer generation tests
hay-k Oct 8, 2024
c105292
fix type annotation
hay-k Oct 8, 2024
4704913
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 8, 2024
34a23b6
fix: circuit serialization as parameters of the tomography
Edoardo-Pedicillo Oct 8, 2024
b2e54f5
fix: change file circuit path
Edoardo-Pedicillo Oct 8, 2024
14acf17
fix: close descriptor
Edoardo-Pedicillo Oct 9, 2024
6789ac8
Merge pull request #998 from qiboteam/coupling_hz
Edoardo-Pedicillo Oct 9, 2024
39cd463
docs: Prevent parameters classes to appear in the index
alecandido Oct 12, 2024
22f62d5
Merge pull request #1002 from qiboteam/params_yaml
Edoardo-Pedicillo Oct 14, 2024
b64c1cd
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Oct 14, 2024
5870e5a
Merge pull request #1010 from qiboteam/pre-commit-ci-update-config
Edoardo-Pedicillo Oct 15, 2024
44ec734
Merge pull request #1009 from qiboteam/noindex-routine-autoclass
alecandido Oct 15, 2024
7a06837
docs: upload list of future protocols
Edoardo-Pedicillo Oct 16, 2024
0fff1a8
fix: typo in README
Edoardo-Pedicillo Oct 16, 2024
977e0a6
doc: remove colors in README
Edoardo-Pedicillo Oct 16, 2024
731c9b1
Merge pull request #995 from qiboteam/randomize_rb
hay-k Oct 17, 2024
d00d800
Update README.md
Edoardo-Pedicillo Oct 17, 2024
89f4ac6
doc: implement suggestions
Edoardo-Pedicillo Oct 17, 2024
bb83a11
Merge pull request #1012 from qiboteam/protocol_list
Edoardo-Pedicillo Oct 17, 2024
3cb622f
Merge branch 'main' into cr_sequences
jevillegasd Oct 17, 2024
7a2edfc
Update routine names
jevillegasdatTII Oct 17, 2024
89ab308
Update routine names
jevillegasdatTII Oct 17, 2024
5069ff4
run tests
jevillegasdatTII Oct 18, 2024
920fb8d
chevron coupler routine
jevillegasdatTII Oct 18, 2024
e8a0598
fix on length_sequences for the pulse duration was not being updated …
jevillegasdatTII Nov 6, 2024
9d18e0a
Add axis titles
jevillegasdatTII Nov 6, 2024
8159921
Merge branch 'main' into cr_sequences
jevillegasd Nov 7, 2024
cf81938
Cross resonance amplitude can project over multiple measurement axes
jevillegasdatTII Nov 19, 2024
01a9261
fix in Lorentzian fit
jevillegasdatTII Nov 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/qibocal/protocols/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
chsh_pulses,
cross_resonance,
cross_resonance_chevron,
cross_resonance_sequences,
cross_resonance_chevron_frequency,
cz_virtualz,
cz_virtualz_signal,
)
Expand Down Expand Up @@ -136,4 +138,6 @@ class Operation(Enum):
calibrate_state_discrimination = calibrate_state_discrimination
cross_resonance = cross_resonance
cross_resonance_chevron = cross_resonance_chevron
cross_resonance_chevron_frequency = cross_resonance_chevron_frequency
cross_resonance_sequences = cross_resonance_sequences
state_tomography = state_tomography
2 changes: 1 addition & 1 deletion src/qibocal/protocols/two_qubit_interaction/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .chevron import chevron, chevron_signal
from .chsh import chsh_circuits, chsh_pulses
from .cross_resonance import cross_resonance, cross_resonance_chevron
from .cross_resonance import cross_resonance, cross_resonance_chevron, cross_resonance_sequences, cross_resonance_chevron_frequency
from .cz_virtualz import cz_virtualz
from .cz_virtualz_signal import cz_virtualz_signal
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def _plot(data: ChevronData, fit: ChevronResults, target: QubitPairId):
rows=1,
cols=2,
subplot_titles=(
f"Qubit {target[0]} - Low Frequency",
f"Qubit {target[0]} - Target",
f"Qubit {target[1]} - High Frequency",
),
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
from .chevron import cross_resonance_chevron
from .cross_resonance import cross_resonance
from .cross_resonance_sequences import cross_resonance_sequences
from .chevron_frequency import cross_resonance_chevron_frequency
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@
("amp", np.float64),
]
)
"""Custom dtype for resonator spectroscopy."""
"""Custom dtype for cross resonance chevron."""

STATES = ["I", "X"]

@dataclass
class CrossResonanceChevronParameters(Parameters):
"""ResonatorSpectroscopy runcard inputs."""
"""cross resonance chevron runcard inputs."""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Start the docstrings with the capital letter


pulse_duration_start: float
"""Initial pi pulse duration [ns]."""
Expand Down Expand Up @@ -59,12 +60,12 @@ def amplitude_factor_range(self):

@dataclass
class CrossResonanceChevronResults(Results):
"""ResonatorSpectroscopy outputs."""
"""cross resonance chevron outputs."""


@dataclass
class CrossResonanceChevronData(Data):
"""Data structure for resonator spectroscopy with attenuation."""
"""Data structure for cross resonance chevron."""

data: dict[QubitId, npt.NDArray[CrossResonanceChevronType]] = field(
default_factory=dict
Expand All @@ -87,24 +88,24 @@ def _acquisition(
platform: Platform,
targets: list[QubitPairId],
) -> CrossResonanceChevronData:
"""Data acquisition for resonator spectroscopy."""
"""Data acquisition for cross resonance chevron."""

data = CrossResonanceChevronData()

for pair in targets:
for setup in ["I", "X"]:
for setup in STATES:
target, control = pair
sequence = PulseSequence()
control_drive_freq = platform.qubits[control].native_gates.RX.frequency
target_drive_freq = platform.qubits[target].native_gates.RX.frequency

if setup == "X":
if setup == STATES[1]:
rx_control = platform.create_RX_pulse(control, 0)
pulse = platform.create_RX_pulse(target, rx_control.finish)
pulse = platform.create_RX_pulse(control, rx_control.finish)
sequence.add(rx_control)
else:
pulse = platform.create_RX_pulse(target, 0)
pulse = platform.create_RX_pulse(control, 0)

pulse.frequency = control_drive_freq
pulse.frequency = target_drive_freq
if params.pulse_amplitude is not None:
pulse.amplitude = params.pulse_amplitude
sequence.add(pulse)
Expand Down Expand Up @@ -163,41 +164,36 @@ def _plot(
target: QubitPairId,
fit: CrossResonanceChevronResults,
):
"""Plotting function for ResonatorSpectroscopy."""
# TODO: share colorbar
control_idle_data = data.data[target[0], target[1], "I"]
control_excited_data = data.data[target[0], target[1], "X"]
pair = target
figs = []

"""Plotting function for Cross Resonance Chevron ."""
fig = make_subplots(
rows=1,
cols=2,
subplot_titles=(
f"Qubit {target[1]} - |0>",
f"Qubit {target[1]} - |1>",
),
)
fig.add_trace(
go.Heatmap(
x=control_idle_data.length,
y=control_idle_data.amp,
z=control_idle_data.prob,
name="Control at 0",
f"Control Q{pair[1]} = |{STATES[0]}>",
f"Control Q{pair[1]} = |{STATES[1]}>",
),
row=1,
col=1,
)

fig.add_trace(
go.Heatmap(
x=control_excited_data.length,
y=control_excited_data.amp,
z=control_excited_data.prob,
name="Control at 1",
),
row=1,
col=2,
)

return [fig], ""
for i, setup in enumerate(STATES):
qubit_data = data.data[target[0], target[1], setup]
fig.add_trace(
go.Heatmap(
x=qubit_data.length,
y=qubit_data.amp,
z=qubit_data.prob,
name=f"Control at {setup}",
coloraxis="coloraxis"
),
row=1,
col=i+1,
)
fig.update_layout(coloraxis={'colorscale':'Plasma'})

figs.append(fig)
return figs, ""


cross_resonance_chevron = Routine(_acquisition, _fit, _plot)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
from dataclasses import dataclass, field
from typing import Optional

import numpy as np
import numpy.typing as npt
import plotly.graph_objects as go
from plotly.subplots import make_subplots
from qibolab import AcquisitionType, AveragingMode, ExecutionParameters
from qibolab.platform import Platform
from qibolab.pulses import PulseSequence
from qibolab.qubits import QubitId, QubitPairId
from qibolab.sweeper import Parameter, Sweeper, SweeperType
from qibocal.protocols.utils import HZ_TO_GHZ
from qibocal.auto.operation import Data, Parameters, Results, Routine

CrossResonanceChevronFrequencyType = np.dtype(
[
("length", np.float64),
("freq", np.int64),
("prob", np.float64),
]
)
"""Custom dtype for resonator spectroscopy."""


@dataclass
class CrossResonanceChevronFrequencyParameters(Parameters):
"""ResonatorSpectroscopy runcard inputs."""

pulse_duration_start: float
"""Initial pi pulse duration [ns]."""
pulse_duration_end: float
"""Final pi pulse duration [ns]."""
pulse_duration_step: float
"""Step pi pulse duration [ns]."""
freq_width: int
"""Frequency range."""
freq_step: int
"""Frequency step size."""

pulse_amplitude: Optional[float] = None

@property
def duration_range(self):
return np.arange(
self.pulse_duration_start, self.pulse_duration_end, self.pulse_duration_step
)

@property
def frequency_range(self):
return np.arange(
-self.freq_width/2,
self.freq_width/2,
self.freq_step,
)
STATES = [0, 1]

@dataclass
class CrossResonanceChevronFrequencyResults(Results):
"""Chevron wih Frequency Cross Resonance Calibration outputs."""


@dataclass
class CrossResonanceChevronFrequencyData(Data):
"""Data structure for Chevron wih Frequency."""

data: dict[QubitId, npt.NDArray[CrossResonanceChevronFrequencyType]] = field(
default_factory=dict
)
"""Raw data acquired."""

def register_qubit(self, dtype, key, prob, freq, length):
"""Store output for single qubit."""
size = len(freq) * len(length)
frequency, duration = np.meshgrid(freq, length)
ar = np.empty(size, dtype=dtype)
ar["freq"] = frequency.ravel()
ar["length"] = duration.ravel()
ar["prob"] = prob.ravel()
self.data[key] = np.rec.array(ar)


def _acquisition(
params: CrossResonanceChevronFrequencyParameters,
platform: Platform,
targets: list[QubitPairId],
) -> CrossResonanceChevronFrequencyData:
"""Data acquisition for Chevron wih Frequency."""

data = CrossResonanceChevronFrequencyData()
for pair in targets:
target, control = pair
for setup in STATES:
sequence = PulseSequence()
target_drive_freq = platform.qubits[target].native_gates.RX.frequency

# add a RX control pulse if the setup is |1>
if setup == STATES[1]:
rx_control = platform.create_RX_pulse(control, 0)
pulse = platform.create_RX_pulse(control, rx_control.finish)
sequence.add(rx_control)
else:
pulse = platform.create_RX_pulse(control, 0)

pulse.frequency = target_drive_freq
if params.pulse_amplitude is not None:
pulse.amplitude = params.pulse_amplitude
sequence.add(pulse)

# add readout pulses
for qubit in pair:
sequence.add(platform.create_qubit_readout_pulse(qubit, start=pulse.finish))

# create a duration sweeper for the pulse duration
sweeper_duration = Sweeper(
Parameter.duration,
params.duration_range,
pulses=[pulse],
type=SweeperType.ABSOLUTE,
)

# create a frequency sweeper for the pulse frequency
sweeper_frequency = Sweeper(
Parameter.frequency,
params.frequency_range,
pulses=[pulse],
type=SweeperType.OFFSET,
)

# run the sweep
results = platform.sweep(
sequence,
ExecutionParameters(
nshots=params.nshots,
relaxation_time=params.relaxation_time,
acquisition_type=AcquisitionType.DISCRIMINATION,
averaging_mode=AveragingMode.SINGLESHOT,
),
sweeper_duration,
sweeper_frequency,
)

# store the results for each qubit in the pair in the data object
# NOTE: Change this to use standard qibocal>auto>operation>Data>register_qubit
for qubit in pair:
data.register_qubit(
dtype=CrossResonanceChevronFrequencyType,
key=(qubit, target, control, setup),
prob=results[qubit].probability(state=1),
length=params.duration_range,
freq=pulse.frequency + params.frequency_range,
)

# return the data
return data


def _fit(
data:CrossResonanceChevronFrequencyData,
) -> CrossResonanceChevronFrequencyResults:
"""Post-processing function for Chevron wih Frequency."""
return CrossResonanceChevronFrequencyResults()


def _plot(
data: CrossResonanceChevronFrequencyData,
target: QubitPairId,
fit: CrossResonanceChevronFrequencyResults,
):
pair = target
"""Plotting function for Chevron wih Frequency and Duration."""
figs = []
for qubit in pair:
fig = make_subplots(
rows=1,
cols=2,
subplot_titles=(
f"Q{qubit} , Control |{STATES[0]}>",
f"Q{qubit} , Control |{STATES[1]}>",
),
)
for i, setup in enumerate(STATES):
qubit_data = data.data[qubit, pair[0], pair[1], setup]
fig.add_trace(
go.Heatmap(
x=qubit_data.length,
y=qubit_data.freq * HZ_TO_GHZ,
z=qubit_data.prob,
name=f"Control at |{setup}>",
coloraxis="coloraxis"
),
row=1,
col=i+1,
)
fig.update_xaxes(title_text="Pulse Duration [ns]", row=1, col=i+1)
fig.update_yaxes(title_text="Frequency [GHz]", row=1, col=i+1)
fig.update_layout(coloraxis={'colorscale':'Plasma'})
figs.append(fig)


return figs, ""

cross_resonance_chevron_frequency = Routine(_acquisition, _fit, _plot)
"""CrossResonanceChevronFrequency Routine object."""
Loading