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

Feature/scquam_LF_MW #258

Open
wants to merge 57 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
92fa050
init from Kevin's install
TheoLaudatQM Sep 17, 2024
76e3bcf
requirements without qualibrate
TheoLaudatQM Sep 17, 2024
7f2a1cd
modify quam + quam on the fly
TheoLaudatQM Sep 17, 2024
9b4717b
clean imports
TheoLaudatQM Sep 17, 2024
170e364
General updates
TheoLaudatQM Sep 17, 2024
f957f69
small readme update
TheoLaudatQM Sep 19, 2024
947ecac
make_wiring examples
TheoLaudatQM Oct 8, 2024
9be0584
black formating
TheoLaudatQM Oct 8, 2024
2559b1c
updates from CS_installation
TheoLaudatQM Oct 8, 2024
96c7d1f
remove experiment folder
TheoLaudatQM Oct 8, 2024
e0583e9
removed #TODO: sigma because now Cosine in pulses.py
KevinAVR Oct 9, 2024
bfb44d8
remove path on 00_delays.py
KevinAVR Oct 9, 2024
4d05ef2
remove empty lines in 01_mixer_calibraiton
KevinAVR Oct 9, 2024
80776da
Use new Qualibrate and resolve dependency conflicts so all requiremen…
deanpoulos Oct 14, 2024
dc91f5d
Add table of contents.
deanpoulos Oct 14, 2024
ac6e1b4
Add documentation for setting up and running w/ QUAlibrate.
deanpoulos Oct 14, 2024
ae42a1d
Fix bug where calibration_db is saved to base directory.
deanpoulos Oct 22, 2024
d3f336c
Removed branch from requirements since auto-wirer is now merged to main.
deanpoulos Oct 22, 2024
4dd6908
Pin qualang-tools version to latest published.
deanpoulos Oct 23, 2024
8a9342f
fix make_wiring in readme + typo
TheoLaudatQM Oct 23, 2024
44d4399
readme fixes from Kevin's comments
TheoLaudatQM Oct 23, 2024
4a06fbf
Update quam root based on IQCC
TheoLaudatQM Oct 23, 2024
9aff101
Update readme & flux line
TheoLaudatQM Oct 23, 2024
406fe8e
Upremove tof = 28
TheoLaudatQM Oct 23, 2024
2b7b62b
small fixes
TheoLaudatQM Oct 23, 2024
ca00939
small fixes
TheoLaudatQM Oct 25, 2024
154d861
updated save_utils
TheoLaudatQM Oct 25, 2024
ded01ec
Add convert_IQ_to_V to qua_datasets.py
TheoLaudatQM Oct 25, 2024
777bb6b
Update Res spec 1D
TheoLaudatQM Oct 25, 2024
6adba9d
small fix
TheoLaudatQM Oct 25, 2024
6650ff3
Update res spec vs flux
TheoLaudatQM Oct 25, 2024
f2457aa
remove octave config
TheoLaudatQM Oct 25, 2024
91de235
add flux line settle time
TheoLaudatQM Oct 25, 2024
0eb45e5
fix res spec vs flux
TheoLaudatQM Oct 25, 2024
8696143
update qubit spec
TheoLaudatQM Oct 25, 2024
4ae7c43
update qubit spec vs flux
TheoLaudatQM Oct 25, 2024
a549f9b
Add q.z.settle() to apply_all_flux...
TheoLaudatQM Oct 25, 2024
767134a
remove additional if node.parameters.simulate:
TheoLaudatQM Oct 25, 2024
292aedb
Update power Rabi
TheoLaudatQM Oct 25, 2024
1c8d2e6
Update ramsey
TheoLaudatQM Oct 25, 2024
66a4942
Set T2 ramsey and echo in s
TheoLaudatQM Oct 25, 2024
466ea6e
add qubit.grid_location to modify_quam
TheoLaudatQM Oct 25, 2024
cf0a05c
Improve convert_IQ_to_V
TheoLaudatQM Oct 25, 2024
0cce6ff
readout freq opt
TheoLaudatQM Oct 25, 2024
262eef3
T1
TheoLaudatQM Oct 25, 2024
0d91a42
Update IQ blobs
TheoLaudatQM Oct 25, 2024
3fa24f9
Update macros
TheoLaudatQM Oct 25, 2024
4f450db
fix thresholds in IQblobs
TheoLaudatQM Oct 25, 2024
67d0bdb
STarck and Drag x180
TheoLaudatQM Oct 25, 2024
0676cfc
Drag x180_90
TheoLaudatQM Oct 25, 2024
184aaee
Single qubit RB
TheoLaudatQM Oct 25, 2024
4c2fa54
plot utils (not reviewed but working)
TheoLaudatQM Oct 25, 2024
4e572ac
toml file from CS_installation
TheoLaudatQM Oct 25, 2024
ff7739e
small fixes in quam_libs
TheoLaudatQM Oct 25, 2024
8898ab4
res spec vs amp
TheoLaudatQM Oct 25, 2024
941107f
fixes for LF+MW
MichalGQM Oct 26, 2024
b4208ce
comment out set output power in res spec vs amp
MichalGQM Oct 26, 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
446 changes: 446 additions & 0 deletions Quantum-Control-Applications-QuAM/Superconducting/README.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#%%
from qm.qua import *
from qualang_tools.units import unit
from quam_libs.components import QuAM
import matplotlib.pyplot as plt


