-
Notifications
You must be signed in to change notification settings - Fork 6
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
jevillegasdatTII
wants to merge
111
commits into
cross_resonance
Choose a base branch
from
cr_sequences
base: cross_resonance
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Cr sequences #994
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 4e6274a
Phase dispersion correction for punchout
jevillegasd bb5ca9a
phase delay for resonator flux dependance
jevillegasd 6f211fe
Add slope to background offset in lorentzian fit.
jevillegasd 53bc9ab
fix: Fix T1 fit
andrea-pasquale 695a084
fix: Make crosstalk test less restrictive
andrea-pasquale d0f4852
chore(deps): bump urllib3 from 2.2.1 to 2.2.2
dependabot[bot] 681329f
different bounds in rabi signal
rodolfocarobene b76d4ec
feat: 2qrb with some inverse failing
Jacfomg 2ff9751
fix on the gate names
Jacfomg 0a1757e
fix the Z gates
Jacfomg 42bb62b
fix: Single 2q cliffs find their inverse
Jacfomg c47174d
fix: transpiler
Jacfomg 2983a1d
feat: 2qrb working prototype
Jacfomg e018ab5
fix: remove prints
Jacfomg 14526d4
fix: some tests
Jacfomg af26120
fix: tests
Jacfomg 71b149c
feat: files as params
Jacfomg e9da312
feat: inverse matrices file generation
Jacfomg 255d9c4
feat: counting pulses draft
Jacfomg c4cfd2a
fix: improve cov
Jacfomg dac5eb7
fix: cov
Jacfomg 0e18c5d
fix: post process survival probability
Jacfomg 1e07990
feat: helper functions
Jacfomg fe51b38
feat: load_cliffords
Jacfomg 561f832
fix: refactor 2qRB
Jacfomg e2ba218
fix: this shouldn't be here yet
Jacfomg 03a5356
fix: reduce code duplication
Jacfomg 62a62de
style: improve format
Jacfomg 2110a53
docs: add docs
Jacfomg 4b69506
refactor: simplify dict_utils
Jacfomg 26a72df
fix: review
Jacfomg 54ea707
unify execution pars for dispersive shift
rodolfocarobene 8eb4083
fix: Fix bug in calculation of virtual phases
andrea-pasquale 0bc8831
refactor: minor fixes
andrea-pasquale 3dad308
fix: Modify ramsey update
andrea-pasquale 5abc5d6
docs: write readout mitigation matrix docs
Edoardo-Pedicillo c8465e9
docs: write avoided crossing docs
Edoardo-Pedicillo 695df02
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] b6bfeb7
docs: write readout optimization docs
Edoardo-Pedicillo 861d279
Merge branch 'protocol_docs' of github.com:qiboteam/qibocal into prot…
Edoardo-Pedicillo 1f3dd24
refactor: Improvements in state tomography
andrea-pasquale f9b5e4b
feat: Compute for all qubits using partial trace
andrea-pasquale f1db5c7
feat: Convert from qasm to raw
andrea-pasquale 8597df3
Sequences (signal) version of the cross resoannce pulse legth calibra…
jevillegasd 39292ed
Using non native pulses
jevillegasd 7aea94e
add target setting
jevillegasd 88d840e
Changes in pulse sequences of sweeping routines
jevillegasd a2707d5
Update docs
jevillegasdatTII 585e758
refactor: improve readability
andrea-pasquale de9db23
refactor: Use None instead of 0 for detuning
andrea-pasquale 1140079
refactor: Reduce code duplication in Ramsey experiments
andrea-pasquale fed7108
fix: Add back chi2 to Ramsey experiment
andrea-pasquale 7d52484
doc: Update Ramsey doc
andrea-pasquale 41baa99
Update doc/source/protocols/ramsey/ramsey.rst
andrea-pasquale 4902a18
feat: Add detuning attribute
andrea-pasquale 818be53
refactor: updating qq actions diagram
MatteoRobbiati 52d4992
Updates in documentation and chevron frequency
jevillegasdatTII d0a4744
Merge pull request #986 from qiboteam/qq-diagram
andrea-pasquale 7985fb1
docs: improve the readout optimization docs
Edoardo-Pedicillo a45c420
Merge pull request #972 from qiboteam/fix_2q_gates_protocols
andrea-pasquale b6a3a0a
Merge pull request #984 from qiboteam/refactor_tomography
andrea-pasquale 7d6024c
Merge pull request #976 from qiboteam/fix_ramsey_update
andrea-pasquale 1da4d51
remove test not ready for PR
jevillegasdatTII b819c69
docs: write standard rb docs
Edoardo-Pedicillo 22eddc5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] c811d5c
Merge pull request #983 from qiboteam/protocol_docs
scarrazza 3a8368c
Update pyproject.toml
scarrazza c77f563
Update pyproject.toml
scarrazza 42a161c
revert change
jevillegasdatTII a97cfad
Change Sequenced routine to use signal instead of probailities
jevillegasdatTII 1aac948
fix: coupling units
Edoardo-Pedicillo 3377b87
fix: Rabi 2D fit working
andrea-pasquale 89db80b
fix: move change of units
Edoardo-Pedicillo 4f85182
update doc
jevillegasdatTII 8911e60
test: add Runtime Error in resonator+crosstalk
Edoardo-Pedicillo a4b2ebe
Merge branch 'main' into cr_sequences
jevillegasdatTII a1d134b
Merge branch 'main' into cr_sequences
jevillegasdatTII 2a7062c
Merge pull request #997 from qiboteam/fix_rabi_2D_fit
Edoardo-Pedicillo 593e11b
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] ed9fb0b
Merge pull request #1001 from qiboteam/pre-commit-ci-update-config
alecandido f2f7947
Make RB circuits actually random
hay-k 48bd6b1
RB circuit layer generation tests
hay-k c105292
fix type annotation
hay-k 4704913
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 34a23b6
fix: circuit serialization as parameters of the tomography
Edoardo-Pedicillo b2e54f5
fix: change file circuit path
Edoardo-Pedicillo 14acf17
fix: close descriptor
Edoardo-Pedicillo 6789ac8
Merge pull request #998 from qiboteam/coupling_hz
Edoardo-Pedicillo 39cd463
docs: Prevent parameters classes to appear in the index
alecandido 22f62d5
Merge pull request #1002 from qiboteam/params_yaml
Edoardo-Pedicillo b64c1cd
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] 5870e5a
Merge pull request #1010 from qiboteam/pre-commit-ci-update-config
Edoardo-Pedicillo 44ec734
Merge pull request #1009 from qiboteam/noindex-routine-autoclass
alecandido 7a06837
docs: upload list of future protocols
Edoardo-Pedicillo 0fff1a8
fix: typo in README
Edoardo-Pedicillo 977e0a6
doc: remove colors in README
Edoardo-Pedicillo 731c9b1
Merge pull request #995 from qiboteam/randomize_rb
hay-k d00d800
Update README.md
Edoardo-Pedicillo 89f4ac6
doc: implement suggestions
Edoardo-Pedicillo bb83a11
Merge pull request #1012 from qiboteam/protocol_list
Edoardo-Pedicillo 3cb622f
Merge branch 'main' into cr_sequences
jevillegasd 7a2edfc
Update routine names
jevillegasdatTII 89ab308
Update routine names
jevillegasdatTII 5069ff4
run tests
jevillegasdatTII 920fb8d
chevron coupler routine
jevillegasdatTII e8a0598
fix on length_sequences for the pulse duration was not being updated …
jevillegasdatTII 9d18e0a
Add axis titles
jevillegasdatTII 8159921
Merge branch 'main' into cr_sequences
jevillegasd cf81938
Cross resonance amplitude can project over multiple measurement axes
jevillegasdatTII 01a9261
fix in Lorentzian fit
jevillegasdatTII File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
src/qibocal/protocols/two_qubit_interaction/cross_resonance/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
204 changes: 204 additions & 0 deletions
204
src/qibocal/protocols/two_qubit_interaction/cross_resonance/chevron_frequency.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.""" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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