Skip to content

Commit

Permalink
Checkpoint before running a decent cryoscope
Browse files Browse the repository at this point in the history
  • Loading branch information
msamiotis committed May 1, 2024
1 parent f461e44 commit 0bc5ee4
Show file tree
Hide file tree
Showing 18 changed files with 2,683 additions and 46 deletions.
488 changes: 469 additions & 19 deletions pycqed/analysis_v2/cryoscope_v2_analysis.py

Large diffs are not rendered by default.

70 changes: 53 additions & 17 deletions pycqed/instrument_drivers/meta_instrument/HAL_Device.py
Original file line number Diff line number Diff line change
Expand Up @@ -2560,65 +2560,69 @@ def measure_cryoscope(
double_projections: bool = False,
wait_time_flux: int = 0,
update_FIRs: bool=False,
update_IIRs: bool=False,
waveform_name: str = "square",
max_delay=None,
twoq_pair=[2, 0],
disable_metadata: bool = False,
init_buffer=0,
analyze: bool = True,
prepare_for_timedomain: bool = True,
):
"""
Performs a cryoscope experiment to measure the shape of a flux pulse.
Args:
qubits (list):
a list of two target qubits
times (array):
array of measurment times
label (str):
used to label the experiment
waveform_name (str {"square", "custom_wf"}) :
defines the name of the waveform used in the
cryoscope. Valid values are either "square" or "custom_wf"
max_delay {float, "auto"} :
determines the delay in the pulse sequence
if set to "auto" this is automatically set to the largest
pulse duration for the cryoscope.
prepare_for_timedomain (bool):
calls self.prepare_for_timedomain on start
"""
assert self.ro_acq_weight_type() == 'optimal'
assert not (update_FIRs and update_IIRs), 'Can only either update IIRs or FIRs'
if update_FIRs or update_IIRs:
assert analyze==True, 'Analsis has to run for filter update'
if MC is None:
MC = self.instr_MC.get_instr()
if nested_MC is None:
nested_MC = self.instr_nested_MC.get_instr()

for q in qubits:
assert q in self.qubits()

Q_idxs = [self.find_instrument(q).cfg_qubit_nr() for q in qubits]

if prepare_for_timedomain:
self.prepare_for_timedomain(qubits=qubits)

if max_delay is None:
max_delay = 0
else:
max_delay = np.max(times) + 40e-9

Fl_lutmans = [self.find_instrument(q).instr_LutMan_Flux.get_instr() \
for q in qubits]

if waveform_name == "square":
Sw_functions = [swf.FLsweep(lutman, lutman.sq_length,
waveform_name="square") for lutman in Fl_lutmans]
swfs = swf.multi_sweep_function(Sw_functions)
flux_cw = "fl_cw_06"

flux_cw = "sf_square"
elif waveform_name == "custom_wf":
Sw_functions = [swf.FLsweep(lutman, lutman.custom_wf_length,
waveform_name="custom_wf") for lutman in Fl_lutmans]
swfs = swf.multi_sweep_function(Sw_functions)
flux_cw = "fl_cw_05"

flux_cw = "sf_custom_wf"
else:
raise ValueError(
'waveform_name "{}" should be either '
Expand Down Expand Up @@ -2658,22 +2662,40 @@ def measure_cryoscope(
)
MC.set_detector_function(d)
label = 'Cryoscope_{}_amps'.format('_'.join(qubits))
MC.run(label+self.msmt_suffix,disable_snapshot_metadata=disable_metadata)
MC.run(label,disable_snapshot_metadata=disable_metadata)
# Run analysis
a = ma2.cv2.multi_qubit_cryoscope_analysis(
label='Cryoscope',
update_FIRs=update_FIRs)
if analyze:
a = ma2.cv2.multi_qubit_cryoscope_analysis(
label='Cryoscope',
update_IIRs=update_IIRs,
update_FIRs=update_FIRs)
if update_FIRs:
for qubit, fltr in a.proc_data_dict['conv_filters'].items():
lin_dist_kern = self.find_instrument(f'lin_dist_kern_{qubit}')
filter_dict = {'params': {'weights': fltr},
'model': 'FIR', 'real-time': True }
lin_dist_kern.filter_model_04(filter_dict)

elif update_IIRs:
for qubit, fltr in a.proc_data_dict['exponential_filter'].items():
lin_dist_kern = self.find_instrument(f'lin_dist_kern_{qubit}')
filter_dict = {'params': fltr,
'model': 'exponential', 'real-time': True }
if fltr['amp'] > 0:
print('Amplitude of filter is positive (overfitting).')
print('Filter not updated.')
return True
else:
# Check wich is the first empty exponential filter
for i in range(4):
_fltr = lin_dist_kern.get(f'filter_model_0{i}')
if _fltr == {}:
lin_dist_kern.set(f'filter_model_0{i}', filter_dict)
return True
else:
print(f'filter_model_0{i} used.')
print('All exponential filter tabs are full. Filter not updated.')
return True



def measure_cryoscope_vs_amp(
self,
q0: str,
Expand Down Expand Up @@ -2894,6 +2916,20 @@ def measure_timing_1d_trace(
MC.set_sweep_points(latencies)
MC.run(mmt_label)

if latency_type == 'flux':
self.tim_flux_latency_0(0)
self.tim_flux_latency_1(0)
self.tim_flux_latency_2(0)
self.prepare_timing()

if latency_type == 'mw':
self.tim_mw_latency_0(0)
self.tim_mw_latency_1(0)
self.tim_mw_latency_2(0)
self.tim_mw_latency_3(0)
self.tim_mw_latency_4(0)
self.prepare_timing()

a_obj = ma2.Basic1DAnalysis(label=mmt_label)
return a_obj

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3037,7 +3037,7 @@ def measure_flux_frequency_timedomain(
fl_lutman.sq_amp(amplitude)
out_voltage = fl_lutman.sq_amp()*\
fl_lutman.cfg_awg_channel_amplitude()*\
fl_lutman.cfg_awg_channel_range()/2
fl_lutman.cfg_awg_channel_range()/2 # +/- 2.5V, else, 5Vpp
if prepare_for_timedomain:
self.prepare_for_timedomain()
fl_lutman.load_waveforms_onto_AWG_lookuptable()
Expand Down
9 changes: 0 additions & 9 deletions pycqed/measurement/openql_experiments/multi_qubit_oql.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,15 +608,6 @@ def Cryoscope(

p = OqlProgram("Cryoscope", platf_cfg)

# FIXME: the variables created here are effectively unused
if cc.upper() == 'CCL':
flux_target = twoq_pair
elif cc.upper() == 'QCC' or cc.upper() == 'CC':
cw_idx = int(flux_cw[-2:])
flux_cw = 'sf_{}'.format(_def_lm_flux[cw_idx]['name'].lower())
else:
raise ValueError('CC type not understood: {}'.format(cc))

k = p.create_kernel("RamZ_X")
k.prepz(qubit_idxs[0])
k.barrier([]) # alignment workaround
Expand Down
Empty file added pycqed/qce_utils/__init__.py
Empty file.
Empty file.
Loading

0 comments on commit 0bc5ee4

Please sign in to comment.