Skip to content

Commit

Permalink
coupler support for qblox drivers
Browse files Browse the repository at this point in the history
  • Loading branch information
aorgazf committed May 18, 2024
1 parent 952a13d commit 43be2dd
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/qibolab/instruments/qblox/cluster_qcm_bb.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ def _get_next_sequencer(self, port, frequency, qubits: dict, couplers: dict = {}
# create sequencer wrapper
sequencer = Sequencer(next_sequencer_number)
sequencer.qubit = qubit.name if qubit else None
sequencer.coupler = coupler.name if coupler else None
return sequencer

def get_if(self, pulse):
Expand Down Expand Up @@ -556,7 +557,9 @@ def process_pulse_sequence(
)

else: # qubit_sweeper_parameters
if sweeper.qubits and sequencer.qubit in [_.name for _ in sweeper.qubits]:
if (sweeper.qubits and sequencer.qubit in [_.name for _ in sweeper.qubits]) or (
sweeper.couplers and sequencer.coupler in [_.name for _ in sweeper.couplers]
):
# plays an active role
if sweeper.parameter == Parameter.bias:
reference_value = self.ports[port].offset
Expand Down
10 changes: 8 additions & 2 deletions src/qibolab/instruments/qblox/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def disconnect(self):
self.cluster.disconnect()
self.is_connected = False

def _set_module_channel_map(self, module: ClusterQRM_RF, qubits: dict):
def _set_module_channel_map(self, module: ClusterQRM_RF, qubits: dict, couplers: dict):
"""Retrieve all the channels connected to a specific Qblox module.
This method updates the `channel_port_map` attribute of the specified Qblox module
Expand All @@ -111,6 +111,10 @@ def _set_module_channel_map(self, module: ClusterQRM_RF, qubits: dict):
for channel in qubit.channels:
if channel.port and channel.port.module.name == module.name:
module.channel_map[channel.name] = channel
for coupler in couplers.values():
for channel in coupler.channels:
if channel.port and channel.port.module.name == module.name:
module.channel_map[channel.name] = channel
return list(module.channel_map)

def _execute_pulse_sequence(
Expand Down Expand Up @@ -167,7 +171,7 @@ def _execute_pulse_sequence(
data = {}
for name, module in self.modules.items():
# from the pulse sequence, select those pulses to be synthesised by the module
module_channels = self._set_module_channel_map(module, qubits)
module_channels = self._set_module_channel_map(module, qubits, couplers)
module_pulses[name] = sequence.get_channel_pulses(*module_channels)

if isinstance(module, (ClusterQRM_RF, ClusterQCM_RF)):
Expand Down Expand Up @@ -260,6 +264,7 @@ def sweep(self, qubits: dict, couplers: dict, sequence: PulseSequence, options:
values=sweeper.values,
pulses=ps,
qubits=sweeper.qubits,
couplers=sweeper.couplers,
type=sweeper.type,
)
)
Expand Down Expand Up @@ -418,6 +423,7 @@ def _sweep_recursion(
values=_values,
pulses=sweeper.pulses,
qubits=sweeper.qubits,
couplers=sweeper.couplers,
)
self._sweep_recursion(
qubits, couplers, sequence, options, *((split_sweeper,) + sweepers[1:]), results=results
Expand Down
1 change: 1 addition & 0 deletions src/qibolab/instruments/qblox/sequencer.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,4 @@ def __init__(self, number: int):
self.weights: dict = {}
self.program: Program = Program()
self.qubit = None # self.qubit: int | str = None
self.coupler = None # self.coupler: int | str = None
15 changes: 14 additions & 1 deletion src/qibolab/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from qibolab.couplers import Coupler
from qibolab.execution_parameters import ExecutionParameters
from qibolab.instruments.abstract import Controller, Instrument, InstrumentId
from qibolab.pulses import PulseSequence, ReadoutPulse
from qibolab.pulses import FluxPulse, PulseSequence, ReadoutPulse
from qibolab.qubits import Qubit, QubitId, QubitPair, QubitPairId
from qibolab.sweeper import Sweeper

Expand Down Expand Up @@ -366,6 +366,19 @@ def create_qubit_readout_pulse(self, qubit, start):
qubit = self.get_qubit(qubit)
return self.create_MZ_pulse(qubit, start)

def create_qubit_flux_pulse(self, qubit, start, duration, amplitude=1):
qubit = self.get_qubit(qubit)
pulse = FluxPulse(
start=start,
duration=duration,
amplitude=amplitude,
shape="Rectangular",
channel=self.qubits[qubit].flux.name,
qubit=qubit,
)
pulse.duration = duration
return pulse

def create_coupler_pulse(self, coupler, start, duration=None, amplitude=None):
coupler = self.get_coupler(coupler)
pulse = self.couplers[coupler].native_pulse.CP.pulse(start)
Expand Down
10 changes: 10 additions & 0 deletions src/qibolab/pulses.py
Original file line number Diff line number Diff line change
Expand Up @@ -1133,6 +1133,15 @@ def copy(self): # -> Pulse|ReadoutPulse|DrivePulse|FluxPulse:
self.channel,
self.qubit,
)
elif type(self) == CouplerFluxPulse:
return CouplerFluxPulse(
self.start,
self.duration,
self.amplitude,
self._shape,
self.channel,
self.qubit,
)
else:
# return eval(self.serial)
return Pulse(
Expand Down Expand Up @@ -1610,6 +1619,7 @@ class PulseConstructor(Enum):
READOUT = ReadoutPulse
DRIVE = DrivePulse
FLUX = FluxPulse
COUPLERFLUX = CouplerFluxPulse


class PulseSequence:
Expand Down

0 comments on commit 43be2dd

Please sign in to comment.