Skip to content

Commit

Permalink
Merge branch 'master' into precomp
Browse files Browse the repository at this point in the history
  • Loading branch information
ysalatheZI committed Jul 12, 2018
2 parents c060e61 + e3a1ff0 commit 2ee37b6
Show file tree
Hide file tree
Showing 115 changed files with 819,871 additions and 3,158 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ $RECYCLE.BIN/
# Pycqed specific files
# ======================

# Multiprocessing dask generated files
*dask-worker-space*

# code generated qasm files
*.qasm
# micro instruction assembly files
Expand All @@ -127,6 +130,7 @@ $RECYCLE.BIN/
*.txt
*.png
pycqed/measurement/openql_experiments/output/*
*.qmap

# data files
# test data files should be explicitly added by hand (overriding .gitignore)
Expand Down
37 changes: 30 additions & 7 deletions examples/AWG8_examples/AWG8_staircase_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
# 2. Starting AWG8 test program in CCL #
##########################################

AWG_type = 'microwave'
# AWG_type = 'flux'
# AWG_type = 'microwave'
AWG_type = 'flux'

if AWG_type == 'microwave':
example_fp = os.path.abspath(
Expand All @@ -64,6 +64,7 @@
CCL.start()



##########################################
# 3. Configuring the DIO protocol #
##########################################
Expand All @@ -72,17 +73,17 @@
import numpy as np

waveform_type = 'square'
# waveform_type = 'cos'
# waveform_type = 'sin'

if waveform_type == 'square':
for ch in range(8):
for i in range(32):
AWG8.set('wave_ch{}_cw{:03}'.format(ch+1, i), (np.ones(48)*i/32))
elif waveform_type == 'cos':
elif waveform_type == 'sin':
for ch in range(8):
for i in range(32):
AWG8.set('wave_ch{}_cw{:03}'.format(ch+1, i),
(np.cos(np.arange(48)/2)*i/32))
(np.sin(np.arange(48)/48*2*np.pi*i)*i/32))
else:
raise KeyError()

Expand All @@ -95,7 +96,29 @@
##########################################
# 4. Configuring the DIO protocol #
##########################################
AWG8.cfg_codeword_protocol('microwave') # <- ensures all bits are uploaded
AWG8.cfg_codeword_protocol(AWG_type) # <- ensures all bits are uploaded
AWG8.configure_codeword_protocol()
AWG8.upload_codeword_program()
AWG8.calibrate_dio_protocol()


success = AWG8.calibrate_dio_protocol()


#######################################################################
# 4. Verifying the DIO calibration with back to back staircase #
#######################################################################

if AWG_type == 'microwave':
example_fp = os.path.abspath(
os.path.join(pq.__path__[0], '..',
'examples', 'CCLight_example', 'qisa_test_assembly',
'consecutive_cws_double_back_to_back.qisa'))
elif AWG_type == 'flux':
example_fp = os.path.abspath(
os.path.join(pq.__path__[0], '..',
'examples', 'CCLight_example', 'qisa_test_assembly',
'consecutive_cws_flux_back_to_back.qisa'))

print(example_fp)
CCL.eqasm_program(example_fp)
CCL.start()
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ LDI r4, 150
LDI r3, 2
SUB r3, r4, r3
Loop:
qwait 100
bs 2 CW_01 s6
qwait 500

bs 2 CW_01 s0 | CW_31 s2
bs 2 CW_02 s0 | CW_30 s2
bs 2 CW_03 s0 | CW_29 s2
Expand Down Expand Up @@ -44,6 +44,8 @@ Loop:
bs 2 CW_29 s0 | CW_03 s2
bs 2 CW_30 s0 | CW_02 s2
bs 2 CW_31 s0 | CW_01 s2
bs 2 CW_01 s6
qwait 500
bs 1 MeasZ s0
BR always, loop
NOP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,22 @@ smis s7, {0, 1, 2, 3, 4, 5, 6}
smis s8, {0, 1, 5, 6}
smis s9, {2, 3, 4}
smit t0, {(2, 0)}
smit t0, {(3, 1)}
smit t1, {(3, 1)}
smit t2, {(6, 4)}
smit t3, {(3, 5)}

start:
bs 1 prepz s0 | prepz s2
qwait 9999
bs 2 CW_01 s6
bs 4 FL_CW_00 t0 | FL_CW_00 t1
qwait 4
bs 4 FL_CW_01 t0 | FL_CW_01 t1
qwait 4
bs 4 FL_CW_02 t0 | FL_CW_02 t1
qwait 4
bs 4 FL_CW_03 t0 | FL_CW_03 t1
qwait 4
bs 4 FL_CW_04 t0 | FL_CW_04 t1
qwait 4
bs 4 FL_CW_05 t0 | FL_CW_05 t1
qwait 4
bs 4 FL_CW_06 t0 | FL_CW_06 t1
qwait 4
bs 4 FL_CW_07 t0 | FL_CW_07 t1
qwait 4
qwait 20
bs 2 FL_CW_00 t0 | FL_CW_00 t1 | FL_CW_00 t2 | FL_CW_00 t3
bs 2 FL_CW_01 t0 | FL_CW_01 t1 | FL_CW_01 t2 | FL_CW_01 t3
bs 2 FL_CW_02 t0 | FL_CW_02 t1 | FL_CW_02 t2 | FL_CW_02 t3
bs 2 FL_CW_03 t0 | FL_CW_03 t1 | FL_CW_03 t2 | FL_CW_03 t3
bs 2 FL_CW_04 t0 | FL_CW_04 t1 | FL_CW_04 t2 | FL_CW_04 t3
bs 2 FL_CW_05 t0 | FL_CW_05 t1 | FL_CW_05 t2 | FL_CW_05 t3
bs 2 FL_CW_06 t0 | FL_CW_06 t1 | FL_CW_06 t2 | FL_CW_06 t3
bs 2 FL_CW_07 t0 | FL_CW_07 t1 | FL_CW_07 t2 | FL_CW_07 t3
bs 2 CW_01 s7
br always, start
nop
nop
Expand Down
113 changes: 24 additions & 89 deletions examples/QWG_examples/1 - Normal continues mode.ipynb

Large diffs are not rendered by default.

129 changes: 25 additions & 104 deletions examples/QWG_examples/3 - SSB vector to big, higher than 1.ipynb

Large diffs are not rendered by default.

135 changes: 27 additions & 108 deletions examples/QWG_examples/5 - Firmware overflow (matrix).ipynb

Large diffs are not rendered by default.

162 changes: 28 additions & 134 deletions examples/QWG_examples/6 - Firmware overflow with SSB.ipynb

Large diffs are not rendered by default.

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions pycqed/analysis/analysis_toolbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ def get_data_from_ma_v2(ma, param_names, numeric_params=None):
temp = ma.data_file
else:
extract_param = False
print(ma.folder)
warnings.warn(
'The data file attribute %s does not exist or hasn''t been coded for extraction.' % (param))
if extract_param:
Expand All @@ -433,7 +434,6 @@ def get_data_from_ma_v2(ma, param_names, numeric_params=None):
if numeric_params is not None:
if param in numeric_params:
data[param] = np.double(data[param])

return data


Expand Down Expand Up @@ -739,6 +739,7 @@ def get_timestamps_in_range(timestamp_start, timestamp_end=None,
for dirname in all_measdirs]
timestamps.reverse()
all_timestamps += timestamps
# print(folder, exact_label_match, all_timestamps, datetime_start, datetime_end, days_delta, all_measdirs)
# Ensures the order of the timestamps is ascending
all_timestamps.sort()
return all_timestamps
Expand Down Expand Up @@ -1626,6 +1627,8 @@ def datetime_from_timestamp(timestamp):
return datetime.datetime.strptime(timestamp, "%Y%m%d%H%M%S")
elif len(timestamp) == 15:
return datetime.datetime.strptime(timestamp, "%Y%m%d_%H%M%S")
else:
raise ValueError
except Exception as e:
print('Invalid timestamp :"{}"'.format(timestamp))
raise e
Expand Down Expand Up @@ -1861,8 +1864,10 @@ def linecut_plot(x, y, z, fig, ax,
z must be a 2D array with shape(len(x),len(y)).
'''
colormap = plt.cm.get_cmap('RdYlBu')
plt.gca().set_color_cycle([colormap(i) for i in np.linspace(
ax.set_prop_cycle('color', [colormap(i) for i in np.linspace(
0, 0.9, len(y))])


for i in range(len(y)):
label = '{}: {:.4g} {}'.format(
y_name, y[i], y_unit)
Expand Down
44 changes: 31 additions & 13 deletions pycqed/analysis/fitting_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def TwinLorentzFunc(f, A_gf_over_2, A, f0_gf_over_2, f0,
def Qubit_dac_to_freq(dac_voltage, f_max, E_c,
dac_sweet_spot, V_per_phi0=None,
dac_flux_coefficient=None,
asymmetry=0):
asymmetry=0, **kwargs):
'''
The cosine Arc model for uncalibrated flux for asymmetric qubit.
Expand Down Expand Up @@ -122,7 +122,7 @@ def Resonator_dac_to_freq(dac_voltage, f_max_qubit, f_0_res,
E_c, dac_sweet_spot,
coupling, V_per_phi0=None,
dac_flux_coefficient=None,
asymmetry=0):
asymmetry=0, **kwargs):
qubit_freq = Qubit_dac_to_freq(dac_voltage=dac_voltage, f_max=f_max_qubit, E_c=E_c,
dac_sweet_spot=dac_sweet_spot, V_per_phi0=V_per_phi0,
dac_flux_coefficient=dac_flux_coefficient,
Expand Down Expand Up @@ -668,35 +668,53 @@ def arc_guess(freq, dac, dd=0.1):
return fmax, fmin, dac[dac_ss_index], arc_len


def Resonator_dac_arch_guess(model, freq, dac_voltage, f_max_qubit: float = None, E_c: float = None):
fmax, fmin, dac_ss, period = arc_guess(freq=freq, dac=dac_voltage)
coup_guess = 15e6
def Resonator_dac_arch_guess(model, data, dac_voltage,
E_c: float = None, values=None):
if values is None:
values = {}

fmax, fmin, dac_ss, period = arc_guess(freq=data, dac=dac_voltage)

# todo make better f_res guess
f_res = np.mean(freq) # - (coup_guess ** 2 / (f_max_qubit - fmax))
f_res = np.mean(data) # - (coup_guess ** 2 / (f_max_qubit - fmax))
f_res = values.get('f_res', f_res)
f_max_qubit = values.get('f_max_qubit', None)
dac_ss = values.get('dac_sweet_spot', dac_ss)
period = values.get('V_per_phi0', period)
EC = values.get('E_c', 260e6)
coup_guess = values.get('coup_guess', 15e6)
asymmetry = values.get('asymmetry', 0)

f_max_qubit_vary = f_max_qubit is None
f_max_qubit = f_max_qubit or f_res - 500e6

model.set_param_hint('f_0_res', value=f_res, min=f_res / 2, max=2 * f_res)
model.set_param_hint('f_max_qubit', value=f_max_qubit, min=3e9, max=8.5e9, vary=f_max_qubit_vary)
model.set_param_hint('dac_sweet_spot', value=dac_ss, min=(dac_ss - 0.005) / 2, max=2 * (dac_ss + 0.005))
model.set_param_hint('V_per_phi0', value=period, min=(period - 0.005) / 3, max=5 * (period + 0.005))
model.set_param_hint('asymmetry', value=0, max=1, min=-1)
model.set_param_hint('asymmetry', value=asymmetry, max=1, min=-1)
model.set_param_hint('coupling', value=coup_guess, min=1e6, max=80e6)
E_c = E_c or 260e6
model.set_param_hint('E_c', value=E_c, min=50e6, max=400e6)
model.set_param_hint('E_c', value=EC, min=50e6, max=400e6)

params = model.make_params()
return params


def Qubit_dac_arch_guess(model, freq, dac_voltage):
fmax, fmin, dac_ss, period = arc_guess(freq=freq, dac=dac_voltage)
def Qubit_dac_arch_guess(model, data, dac_voltage, values=None):
if values is None:
values = {}
fmax, fmin, dac_ss, period = arc_guess(freq=data, dac=dac_voltage)
fmax = values.get('f_max', fmax)
dac_ss = values.get('dac_sweet_spot', dac_ss)
period = values.get('V_per_phi0', period)
EC = values.get('E_c', 260e6)
asymmetry = values.get('asymmetry', 0)

model.set_param_hint('f_max', value=fmax, min=0.7 * fmax, max=1.3 * fmax)
model.set_param_hint('dac_sweet_spot', value=dac_ss, min=(dac_ss - 0.005) / 2, max=2 * (dac_ss + 0.005))
model.set_param_hint('V_per_phi0', value=period, min=(period - 0.005) / 3, max=5 * (period + 0.005))
model.set_param_hint('asymmetry', value=0, max=1, min=-1)
model.set_param_hint('E_c', value=260e6, min=50e6, max=400e6)
model.set_param_hint('asymmetry', value=asymmetry, max=1, min=-1)
model.set_param_hint('E_c', value=EC, min=50e6, max=400e6)

params = model.make_params()
return params
Expand Down
Loading

0 comments on commit 2ee37b6

Please sign in to comment.