Skip to content

Commit

Permalink
several fixes, flux, predistortion & dc_dac-rf_dac
Browse files Browse the repository at this point in the history
  • Loading branch information
aorgazf committed Oct 15, 2024
1 parent 3d0fb62 commit 893f7da
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 346 deletions.
7 changes: 5 additions & 2 deletions src/qibosoq/components/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class OperationCode(IntEnum):
EXECUTE_PULSE_SEQUENCE = auto()
EXECUTE_PULSE_SEQUENCE_RAW = auto()
EXECUTE_SWEEPS = auto()
SET_BIAS = auto()


@dataclass
Expand All @@ -38,8 +39,10 @@ class Qubit:

bias: Optional[float] = None
"""Amplitude factor, for sweetspot."""
dac: Optional[int] = None
"""DAC responsible for flux control."""
dc_dac: Optional[int] = None
"""DAC responsible for flux control biasing."""
rf_dac: Optional[int] = None
"""DAC responsible for flux control fast rf pulses."""


class Parameter(str, Enum):
Expand Down
136 changes: 0 additions & 136 deletions src/qibosoq/drivers/LMK04828_245.25.txt

This file was deleted.

128 changes: 0 additions & 128 deletions src/qibosoq/drivers/LMK04828_245.76.txt

This file was deleted.

1 change: 1 addition & 0 deletions src/qibosoq/drivers/TI_DAC80508.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def __init__(self):
self.spi.xfer(to_send)

def set_bias(self, dac:int, bias: float):
dac = int(dac)
if not dac in DACS:
raise ValueError(f"dac should be any of {DACS}")
if abs(bias) > MAX_VOLTAGE:
Expand Down
13 changes: 9 additions & 4 deletions src/qibosoq/programs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ def declare_readout_freq(self):
ro_ch = readout.dac
if adc_ch not in adc_ch_already_declared:
adc_ch_already_declared.append(adc_ch)
length = self.soc.us2cycles(readout.duration, gen_ch=ro_ch)
length = self.soc.us2cycles(readout.duration, ro_ch=adc_ch)
# length = self.soc.us2cycles(readout.duration + 10, ro_ch=adc_ch)

freq = readout.frequency

Expand Down Expand Up @@ -215,12 +216,14 @@ def execute_readout_pulse(
adcs = [elem.adc]

if isinstance(elem, Pulse): #
lag = self.soc.us2cycles(88/1000) # 88 ns
self.measure(
pulse_ch=elem.dac,
adcs=adcs,
adc_trig_offset=self.ro_time_of_flight,
wait=False,
syncdelay=self.syncdelay,
t=lag
)
elif isinstance(elem, Measurement):
self.trigger(adcs, adc_trig_offset=self.ro_time_of_flight)
Expand Down Expand Up @@ -260,11 +263,13 @@ def collect_shots(self) -> Tuple[list, list]:
"""Read the internal buffers and returns single shots (i,q)."""
adcs = [] # list of adcs per readouts (not unique values)
lengths = [] # length of readouts (only one per adcs)
# This assumes that if there are two readouts on the same qubit they are both of the same length, why?
# if different lenghts are an issue, then it should be raised as an error.
for elem in (elem for elem in self.sequence if elem.type == "readout"):
adc_ch = elem.adc
ro_ch = elem.dac
if adc_ch not in adcs:
lengths.append(self.soc.us2cycles(elem.duration, gen_ch=ro_ch))
lengths.append(self.soc.us2cycles(elem.duration, ro_ch=adc_ch))
adcs.append(adc_ch)

_, adc_count = np.unique(adcs, return_counts=True)
Expand All @@ -286,8 +291,8 @@ def collect_shots(self) -> Tuple[list, list]:
shape = (2, count, self.reps)

stacked = (
np.stack((self.di_buf[idx], self.dq_buf[idx]))[:, : np.prod(shape[1:])]
/ np.array(lengths)[:, np.newaxis]
np.stack((self.di_buf[idx], self.dq_buf[idx]))[:, : np.prod(shape[1:])] # this has dimensions (2, number_of_shots), it used to be (2, #adcs, number_of_readouts*number_of_shots)
/ np.array([lengths[idx]])[:, np.newaxis] # this has dimensions (4, 1)
)

tot.append(stacked.reshape(shape).tolist())
Expand Down
Loading

0 comments on commit 893f7da

Please sign in to comment.