Skip to content

Commit

Permalink
Merge branch 'Proj/NovDemo' of https://github.com/DiCarloLab-Delft/Py…
Browse files Browse the repository at this point in the history
…cQED_py3 into Proj/NovDemo
  • Loading branch information
brianzi committed Feb 26, 2018
2 parents 57036e9 + c94929b commit d61ad39
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 20 deletions.
42 changes: 36 additions & 6 deletions pycqed/instrument_drivers/meta_instrument/LutMans/flux_lutman.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ def _add_waveform_parameters(self):
i+1),
initial_value=0, vals=vals.Numbers(),
parameter_class=ManualParameter)
self.add_parameter('mcz_identical_phase_corr',
initial_value=True, vals=vals.Bool(),
parameter_class=ManualParameter)

self.add_parameter('mcz_nr_of_repeated_gates',
initial_value=1, vals=vals.PermissiveInts(1, 40),
parameter_class=ManualParameter)
Expand Down Expand Up @@ -260,30 +264,52 @@ def _gen_cz(self):
return waveform


def _gen_phase_corr(self, phase_corr_amp:float = None):
def _get_phase_corr_offset(self):
net_charge = np.sum(self._wave_dict['cz'])
corr_samples = self.sampling_rate()*self.cz_phase_corr_length()
offset = -net_charge/corr_samples
return offset

def _gen_phase_corr(self, phase_corr_amp:float = None,
cz_offset_comp:bool =False):
"""
Generates a phase correction pulse.
Amp can be given as an argument in order to use it in the multi-pulse
if different amps are desired.
cz_offset_comp can be given to ensure a zero net flux
pulse. This should be False when generating phase correction for
an "idle" pulse.
"""
if phase_corr_amp is None:
phase_corr_amp = self.cz_phase_corr_amp()