# %% {Initialize_QuAM_and_QOP}
# Class containing tools to help handling units and conversions.
u = unit(coerce_to_integer=True)
# Instantiate the QuAM class from the state file
machine = QuAM.load()
# Generate the OPX and Octave configurations
config = machine.generate_config()
# Open Communication with the QOP
qmm = machine.connect()

qubits = machine.active_qubits

with program() as prog:

with infinite_loop_():

qubits[0].xy.play('saturation')
qubits[0].z.play('const')
qubits[0].resonator.play('readout')

qm = qmm.open_qm(config)
job = qm.execute(prog)
plt.show()


# %%
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# %%

"""
A simple program to calibrate Octave mixers for all qubits and resonators
"""

from typing import Optional
from qualibrate import QualibrationNode, NodeParameters

from quam_libs.components import QuAM


# %% {Node_parameters}
class Parameters(NodeParameters):
qubits: Optional[str] = None
calibrate_resonator: bool = True
calibrate_drive: bool = True

node = QualibrationNode(
name="00_Mixer_Calibration",
parameters=Parameters()
)

# Instantiate the QuAM class from the state file
machine = QuAM.load()

# Generate the OPX and Octave configurations
config = machine.generate_config()
# Open Communication with the QOP
qmm = machine.connect()
qm = qmm.open_qm(config)

if node.parameters.qubits is None or node.parameters.qubits == '':
qubits = machine.active_qubits
else:
qubits = [machine.qubits[q] for q in node.parameters.qubits.replace(' ', '').split(',')]

for qubit in qubits:
qubit.calibrate_octave(qm,
calibrate_drive=node.parameters.calibrate_drive,
calibrate_resonator=node.parameters.calibrate_resonator)

# %%
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
# %%
"""
TIME OF FLIGHT
This sequence involves sending a readout pulse and capturing the raw ADC traces.
The data undergoes post-processing to calibrate three distinct parameters:
- Time of Flight: This represents the internal processing time and the propagation delay of the readout pulse.
Its value can be adjusted in the configuration under "time_of_flight".
This value is utilized to offset the acquisition window relative to when the readout pulse is dispatched.

- Analog Inputs Offset: Due to minor impedance mismatches, the signals captured by the OPX might exhibit slight offsets.
These can be rectified in the configuration at: config/controllers/"con1"/analog_inputs, enhancing the demodulation process.

- Analog Inputs Gain: If a signal is constrained by digitization or if it saturates the ADC,
the variable gain of the OPX analog input can be modified to fit the signal within the ADC range of +/-0.5V.
This gain, ranging from -12 dB to 20 dB, can also be adjusted in the configuration at: config/controllers/"con1"/analog_inputs.
"""
from typing import Optional
from qualibrate import QualibrationNode, NodeParameters
from quam_libs.trackable_object import tracked_updates

# %% {Node_parameters}
class Parameters(NodeParameters):
qubit: str = "q1"
num_averages: int = 100
time_of_flight_in_ns: Optional[int] = None
intermediate_frequency_in_mhz: Optional[float] = None
readout_amplitude_in_v: Optional[float] = None
readout_length_in_ns: Optional[int] = None
simulate: bool = False
timeout: int = 100

node = QualibrationNode(
name="01_Time_of_Flight",
parameters=Parameters()
)



from qm.qua import *
from qm import SimulationConfig
from qualang_tools.units import unit
from quam_libs.components import QuAM
import matplotlib.pyplot as plt
import numpy as np
from scipy.signal import savgol_filter



# %% {Initialize_QuAM_and_QOP}
# Class containing tools to help handling units and conversions.
u = unit(coerce_to_integer=True)
# Instantiate the QuAM class from the state file
machine = QuAM.load()
# Get the relevant QuAM components
resonators = [q.resonator for q in machine.active_qubits]

