Skip to content

Commit

Permalink
fix numpy import + field qua_program
Browse files Browse the repository at this point in the history
  • Loading branch information
TheoLaudatQM committed Apr 18, 2024
1 parent 6d2d7e4 commit cb48051
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import numpy as np
import os
import qcodes as qc
from qcodes import initialise_or_create_database_at, load_or_create_experiment
Expand Down
1 change: 1 addition & 0 deletions examples/Qcodes_drivers/basic-driver/hello_qcodes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import numpy as np
import qcodes as qc
from qcodes import initialise_or_create_database_at, load_or_create_experiment
from qcodes.utils.dataset.doNd import do2d, do1d, do0d
Expand Down
1 change: 1 addition & 0 deletions examples/Qcodes_drivers/stability-diagram/raster_scan.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import numpy as np
import qcodes as qc
from qcodes import initialise_or_create_database_at, load_or_create_experiment
from qcodes.utils.dataset.doNd import do2d, do1d, do0d
Expand Down
1 change: 1 addition & 0 deletions examples/Qcodes_drivers/stability-diagram/spiral_scan.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import numpy as np
import qcodes as qc
from qcodes import initialise_or_create_database_at, load_or_create_experiment
from qcodes.utils.dataset.doNd import do2d, do1d, do0d
Expand Down
29 changes: 5 additions & 24 deletions qualang_tools/external_frameworks/qcodes/opx_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def __init__(
self.qm = None
self.qm_id = None
self.qmm = None
self.qua_program = None
self.close_other_machines = close_other_machines
self.config = None
self.result_handles = None
Expand Down Expand Up @@ -241,24 +242,6 @@ def update_qm(self):
self.qm.close()
self.open_qm(self.close_other_machines)

# Empty method that can be replaced by your pulse sequence in the main script
# This can also be modified so that you can put the sequences here directly...
def qua_program(self):
"""
Custom QUA program
:return: QUA program
"""
with program() as prog:
pass
return prog

# @abstractmethod
def get_prog(self):
"""Get the QUA program from the user"""
prog = self.qua_program
return prog

# @abstractmethod
def get_res(self):
"""
Expand Down Expand Up @@ -411,7 +394,7 @@ def get_measurement_parameter(self, scale_factor=((),)):
}
# Add amplitude and phase if I and Q are in the SP
if len(self.results["names"]) == 0:
self._get_stream_processing(self.get_prog())
self._get_stream_processing(self.qua_program)

if "I" in self.results["names"] and "Q" in self.results["names"]:
self.results["names"].append("R")
Expand Down Expand Up @@ -591,12 +574,11 @@ def run_exp(self):
"""
Execute a given QUA program, initialize the counter to 0 and creates a result handle to fetch the results.
"""
prog = self.get_prog()
if " demod" in generate_qua_script(prog, self.config):
if " demod" in generate_qua_script(self.qua_program, self.config):
self.demod_factor = 2
else:
self.demod_factor = 1
self.job = self.qm.execute(prog)
self.job = self.qm.execute(self.qua_program)
self.counter = 0
self.result_handles = self.job.result_handles

Expand Down Expand Up @@ -634,8 +616,7 @@ def simulate(self):
"""
Simulate a given QUA program and store the simulated waveform into the simulated_wf attribute.
"""
prog = self.get_prog()
self.job = self.qmm.simulate(self.config, prog, SimulationConfig(self.sim_time() // 4))
self.job = self.qmm.simulate(self.config, self.qua_program, SimulationConfig(self.sim_time() // 4))
simulated_samples = self.job.get_simulated_samples()
for con in [f"con{i}" for i in range(1, 10)]:
if hasattr(simulated_samples, con):
Expand Down

0 comments on commit cb48051

Please sign in to comment.