if not self.czd_double_sided():
return wf.single_channel_block(
phase_corr_wf = wf.single_channel_block(
amp=phase_corr_amp, length=self.cz_phase_corr_length(),
sampling_rate=self.sampling_rate(), delay=0)
return phase_corr_wf

else:
block = wf.single_channel_block(
amp=phase_corr_amp,
length=self.cz_phase_corr_length()/2,
sampling_rate=self.sampling_rate(), delay=0)
return np.concatenate([block, -1*block])

if cz_offset_comp:
phase_corr_offset = self._get_phase_corr_offset()
else:
phase_corr_offset = 0

phase_corr_wf = np.concatenate([block, -1*block]) + phase_corr_offset
return phase_corr_wf

def _gen_cz_z(self, regenerate_cz=True):
if regenerate_cz:
self._wave_dict['cz'] = self._gen_cz()
phase_corr = self._gen_phase_corr()
phase_corr = self._gen_phase_corr(cz_offset_comp=True)
# CZ with phase correction
return np.concatenate([self._wave_dict['cz'], phase_corr])

Expand Down Expand Up @@ -315,8 +341,12 @@ def _gen_multi_cz(self, regenerate_cz=True):

waveform = np.zeros(max_nr_samples)
for i in range(self.mcz_nr_of_repeated_gates()):
phase_corr = self._gen_phase_corr(
phase_corr_amp=self.get('mcz_phase_corr_amp_{}'.format(i+1)))
if self.mcz_identical_phase_corr():
phase_corr = self._gen_phase_corr(cz_offset_comp=True)
else:
phase_corr = self._gen_phase_corr(
phase_corr_amp=self.get('mcz_phase_corr_amp_{}'.format(i+1)),
cz_offset_comp=True)
cz_z = np.concatenate([self._wave_dict['cz'], phase_corr])
sample_start_idx = int(self.mcz_gate_separation() *
self.sampling_rate())*i
Expand Down
28 changes: 17 additions & 11 deletions pycqed/instrument_drivers/meta_instrument/device_object_CCL.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,18 +136,20 @@ def prepare_fluxing(self):
# prepares by loading the awg_hack_program
q0 = self.qubits()[0]
fl_lutman = self.find_instrument(q0).instr_LutMan_Flux.get_instr()
fl_lutman.load_waveforms_onto_awg_lookuptable()
# fl_lutman.load_waveforms_onto_awg_lookuptable()
fl_lutman.load_waveforms_onto_AWG_lookuptable()
awg = fl_lutman.AWG.get_instr()
awg.upload_codeword_program(awgs=[0])

awg_hack_program_cz = """
while (1) {
waitDIOTrigger();
playWave("dev8005_wave_ch1_cw001", "dev8005_wave_ch2_cw001");
}
"""
# awg_hack_program_cz = """
# while (1) {
# waitDIOTrigger();
# playWave("dev8005_wave_ch1_cw001", "dev8005_wave_ch2_cw001");
# }
# """
# awg.configure_awg_from_string(0, awg_hack_program_cz)
# awg.configure_codeword_protocol()

awg.configure_awg_from_string(0, awg_hack_program_cz)
awg.configure_codeword_protocol()
awg.start()

def _prep_ro_setup_qubits(self):
Expand Down Expand Up @@ -501,7 +503,9 @@ def prepare_for_timedomain(self):
def measure_conditional_oscillation(self, q0: str, q1: str,
prepare_for_timedomain=True, MC=None,
wait_time_ns: int=0,
verbose=True):
label='',
flux_codeword='fl_cw_01',
verbose=True, disable_metadata=False):
"""
Measures the "conventional cost function" for the CZ gate that
is a conditional oscillation.
Expand All @@ -520,14 +524,16 @@ def measure_conditional_oscillation(self, q0: str, q1: str,
p = mqo.conditional_oscillation_seq(q0idx, q1idx,
platf_cfg=self.cfg_openql_platform_fn(),
angles=angles, wait_time=wait_time_ns,
flux_codeword=flux_codeword,
CZ_disabled=False)
s = swf.OpenQL_Sweep(openql_program=p,
CCL=self.instr_CC.get_instr(),
parameter_name='Phase', unit='deg')
MC.set_sweep_function(s)
MC.set_sweep_points(p.sweep_points)
MC.set_detector_function(self.get_correlation_detector())
MC.run('conditional_oscillation{}'.format(self.msmt_suffix))
MC.run('conditional_oscillation{}'.format(self.msmt_suffix, label),
disable_snapshot_metadata=disable_metadata)

a = ma2.Conditional_Oscillation_Analysis(
options_dict={'ch_idx_osc': self.qubits().index(q0),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ def configure_codeword_protocol(self, default_dio_timing: bool=False):

# In the mw protocol bits [0:7] -> CW0 and bits [(8+1):15] -> CW1
# N.B. DIO bit 8 (first of 2nd byte) not connected in AWG8!
if self.cfg_codeword_protocol() == 'microwave':
elif self.cfg_codeword_protocol() == 'microwave':
if awg_nr in [0, 1]:
self.set('awgs_{}_dio_mask_shift'.format(awg_nr), 0)
elif awg_nr in [2, 3]:
Expand All @@ -605,9 +605,12 @@ def configure_codeword_protocol(self, default_dio_timing: bool=False):
elif self.cfg_codeword_protocol() == 'flux':
# bits[0:3] for awg0_ch0, bits[4:6] for awg0_ch1 etc.
# self.set('awgs_{}_dio_mask_value'.format(awg_nr), 2**6-1)
self.set('awgs_{}_dio_mask_value'.format(awg_nr), 2**3-1)
# self.set('awgs_{}_dio_mask_shift'.format(awg_nr), awg_nr*6)
self.set('awgs_{}_dio_mask_shift'.format(awg_nr), 3)

# FIXME: this is a protocol that does identical flux pulses
# on each channel.
self.set('awgs_{}_dio_mask_value'.format(awg_nr), 2**3-1)
self.set('awgs_{}_dio_mask_shift'.format(awg_nr), 0)

####################################################
# Turn on device
Expand Down

0 comments on commit d61ad39

Please sign in to comment.