Skip to content

Commit

Permalink
PycQED is now stable (both offline and online)
Browse files Browse the repository at this point in the history
Hurray!!
  • Loading branch information
msamiotis committed Nov 6, 2024
1 parent 6f50c98 commit 41c436a
Show file tree
Hide file tree
Showing 5 changed files with 146 additions and 69 deletions.
66 changes: 20 additions & 46 deletions pycqed/instrument_drivers/meta_instrument/HAL/HAL_ShimMQ.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import logging
import warnings
import itertools
from collections import OrderedDict
import numpy as np
from deprecated import deprecated
Expand Down Expand Up @@ -230,10 +229,8 @@ def prepare_for_timedomain(
self.prepare_readout(qubits=qubits, reduced=reduced)
if reduced:
return

if bypass_flux is False:
self.prepare_fluxing(qubits=qubits)

self.prepare_timing()

for qb_name in qubits:
Expand All @@ -244,7 +241,6 @@ def prepare_for_timedomain(

# self._prep_td_configure_VSM()

# FIXME: setup dependent
def prepare_for_inspire(self):

# LDC. Trying to ensure readout is digitized, uses optimal weights, and does single shots w/o averaging
Expand Down Expand Up @@ -281,8 +277,6 @@ def prepare_for_inspire(self):

name = 'System_snapshot'
MC._set_measurement_name(name)
# FIXME: Replace absolute data directory path
# MC.datadir('D:\Experiments\Demonstrator_Execute_Data\Data')
######################
with measurement_control.h5d.Data(
name=MC._get_measurement_name(), datadir=MC.datadir()
Expand Down Expand Up @@ -571,14 +565,6 @@ def _add_tim_parameters(self):
)

def _add_ro_parameters(self):
# FIXME: no longer used, now in UHFQC_RO_LutMan.LO_freq
# self.add_parameter(
# 'ro_lo_freq',
# unit='Hz',
# docstring='Frequency of the common LO for all RO pulses.',
# parameter_class=ManualParameter
# )

# actually, it should be possible to build the integration
# weights obeying different settings for different
# qubits, but for now we use a fixed common value.
Expand Down Expand Up @@ -674,6 +660,15 @@ def _add_ro_parameters(self):
initial_value = False,
)

# ADDED BY RDC 22-03-2023
self.add_parameter(
"use_online_settings",
docstring="If True, it uses HAL_ShimMQ.py lines for Quantum Inspire",
parameter_class=ManualParameter,
vals=vals.Bool(),
initial_value = False,
)

def _add_parameters(self):
self._add_instr_parameters()
self._add_tim_parameters()
Expand Down Expand Up @@ -738,20 +733,6 @@ def _set_dio_map(self, dio_map_dict):
# private functions: prepare
##########################################################################

# FIXME: unused
# def _grab_instruments_from_qb(self):
# """
# initialize instruments that should only exist once from the first
# qubit. Maybe must be done in a more elegant way (at least check
# uniqueness).
# """
#
# qb = self.find_instrument(self.qubits()[0])
# self.instr_MC(qb.instr_MC())
# self.instr_VSM(qb.instr_VSM())
# self.instr_CC(qb.instr_CC())
# self.cfg_openql_platform_fn(qb.cfg_openql_platform_fn())

def _prep_ro_sources(self, qubits):
"""
turn on and configure the RO LO's of all qubits to be measured and
Expand Down Expand Up @@ -978,33 +959,26 @@ def _prep_ro_pulses(self, qubits):
ro_lm.set("M_down_length1_R{}".format(res_nr), qb.ro_pulse_down_length1())
ro_lm.set("M_down_amp1_R{}".format(res_nr), qb.ro_pulse_down_amp1())
ro_lm.set("M_down_phi1_R{}".format(res_nr), qb.ro_pulse_down_phi1())
# Addede by LDC on 2022/09/16
# ro_lm.set("M_final_length_R{}".format(res_nr), qb.ro_pulse_final_length())
# ro_lm.set("M_final_amp_R{}".format(res_nr), qb.ro_pulse_final_amp())
# ro_lm.set("M_final_delay_R{}".format(res_nr), qb.ro_pulse_final_delay())


for ro_lm in ro_lms:
# list comprehension should result in a list with each individual resonator + the combination of all simultaneously
# list comprehension should result in a list with each
# individual resonator + the combination of all simultaneously
# resonator_combs = [[r] for r in resonators_in_lm[ro_lm.name]] + \
# [resonators_in_lm[ro_lm.name]]

# list comprehension should result in a list with the combination of all simultaneously
# resonator_combs = [resonators_in_lm[ro_lm.name]]
# log.info('Setting resonator combinations for {} to {}'.format(
# ro_lm.name, resonator_combs))

# should result in a list with all the possible combinations of resonators
resonator_combs = []
for L in range(1, len(resonators_in_lm[ro_lm.name])+1):
for subset in itertools.combinations(resonators_in_lm[ro_lm.name],L):
resonator_combs.append(list(subset))
resonator_combs = [resonators_in_lm[ro_lm.name]]
log.info('Setting resonator combinations for {} to {}'.format(
ro_lm.name, resonator_combs))

# FIXME: temporary fix so device object doesnt mess with
# the resonator combinations. Better strategy should be implemented
# ro_lm.resonator_combinations(resonator_combs)
if self.use_online_settings() == False:
ro_lm.resonator_combinations(resonator_combs)
else:
pass

ro_lm.load_DIO_triggered_sequence_onto_UHFQC()

# FIXME: unused
def _prep_ro_instantiate_detectors(self):
"""
Instantiate acquisition detectors.
Expand Down
31 changes: 19 additions & 12 deletions pycqed/instrument_drivers/meta_instrument/HAL_Device.py
Original file line number Diff line number Diff line change
Expand Up @@ -1545,6 +1545,7 @@ def measure_ssro_multi_qubit(
analyze=True,
shots_per_meas: int = 2 ** 16,
label='Mux_SSRO',
return_analysis=True,
disable_metadata: bool = False,
MC=None):
"""
Expand Down Expand Up @@ -1655,7 +1656,11 @@ def measure_ssro_multi_qubit(
threshold = a.qoi[label]['threshold_raw']
# LDC turning off this update for now. 2022/06/28
# self.find_instrument(qubit).ro_acq_threshold(threshold)
return a.plot_dicts['cross_fid_matrix_post']['prob_matrix']

if return_analysis:
return a.plot_dicts['cross_fid_matrix_post']['prob_matrix']
else:
return True


def measure_ssro_single_qubit(
Expand Down Expand Up @@ -5668,15 +5673,16 @@ def measure_T1_TLS(
if MC is None:
MC = self.instr_MC.get_instr()

for qubit in q_parks:
QUBIT = self.find_instrument(qubit)
flux_lm_QUBIT = self.find_instrument(QUBIT.instr_LutMan_Flux())
flux_lm_QUBIT.sq_length(q0_pulse_length)
flux_lm_QUBIT.park_length(q0_pulse_length)
flux_lm_QUBIT.sq_amp(0.25)
flux_lm_QUBIT.park_amp(0.25)
flux_lm_QUBIT.cfg_awg_channel_amplitude(0.3)
self.prepare_for_timedomain(qubits = q_parks, bypass_flux = False)
if len(q_parks)>0:
for qubit in q_parks:
QUBIT = self.find_instrument(qubit)
flux_lm_QUBIT = self.find_instrument(QUBIT.instr_LutMan_Flux())
flux_lm_QUBIT.sq_length(q0_pulse_length)
flux_lm_QUBIT.park_length(q0_pulse_length)
flux_lm_QUBIT.sq_amp(0.25)
flux_lm_QUBIT.park_amp(0.25)
flux_lm_QUBIT.cfg_awg_channel_amplitude(0.3)
self.prepare_for_timedomain(qubits = q_parks, bypass_flux = False)

Q0 = self.find_instrument(q0)
flux_lm_Q0 = self.find_instrument(Q0.instr_LutMan_Flux())
Expand All @@ -5697,8 +5703,9 @@ def measure_T1_TLS(

q0_idx = Q0.cfg_qubit_nr()
q_parks_idx = []
for q in q_parks:
q_parks_idx.append(self.find_instrument(q).cfg_qubit_nr())
if len(q_parks)>0:
for q in q_parks:
q_parks_idx.append(self.find_instrument(q).cfg_qubit_nr())

p = mqo.T1_TLS(
q0_idx = q0_idx,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,10 @@ def create_dep_graph(self,

self.add_node('Cross Fidelity',
calibrate_function=self.device.name + '.measure_ssro_multi_qubit',
calibrate_function_args={'qubits': qubit_list, 'initialize': True, 'disable_metadata': True})
calibrate_function_args={'qubits': qubit_list,
'initialize': True,
'return_analysis': False,
'disable_metadata': True})

#########################
# Create all dependencies
Expand Down Expand Up @@ -681,7 +684,7 @@ def create_dep_graph(self,
if CZindex==0:
pair=['NW', 'W', 'C']
flux_lm_C = self.device.find_instrument('flux_lm_C')
flux_lm_C.cfg_awg_channel_amplitude(0.32)
flux_lm_C.cfg_awg_channel_amplitude(0.4)
self.device.prepare_for_timedomain(qubits = ['C'], bypass_flux = False)
elif CZindex==1:
pair=['NW', 'C', 'W']
Expand All @@ -690,7 +693,7 @@ def create_dep_graph(self,
elif CZindex==3:
pair=['NE', 'E', 'C']
flux_lm_C = self.device.find_instrument('flux_lm_C')
flux_lm_C.cfg_awg_channel_amplitude(0.392)
flux_lm_C.cfg_awg_channel_amplitude(0.4)
self.device.prepare_for_timedomain(qubits = ['C'], bypass_flux = False)
elif CZindex==4:
pair=['W', 'SW']
Expand Down
Loading

0 comments on commit 41c436a

Please sign in to comment.