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

update author #231

Merged
merged 6 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 2 additions & 2 deletions .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
- name: Collect PyTest report
id: collect-pytest-reports
if: always()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: pytest-report
path: ${{ env.JUNIT_REPORT_PATH }}
Expand All @@ -67,7 +67,7 @@ jobs:
files: ${{env.JUNIT_REPORT_PATH}}/*.xml

- name: Upload dist
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: python_pkg
path: |
Expand Down
5 changes: 1 addition & 4 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
BSD 3-Clause License

Copyright (c) 2021, QUA Platform
All rights reserved.
Copyright 2021 Q.M. Technologies Ltd.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
106 changes: 35 additions & 71 deletions examples/Qcodes_drivers/advanced-driver/advanced_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,8 @@ def __init__(
def update_readout_parameters(self):
"""Update the config with the readout length and amplitude set with self.readout_pulse_length() and self.readout_pulse_amplitude()."""
if self.readout_pulse_length() % 4 != 0:
raise ValueError(
"The readout pulse length must be an integer multiple of 4ns."
)
self.config["pulses"]["readout_pulse"]["length"] = int(
self.readout_pulse_length()
)
raise ValueError("The readout pulse length must be an integer multiple of 4ns.")
self.config["pulses"]["readout_pulse"]["length"] = int(self.readout_pulse_length())
self.config["integration_weights"]["cosine_weights"]["cosine"] = [
(1.0, self.config["pulses"]["readout_pulse"]["length"])
]
Expand All @@ -159,9 +155,7 @@ def update_readout_parameters(self):
(-1.0, self.config["pulses"]["readout_pulse"]["length"])
]
# update readout pulse amplitude
pulse = self.config["elements"][self.readout_element()]["operations"][
self.readout_operation()
]
pulse = self.config["elements"][self.readout_element()]["operations"][self.readout_operation()]
wf = self.config["pulses"][pulse]["waveforms"]["I"]
self.config["waveforms"][wf]["sample"] = self.readout_pulse_amplitude()
# Open QM
Expand Down Expand Up @@ -200,10 +194,7 @@ def measurement_declaration(self):
Q1_arr,
Q2_arr,
]
elif (
self.acquisition_mode() == "full_integration"
or self.acquisition_mode() == "full_demodulation"
):
elif self.acquisition_mode() == "full_integration" or self.acquisition_mode() == "full_demodulation":
I = declare(fixed)
Q = declare(fixed)
I_st = declare_stream()
Expand Down Expand Up @@ -288,76 +279,49 @@ def stream_results(self):
"""Create the stream processing based on the measurement mode (self.acquisition_mode()) and OPX scan 0d, 1d or 2d (self.opx_scan())"""
variables = self.measurement_variables
if self.opx_scan() == "0d":
if (
self.acquisition_mode() == "full_integration"
or self.acquisition_mode() == "full_demodulation"
):
if self.acquisition_mode() == "full_integration" or self.acquisition_mode() == "full_demodulation":
variables[2].buffer(self.n_avg()).map(FUNCTIONS.average()).save_all("I")
variables[3].buffer(self.n_avg()).map(FUNCTIONS.average()).save_all("Q")
elif self.acquisition_mode() == "raw_adc":
variables.input1().buffer(self.n_avg()).map(
FUNCTIONS.average()
).save_all("adc1")
variables.input2().buffer(self.n_avg()).map(
FUNCTIONS.average()
).save_all("adc2")
elif (
self.acquisition_mode() == "sliced_integration"
or self.acquisition_mode() == "sliced_demodulation"
):
variables[2].buffer(variables[5]).buffer(self.n_avg()).map(
FUNCTIONS.average()
).save_all("I")
variables[3].buffer(variables[5]).buffer(self.n_avg()).map(
FUNCTIONS.average()
).save_all("Q")
variables.input1().buffer(self.n_avg()).map(FUNCTIONS.average()).save_all("adc1")
variables.input2().buffer(self.n_avg()).map(FUNCTIONS.average()).save_all("adc2")
elif self.acquisition_mode() == "sliced_integration" or self.acquisition_mode() == "sliced_demodulation":
variables[2].buffer(variables[5]).buffer(self.n_avg()).map(FUNCTIONS.average()).save_all("I")
variables[3].buffer(variables[5]).buffer(self.n_avg()).map(FUNCTIONS.average()).save_all("Q")
elif self.opx_scan() == "1d":
if (
self.acquisition_mode() == "full_integration"
or self.acquisition_mode() == "full_demodulation"
):
variables[2].buffer(self.axis1_npoints()).buffer(self.n_avg()).map(
if self.acquisition_mode() == "full_integration" or self.acquisition_mode() == "full_demodulation":
variables[2].buffer(self.axis1_npoints()).buffer(self.n_avg()).map(FUNCTIONS.average()).save_all("I")
variables[3].buffer(self.axis1_npoints()).buffer(self.n_avg()).map(FUNCTIONS.average()).save_all("Q")
elif self.acquisition_mode() == "raw_adc":
variables.buffer(self.axis1_npoints()).input1().buffer(self.n_avg()).map(FUNCTIONS.average()).save_all(
"adc1"
)
variables.buffer(self.axis1_npoints()).input2().buffer(self.n_avg()).map(FUNCTIONS.average()).save_all(
"adc2"
)
elif self.acquisition_mode() == "sliced_integration" or self.acquisition_mode() == "sliced_demodulation":
variables[2].buffer(variables[5]).buffer(self.axis2_npoints()).buffer(self.n_avg()).map(
FUNCTIONS.average()
).save_all("I")
variables[3].buffer(self.axis1_npoints()).buffer(self.n_avg()).map(
variables[3].buffer(variables[5]).buffer(self.axis2_npoints()).buffer(self.n_avg()).map(
FUNCTIONS.average()
).save_all("Q")
elif self.acquisition_mode() == "raw_adc":
variables.buffer(self.axis1_npoints()).input1().buffer(
self.n_avg()
).map(FUNCTIONS.average()).save_all("adc1")
variables.buffer(self.axis1_npoints()).input2().buffer(
self.n_avg()
).map(FUNCTIONS.average()).save_all("adc2")
elif (
self.acquisition_mode() == "sliced_integration"
or self.acquisition_mode() == "sliced_demodulation"
):
variables[2].buffer(variables[5]).buffer(self.axis2_npoints()).buffer(
self.n_avg()
).map(FUNCTIONS.average()).save_all("I")
variables[3].buffer(variables[5]).buffer(self.axis2_npoints()).buffer(
self.n_avg()
).map(FUNCTIONS.average()).save_all("Q")
elif self.opx_scan() == "2d":
if (
self.acquisition_mode() == "full_integration"
or self.acquisition_mode() == "full_demodulation"
):
if self.acquisition_mode() == "full_integration" or self.acquisition_mode() == "full_demodulation":
if self.outer_averaging_loop():
variables[2].buffer(self.axis1_npoints()).buffer(
self.axis2_npoints()
).buffer(self.n_avg()).map(FUNCTIONS.average()).save_all("I")
variables[3].buffer(self.axis1_npoints()).buffer(
self.axis2_npoints()
).buffer(self.n_avg()).map(FUNCTIONS.average()).save_all("Q")
else:
variables[2].buffer(self.axis1_npoints()).buffer(self.n_avg()).map(
variables[2].buffer(self.axis1_npoints()).buffer(self.axis2_npoints()).buffer(self.n_avg()).map(
FUNCTIONS.average()
).buffer(self.axis2_npoints()).save_all("I")
variables[3].buffer(self.axis1_npoints()).buffer(self.n_avg()).map(
).save_all("I")
variables[3].buffer(self.axis1_npoints()).buffer(self.axis2_npoints()).buffer(self.n_avg()).map(
FUNCTIONS.average()
).buffer(self.axis2_npoints()).save_all("Q")
).save_all("Q")
else:
variables[2].buffer(self.axis1_npoints()).buffer(self.n_avg()).map(FUNCTIONS.average()).buffer(
self.axis2_npoints()
).save_all("I")
variables[3].buffer(self.axis1_npoints()).buffer(self.n_avg()).map(FUNCTIONS.average()).buffer(
self.axis2_npoints()
).save_all("Q")
else:
raise Exception(
"It is advises to use 'full_integration' or 'full_demodulation' only for performing 2d scans on the OPX to avoid memory overflow."
Expand Down
12 changes: 3 additions & 9 deletions examples/Qcodes_drivers/advanced-driver/hello_qcodes_advanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,11 @@
qc.config.core.db_location = db_file_path
initialise_or_create_database_at(db_file_path)
# Initialize qcodes experiment
experiment = load_or_create_experiment(
experiment_name=exp_name, sample_name=sample_name
)
experiment = load_or_create_experiment(experiment_name=exp_name, sample_name=sample_name)
# Initialize the qcodes station to which instruments will be added
station = qc.Station()
# Create the OPX instrument class
opx_instrument = OPXCustomSequence(
config, name="OPX_demo", host="127.0.0.1", cluster_name="my_cluster"
)
opx_instrument = OPXCustomSequence(config, name="OPX_demo", host="127.0.0.1", cluster_name="my_cluster")
# Add the OPX instrument to the qcodes station
station.add_component(opx_instrument)

Expand Down Expand Up @@ -143,9 +139,7 @@ def custom_sequence(self):
opx_instrument.outer_averaging_loop(False)
opx_instrument.n_avg(n_avg)
# Axis1 is the most inner loop
opx_instrument.set_sweep_parameters(
"axis1", pulse_lengths * 4, "ns", "pulse duration"
)
opx_instrument.set_sweep_parameters("axis1", pulse_lengths * 4, "ns", "pulse duration")
# Axis2 is the second loop
opx_instrument.set_sweep_parameters(
"axis2",
Expand Down
36 changes: 9 additions & 27 deletions examples/Qcodes_drivers/basic-driver/hello_qcodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
qc.config.core.db_location = db_file_path
initialise_or_create_database_at(db_file_path)
# Initialize qcodes experiment
experiment = load_or_create_experiment(
experiment_name=exp_name, sample_name=sample_name
)
experiment = load_or_create_experiment(experiment_name=exp_name, sample_name=sample_name)
# Initialize the qcodes station to which instruments will be added
station = qc.Station()
# Create the OPX instrument class
Expand Down Expand Up @@ -205,12 +203,8 @@ def OPX_1d_scan(simulate=False):
ramp_to_zero("gate_1")

with stream_processing():
I_st.buffer(len(biases)).buffer(n_avg).map(FUNCTIONS.average()).save_all(
"I"
)
Q_st.buffer(len(biases)).buffer(n_avg).map(FUNCTIONS.average()).save_all(
"Q"
)
I_st.buffer(len(biases)).buffer(n_avg).map(FUNCTIONS.average()).save_all("I")
Q_st.buffer(len(biases)).buffer(n_avg).map(FUNCTIONS.average()).save_all("Q")
return prog


Expand All @@ -235,9 +229,7 @@ def OPX_1d_scan(simulate=False):
do0d(
opx_instrument.run_exp,
opx_instrument.resume,
opx_instrument.get_measurement_parameter(
scale_factor=[("I", 1235, "pA"), ("Q", 1235, "pA")]
),
opx_instrument.get_measurement_parameter(scale_factor=[("I", 1235, "pA"), ("Q", 1235, "pA")]),
opx_instrument.halt,
do_plot=True,
exp=experiment,
Expand Down Expand Up @@ -369,12 +361,8 @@ def OPX_sliced_scan(simulate=False):
ramp_to_zero("gate_1")

with stream_processing():
I_st.buffer(nb_of_slices).buffer(len(biases)).buffer(n_avg).map(
FUNCTIONS.average()
).save_all("I")
Q_st.buffer(nb_of_slices).buffer(len(biases)).buffer(n_avg).map(
FUNCTIONS.average()
).save_all("Q")
I_st.buffer(nb_of_slices).buffer(len(biases)).buffer(n_avg).map(FUNCTIONS.average()).save_all("I")
Q_st.buffer(nb_of_slices).buffer(len(biases)).buffer(n_avg).map(FUNCTIONS.average()).save_all("Q")
return prog


Expand Down Expand Up @@ -444,12 +432,8 @@ def OPX_reflectometry(simulate=False):
save(Q, Q_st)

with stream_processing():
I_st.buffer(len(frequencies)).buffer(n_avg).map(
FUNCTIONS.average()
).save_all("I")
Q_st.buffer(len(frequencies)).buffer(n_avg).map(
FUNCTIONS.average()
).save_all("Q")
I_st.buffer(len(frequencies)).buffer(n_avg).map(FUNCTIONS.average()).save_all("I")
Q_st.buffer(len(frequencies)).buffer(n_avg).map(FUNCTIONS.average()).save_all("Q")
return prog


Expand Down Expand Up @@ -485,9 +469,7 @@ def OPX_reflectometry(simulate=False):
# Get the results from the OPX
data = opx_instrument.get_res()
# Store the results in the scodes database
datasaver.add_result(
(VP1, VP1()), (OPX_param, np.array(list(data.values())))
)
datasaver.add_result((VP1, VP1()), (OPX_param, np.array(list(data.values()))))
# Halt the OPX program at the end
opx_instrument.halt()
# Get the full dataset
Expand Down
12 changes: 3 additions & 9 deletions examples/Qcodes_drivers/stability-diagram/raster_scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
qc.config.core.db_location = db_file_path
initialise_or_create_database_at(db_file_path)
# Initialize qcodes experiment
experiment = load_or_create_experiment(
experiment_name=exp_name, sample_name=sample_name
)
experiment = load_or_create_experiment(experiment_name=exp_name, sample_name=sample_name)
# Initialize the qcodes station to which instruments will be added
station = qc.Station()
# Create the OPX instrument class
Expand Down Expand Up @@ -130,12 +128,8 @@ def raster_scan(simulate=False):
save(I, I_st)
save(Q, Q_st)
with stream_processing():
I_st.buffer(N1).buffer(N2).buffer(n_avg).map(FUNCTIONS.average()).save_all(
"I"
)
Q_st.buffer(N1).buffer(N2).buffer(n_avg).map(FUNCTIONS.average()).save_all(
"Q"
)
I_st.buffer(N1).buffer(N2).buffer(n_avg).map(FUNCTIONS.average()).save_all("I")
Q_st.buffer(N1).buffer(N2).buffer(n_avg).map(FUNCTIONS.average()).save_all("Q")

return prog

Expand Down
Loading
Loading