-
Notifications
You must be signed in to change notification settings - Fork 21
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
1 parent
a152eb7
commit be6cf48
Showing
11 changed files
with
594 additions
and
159 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
from qm.qua import * | ||
from qm.QuantumMachinesManager import QuantumMachinesManager | ||
import matplotlib.pyplot as plt | ||
from time import sleep | ||
|
||
# from callable_from_qua import program, run_local # TODO | ||
from qualang_tools.addons.callable_from_qua.callable_from_qua import program, run_local | ||
from configuration import * | ||
|
||
|
||
@run_local | ||
def update_offset(QM, channel: str, signal: float): | ||
target = 0.05 # Target voltage in V | ||
signal = -signal * 2**12 / readout_len | ||
correction = target - signal # Correction to apply | ||
print(f"Set DC offset of channel {channel} to {correction} V (signal = {signal})") | ||
# Can be QDAC or whatever | ||
QM.set_output_dc_offset_by_element(channel, "single", correction) | ||
sleep(0.5) | ||
|
||
|
||
qmm = QuantumMachinesManager(host="172.16.33.101", cluster_name="Cluster_83") | ||
qm = qmm.open_qm(config) | ||
|
||
|
||
with program() as prog: | ||
n = declare(int) | ||
n2 = declare(int) | ||
I = declare(fixed) | ||
signal = declare(fixed) | ||
signal_st = declare_stream() | ||
with for_(n2, 0, n2 < 20, n2 + 1): | ||
assign(signal, 0) | ||
with for_(n, 0, n < 2**8, n + 1): | ||
measure("readout", "resonator", None, integration.full("cos", I, "out1")) | ||
assign(signal, signal + (I >> 8)) | ||
update_offset(QM=qm, channel="flux_line", signal=signal) | ||
save(signal, signal_st) | ||
with stream_processing(): | ||
signal_st.save_all("signal") | ||
|
||
|
||
def live_plot(res_handles): | ||
data = -res_handles.get("signal").fetch_all()["value"] * 2**12 / readout_len | ||
plt.cla() | ||
plt.plot(data, "ko") | ||
plt.pause(0.01) | ||
|
||
|
||
# Execute the QUA program using the local_run context manager | ||
with prog.local_run(qm, [live_plot]): | ||
job = qm.execute(prog) |
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
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
Oops, something went wrong.