tracked_resonators = []
for resonator in resonators:
# make temporary updates before running the program and revert at the end.
with tracked_updates(resonator, auto_revert=False, dont_assign_to_none=True) as resonator:
resonator.time_of_flight = node.parameters.time_of_flight_in_ns
resonator.operations["readout"].length = node.parameters.readout_length_in_ns
resonator.operations["readout"].amplitude = node.parameters.readout_amplitude_in_v
if node.parameters.intermediate_frequency_in_mhz is not None:
resonator.intermediate_frequency = node.parameters.intermediate_frequency_in_mhz * u.MHz
tracked_resonators.append(resonator)

# Generate the OPX and Octave configurations
config = machine.generate_config()
# Open Communication with the QOP
qmm = machine.connect()

# Get the relevant QuAM components
resonator = machine.qubits[node.parameters.qubit].resonator # The resonator element



with program() as raw_trace_prog:
n = declare(int) # QUA variable for the averaging loop
adc_st = declare_stream(adc_trace=True) # The stream to store the raw ADC trace

with for_(n, 0, n < node.parameters.num_averages, n + 1):
# Reset the phase of the digital oscillator associated to the resonator element. Needed to average the cosine signal.
reset_phase(resonator.name)
# Measure the resonator (send a readout pulse and record the raw ADC trace)
resonator.measure("readout", stream=adc_st)
# Wait for the resonator to deplete
wait(machine.depletion_time * u.ns, resonator.name)

with stream_processing():
# Will save average:
adc_st.input1().average().save("adc")
# Will save only last run:
adc_st.input1().save("adc_single_run")



if node.parameters.simulate:
# Simulates the QUA program for the specified duration
simulation_config = SimulationConfig(duration=10_000) # In clock cycles = 4ns
# Simulate blocks python until the simulation is done
job = qmm.simulate(config, raw_trace_prog, simulation_config)
# Plot the simulated samples
job.get_simulated_samples().con1.plot()
# save the figure
node.results = {"figure": plt.gcf()}
else:
# Open the quantum machine
qm = qmm.open_qm(config)
# Calibrate the active qubits
# machine.calibrate_octave_ports(qm)
# Send the QUA program to the OPX, which compiles and executes it
job = qm.execute(raw_trace_prog)

# Creates a result handle to fetch data from the OPX
res_handles = job.result_handles
# Waits (blocks the Python console) until all results have been acquired
res_handles.wait_for_all_values()
# Fetch the raw ADC traces and convert them into Volts
adc = u.raw2volts(res_handles.get("adc").fetch_all())
adc_single_run = u.raw2volts(res_handles.get("adc_single_run").fetch_all())
# Filter the data to get the pulse arrival time
signal = savgol_filter(np.abs(adc), 11, 3)
# Detect the arrival of the readout signal
th = (np.mean(signal[:100]) + np.mean(signal[:-100])) / 2
delay = np.where(signal > th)[0][0]
delay = np.round(delay / 4) * 4 # Find the closest multiple integer of 4ns

# Plot data
fig = plt.figure()
plt.subplot(121)
plt.title("Single run")
plt.plot(adc_single_run.real, "b", label="I")
plt.plot(adc_single_run.imag, "r", label="Q")
xl = plt.xlim()
yl = plt.ylim()
plt.axvline(delay, color="k", linestyle="--", label="TOF")
plt.fill_between(range(len(adc_single_run)), -0.5, 0.5, color="grey", alpha=0.2, label="ADC Range")
plt.xlabel("Time [ns]")
plt.ylabel("Signal amplitude [V]")
plt.legend()
plt.subplot(122)
plt.title("Averaged run")
plt.plot(adc.real, "b", label="I")
plt.plot(adc.imag, "r", label="Q")
plt.axvline(delay, color="k", linestyle="--", label="TOF")
plt.xlabel("Time [ns]")
plt.legend()
plt.grid("all")
plt.tight_layout()
plt.show()

# Update the config
print(f"Time Of Flight to add in the config: {delay} ns")

for resonator in tracked_resonators:
resonator.revert_changes()

with node.record_state_updates():
for resonator in tracked_resonators:
resonator.reapply_changes()
for resonator in resonators:
if node.parameters.time_of_flight_in_ns is not None:
resonator.time_of_flight = node.parameters.time_of_flight_in_ns + int(delay)
else:
resonator.time_of_flight = resonator.time_of_flight + int(delay)


node.results = {
"run_parameters": node.parameters.model_dump(),
"delay": delay,
"raw_adc": adc,
"raw_adc_single_shot": adc_single_run,
"figure": fig,
}

node.machine = machine
node.save()

# %%
Loading
Loading