-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
287 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,287 @@ | ||
from qualang_tools.units import unit | ||
from quaqsim.api.utils import dump_to_base64, program_to_ast | ||
from quaqsim.architectures.transmon_pair import TransmonPair | ||
from quaqsim.architectures import TransmonSettings | ||
from quaqsim.architectures.transmon_pair_settings import TransmonPairSettings | ||
from quaqsim.architectures.from_qua_channels import ( | ||
TransmonPairBackendChannelReadout, | ||
TransmonPairBackendChannelIQ, | ||
ChannelType, | ||
) | ||
from qm.qua import * | ||
|
||
import requests | ||
|
||
|
||
u = unit(coerce_to_integer=True) | ||
|
||
x90_q1_amp = 0.08 | ||
x90_q2_amp = 0.068 | ||
|
||
x90_len = 260 // 4 | ||
|
||
qubit_1_IF = 50 * u.MHz | ||
qubit_1_LO = 4860000000 - qubit_1_IF | ||
|
||
qubit_2_IF = 60 * u.MHz | ||
qubit_2_LO = 4970000000 - qubit_2_IF | ||
|
||
resonator_1_LO = 5.5 * u.GHz | ||
resonator_1_IF = 60 * u.MHz | ||
|
||
resonator_2_LO = 5.5 * u.GHz | ||
resonator_2_IF = 60 * u.MHz | ||
|
||
readout_len = 5000 | ||
readout_amp = 0.2 | ||
|
||
time_of_flight = 24 | ||
|
||
config = { | ||
"version": 1, | ||
"controllers": { | ||
"con1": { | ||
"analog_outputs": { | ||
1: {"offset": 0.0}, # I resonator 1 | ||
2: {"offset": 0.0}, # Q resonator 1 | ||
3: {"offset": 0.0}, # I resonator 2 | ||
4: {"offset": 0.0}, # Q resonator 2 | ||
5: {"offset": 0.0}, # I qubit 1 | ||
6: {"offset": 0.0}, # Q qubit 1 | ||
7: {"offset": 0.0}, # I qubit 2 | ||
8: {"offset": 0.0}, # Q qubit 2 | ||
}, | ||
"digital_outputs": {}, | ||
"analog_inputs": { | ||
1: {"offset": 0.0, "gain_db": 0}, # I from down-conversion | ||
2: {"offset": 0.0, "gain_db": 0}, # Q from down-conversion | ||
}, | ||
}, | ||
}, | ||
"elements": { | ||
"qubit_1": { | ||
"RF_inputs": {"port": ("octave1", 3)}, | ||
"intermediate_frequency": qubit_1_IF, | ||
"operations": { | ||
"x90": "x90_q1_pulse", | ||
"y90": "y90_q1_pulse", | ||
}, | ||
}, | ||
"qubit_1t2": { | ||
"RF_inputs": {"port": ("octave1", 3)}, | ||
"intermediate_frequency": qubit_2_IF, | ||
"operations": { | ||
"x90": "x90_pulse", | ||
}, | ||
}, | ||
"qubit_2": { | ||
"RF_inputs": {"port": ("octave1", 4)}, | ||
"intermediate_frequency": qubit_2_IF, | ||
"operations": { | ||
"x90": "x90_q2_pulse", | ||
}, | ||
}, | ||
"resonator_1": { | ||
"RF_inputs": {"port": ("octave1", 1)}, | ||
"RF_outputs": {"port": ("octave1", 1)}, | ||
"intermediate_frequency": resonator_1_IF, | ||
"operations": { | ||
"readout": "readout_pulse", | ||
}, | ||
"time_of_flight": time_of_flight, | ||
"smearing": 0, | ||
}, | ||
"resonator_2": { | ||
"RF_inputs": {"port": ("octave1", 2)}, | ||
"RF_outputs": {"port": ("octave1", 1)}, | ||
"intermediate_frequency": resonator_2_IF, | ||
"operations": { | ||
"readout": "readout_pulse", | ||
}, | ||
"time_of_flight": time_of_flight, | ||
"smearing": 0, | ||
}, | ||
}, | ||
"octaves": { | ||
"octave1": { | ||
"RF_outputs": { | ||
1: { | ||
"LO_frequency": resonator_1_LO, | ||
"LO_source": "internal", | ||
"output_mode": "always_on", | ||
"gain": 0, | ||
}, | ||
2: { | ||
"LO_frequency": resonator_2_LO, | ||
"LO_source": "internal", | ||
"output_mode": "always_on", | ||
"gain": 0, | ||
}, | ||
3: { | ||
"LO_frequency": qubit_1_LO, | ||
"LO_source": "internal", | ||
"output_mode": "always_on", | ||
"gain": 0, | ||
}, | ||
4: { | ||
"LO_frequency": qubit_2_LO, | ||
"LO_source": "internal", | ||
"output_mode": "always_on", | ||
"gain": 0, | ||
}, | ||
}, | ||
"RF_inputs": { | ||
1: { | ||
"LO_frequency": resonator_1_LO, | ||
"LO_source": "internal", | ||
}, | ||
}, | ||
"connectivity": "con1", | ||
} | ||
}, | ||
"pulses": { | ||
"x90_q1_pulse": { | ||
"operation": "control", | ||
"length": x90_len, | ||
"waveforms": { | ||
"I": "x90_q1_I_wf", | ||
"Q": "x90_q1_Q_wf", | ||
}, | ||
}, | ||
"y90_q1_pulse": { | ||
"operation": "control", | ||
"length": x90_len, | ||
"waveforms": { | ||
"I": "y90_q1_I_wf", | ||
"Q": "y90_q1_Q_wf", | ||
}, | ||
}, | ||
"x90_q2_pulse": { | ||
"operation": "control", | ||
"length": x90_len, | ||
"waveforms": { | ||
"I": "x90_q2_I_wf", | ||
"Q": "x90_q2_Q_wf", | ||
}, | ||
}, | ||
"y90_q2_pulse": { | ||
"operation": "control", | ||
"length": x90_len, | ||
"waveforms": { | ||
"I": "y90_q2_I_wf", | ||
"Q": "y90_q2_Q_wf", | ||
}, | ||
}, | ||
"readout_pulse": { | ||
"operation": "measurement", | ||
"length": readout_len, | ||
"waveforms": { | ||
"I": "readout_wf", | ||
"Q": "zero_wf", | ||
}, | ||
"integration_weights": { | ||
"cos": "cosine_weights", | ||
"sin": "sine_weights", | ||
"minus_sin": "minus_sine_weights", | ||
}, | ||
"digital_marker": "ON", | ||
}, | ||
}, | ||
"waveforms": { | ||
"zero_wf": {"type": "constant", "sample": 0.0}, | ||
# q1 | ||
"x90_q1_I_wf": {"type": "constant", "sample": x90_q1_amp}, | ||
"x90_q1_Q_wf": {"type": "constant", "sample": 0.0}, | ||
"y90_q1_I_wf": {"type": "constant", "sample": 0.0}, | ||
"y90_q1_Q_wf": {"type": "constant", "sample": x90_q1_amp}, | ||
# q2 | ||
"x90_q2_I_wf": {"type": "constant", "sample": x90_q2_amp}, | ||
"x90_q2_Q_wf": {"type": "constant", "sample": 0.0}, | ||
"y90_q2_I_wf": {"type": "constant", "sample": 0.0}, | ||
"y90_q2_Q_wf": {"type": "constant", "sample": x90_q2_amp}, | ||
"readout_wf": {"type": "constant", "sample": readout_amp}, | ||
}, | ||
"digital_waveforms": { | ||
"ON": {"samples": [(1, 0)]}, | ||
}, | ||
} | ||
|
||
settings = TransmonPairSettings( | ||
TransmonSettings( | ||
resonant_frequency=4860000000.0, | ||
anharmonicity=-320000000.0, | ||
rabi_frequency=0.22e9, | ||
), | ||
TransmonSettings( | ||
resonant_frequency=4970000000.0, | ||
anharmonicity=-320000000.0, | ||
rabi_frequency=0.26e9, | ||
), | ||
coupling_strength=0.002e9, | ||
) | ||
|
||
transmon_pair = TransmonPair(settings) | ||
|
||
qubit_1_freq = 4860000000 | ||
qubit_2_freq = 4970000000.0 | ||
|
||
channel_map = { | ||
"qubit_1": TransmonPairBackendChannelIQ( | ||
qubit_index=0, | ||
carrier_frequency=qubit_1_freq, | ||
operator_i=transmon_pair.transmon_1_drive_operator(quadrature="I"), | ||
operator_q=transmon_pair.transmon_1_drive_operator(quadrature="Q"), | ||
type=ChannelType.DRIVE, | ||
), | ||
"qubit_1t2": TransmonPairBackendChannelIQ( | ||
qubit_index=0, | ||
carrier_frequency=qubit_2_freq, | ||
operator_i=transmon_pair.transmon_1_drive_operator(quadrature="I"), | ||
operator_q=transmon_pair.transmon_1_drive_operator(quadrature="Q"), | ||
type=ChannelType.CONTROL, | ||
), | ||
"qubit_2": TransmonPairBackendChannelIQ( | ||
qubit_index=1, | ||
carrier_frequency=qubit_2_freq, | ||
operator_i=transmon_pair.transmon_2_drive_operator(quadrature="I"), | ||
operator_q=transmon_pair.transmon_2_drive_operator(quadrature="Q"), | ||
type=ChannelType.DRIVE, | ||
), | ||
"resonator_1": TransmonPairBackendChannelReadout(0), | ||
"resonator_2": TransmonPairBackendChannelReadout(1), | ||
} | ||
|
||
program_script = """ | ||
start, stop, step = -2, 2, 0.1 | ||
a = declare(fixed) | ||
with for_(a, start, a < stop - 0.0001, a + step): | ||
play("x90" * amp(a), "qubit_1") | ||
play("x90" * amp(a), "qubit_2") | ||
align("qubit_1", "qubit_2", "resonator_1", "resonator_2") | ||
measure("readout", "resonator_1", None) | ||
measure("readout", "resonator_2", None) | ||
""" | ||
|
||
API_URL = "http://localhost:8000/api" | ||
|
||
if __name__ == "__main__": | ||
requests.post(f"{API_URL}/reset") | ||
response = requests.post( | ||
f"{API_URL}/submit_qua_configuration", | ||
json={"qua_configuration": dump_to_base64(config)}, | ||
) | ||
requests.post( | ||
f"{API_URL}/submit_qua_program", | ||
json={"qua_script": dump_to_base64(program_script)}, | ||
) | ||
requests.post( | ||
f"{API_URL}/submit_quantum_system", | ||
json={"quantum_system": dump_to_base64(transmon_pair)}, | ||
) | ||
requests.post( | ||
f"{API_URL}/submit_channel_map", | ||
json={"channel_map": dump_to_base64(channel_map)}, | ||
) | ||
requests.get(f"{API_URL}/simulate") |