Skip to content

Commit

Permalink
Measurements work with LabOne 23.02.42414
Browse files Browse the repository at this point in the history
  • Loading branch information
msamiotis committed Sep 5, 2024
1 parent 8b4c05b commit 637559d
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 13 deletions.
7 changes: 7 additions & 0 deletions pycqed/instrument_drivers/library/DIO.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,13 @@ def calibrate(sender: CalInterface = None,
[27, 26, 25]
],
"trigger_bits": [31,15]
},
"calibration":{
"control_bits":[
[30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16],
[32]
],
"trigger_bits": [16]
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1125,8 +1125,11 @@ def generate_standard_waveforms(

def upload_single_qubit_phase_corrections(self):
commandtable_dict = {
"$schema": "http://docs.zhinst.com/hdawg/commandtable/v2/schema",
"header": {"version": "0.2"},
"$schema": "https://json-schema.org/draft-07/schema#",
"title": "AWG Command Table Schema",
"description": "Schema for ZI HDAWG AWG Command Table",
"version": "1.2.0",
"header": {"version": "1.2.0"},
"table": []
}

Expand Down
16 changes: 15 additions & 1 deletion pycqed/instrument_drivers/physical_instruments/QuTech/CC.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,20 @@ def output_dio_calibration_data(self, dio_mode: str, port: int=0) -> Tuple[int,
(3, list(staircase_sequence+ (staircase_sequence << 3)))]
dio_mask = 0x8FFF8FFF

elif dio_mode == "hdawg":
cc_prog = inspect.cleandoc("""
mainLoop: seq_out 0xFFFF0000,1
seq_out 0x00000000,1
jmp @mainLoop
""")

dio_mask = 0xbfff0000

expected_sequence = [(0, [1023]),
(1, [1023]),
(2, [1]),
(3, [1])]


elif dio_mode == "uhfqa": # FIXME: no official mode yet
cc_prog = inspect.cleandoc("""
Expand Down Expand Up @@ -358,4 +372,4 @@ def get_func():
def _gen_get_func_2par(fun, par1, par2):
def get_func():
return fun(par1, par2)
return get_func
return get_func
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def _add_extra_parameters(self):

self.add_parameter(
'cfg_codeword_protocol', initial_value='identical',
vals=validators.Enum('identical', 'microwave', 'novsm_microwave', 'flux'), docstring=(
vals=validators.Enum('identical', 'microwave', 'novsm_microwave', 'flux', "calibration"), docstring=(
'Used in the configure codeword method to determine what DIO'
' pins are used in for which AWG numbers.'),
parameter_class=ManualParameter)
Expand Down Expand Up @@ -330,6 +330,7 @@ def upload_commandtable(self, commandtable: Union[str, dict], awg_nr: int):
"""
if isinstance(commandtable, dict):
commandtable = json.dumps(commandtable, sort_keys=True, indent=2)

# validate json (without schema)
try:
json.loads(commandtable)
Expand Down Expand Up @@ -566,19 +567,21 @@ def _ensure_activity(self, awg_nr, mask_value=None, timeout=5):

return False

def _find_valid_delays(self, awgs_and_sequences):
def _find_valid_delays(self, awgs_and_sequences, dio_mask):
"""Finds valid DIO delay settings for a given AWG by testing all allowed delay settings for timing violations on the
configured bits. In addition, it compares the recorded DIO codewords to an expected sequence to make sure that no
codewords are sampled incorrectly."""
log.debug(" Finding valid delays")
valid_delays= []
for delay in range(16):
log.debug(f' Testing delay {delay}')
self.setd('raw/dios/0/delays/*/value', delay)
time.sleep(1)
for index in range(32):
self.setd(f'raw/dios/*/delays/{index}/value', delay)
self.seti('raw/dios/*/error/timingclear', 1)
time.sleep(3)
valid_sequence = True
for awg, sequence in awgs_and_sequences:
if self.geti('awgs/' + str(awg) + '/dio/error/timing') == 0:
if self.geti('raw/dios/0/error/timingsticky') == 0:
ts, cws = self._get_awg_dio_data(awg)
index = None
last_index = None
Expand All @@ -604,7 +607,6 @@ def _find_valid_delays(self, awgs_and_sequences):

if valid_sequence:
valid_delays.append(delay)

return set(valid_delays)

##########################################################################
Expand Down Expand Up @@ -639,14 +641,17 @@ def output_dio_calibration_data(self, dio_mode: str, port: int=0) -> Tuple[int,

def calibrate_dio_protocol(self, dio_mask: int, expected_sequence: List, port: int=0):
# FIXME: UHF driver does not use expected_sequence, why the difference

self.assure_ext_clock()
self.upload_codeword_program()

for awg, sequence in expected_sequence:
if not self._ensure_activity(awg, mask_value=dio_mask):
raise ziDIOActivityError('No or insufficient activity found on the DIO bits associated with AWG {}'.format(awg))

valid_delays = self._find_valid_delays(expected_sequence)
# self.setd('awgs/*/dio/mask/shift', 0)
# self.setd('awgs/0/dio/mask/value', 0)
valid_delays = self._find_valid_delays(expected_sequence, dio_mask)
print(valid_delays)
if len(valid_delays) == 0:
raise ziDIOCalibrationError('DIO calibration failed! No valid delays found')

Expand Down
3 changes: 1 addition & 2 deletions pycqed/measurement/qcodes_QtPlot_monkey_patching.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,8 @@

# Below: patch the QtPlot method to allow for setting a fixed color scale range

import qcodes
from qcodes_loop.plots.pyqtgraph import QtPlot
import qcodes_loop
from qcodes_loop.plots.pyqtgraph import QtPlot


def dummy_func(hist, **kwargs):
Expand Down

0 comments on commit 637559d

Please sign in to comment.