Closed elrama- closed 5 years ago
[ At the moment of the creation of this Pull-Request, THIS BRANCH IS NOT READY. DO NOT APPROVE. Its purpose is to keep track of changes until stated otherwise ]
@elrama- . The tests are failing locally on my side. It appears this has to do with the way the schema for the LutMap has changed (idx as key as opposed to name as key). I think this should be easy to fix. (see below for test output)
I've also gone over the code and added some docstrings. I think the code is ready to merge provided the remaining problems are fixed.
Output of running tests locally.
[Adriaan:...Lab_Repositories/PycQED_py3]$ py.test pycqed/tests/test_flux_lutman.py -v -p no:django
============================================== test session starts ==============================================
platform darwin -- Python 3.6.8, pytest-3.8.1, py-1.5.3, pluggy-0.7.1 -- /Users/Adriaan/anaconda/bin/python
cachedir: .pytest_cache
rootdir: /Users/Adriaan/GitHubRepos/DiCarloLab_Repositories/PycQED_py3, inifile: pytest.ini
plugins: xdist-1.22.2, remotedata-0.2.1, openfiles-0.3.0, forked-0.2, doctestplus-0.1.3, cov-2.4.0, arraydiff-0.2, celery-4.2.1
collected 44 items
pycqed/tests/test_flux_lutman.py::TestMultiQubitFluxLutMan::test_program_hash_differs_AWG8_flux_lutman PASSED [ 2%]
pycqed/tests/test_flux_lutman.py::TestMultiQubitFluxLutMan::test_amp_to_dac_val_conversions PASSED [ 4%]
pycqed/tests/test_flux_lutman.py::TestMultiQubitFluxLutMan::test_partner_lutman_loading PASSED [ 6%]
pycqed/tests/test_flux_lutman.py::TestMultiQubitFluxLutMan::test_plot_level_diagram PASSED [ 9%]
pycqed/tests/test_flux_lutman.py::TestMultiQubitFluxLutMan::test_plot_cz_trajectory PASSED [ 11%]
pycqed/tests/test_flux_lutman.py::TestMultiQubitFluxLutMan::test_standard_cz_waveform PASSED [ 13%]
pycqed/tests/test_flux_lutman.py::TestMultiQubitFluxLutMan::test_double_sided_cz_waveform PASSED [ 15%]
pycqed/tests/test_flux_lutman.py::TestMultiQubitFluxLutMan::test_calc_amp_to_freq_unknown_state PASSED [ 18%]
pycqed/tests/test_flux_lutman.py::TestMultiQubitFluxLutMan::test_calc_amp_to_freq_01 PASSED [ 20%]
pycqed/tests/test_flux_lutman.py::TestMultiQubitFluxLutMan::test_calc_amp_to_freq_02 PASSED [ 22%]
pycqed/tests/test_flux_lutman.py::TestMultiQubitFluxLutMan::test_calc_amp_to_freq_10 PASSED [ 25%]
pycqed/tests/test_flux_lutman.py::TestMultiQubitFluxLutMan::test_calc_amp_to_freq_11 PASSED [ 27%]
pycqed/tests/test_flux_lutman.py::TestMultiQubitFluxLutMan::test_calc_transition_freq_inversion PASSED [ 29%]
pycqed/tests/test_flux_lutman.py::TestMultiQubitFluxLutMan::test_calc_amp_to_eps PASSED [ 31%]
pycqed/tests/test_flux_lutman.py::TestMultiQubitFluxLutMan::test_calc_detuning_freq_inversion PASSED [ 34%]
pycqed/tests/test_flux_lutman.py::TestMultiQubitFluxLutMan::test_custom_wf PASSED [ 36%]
pycqed/tests/test_flux_lutman.py::TestMultiQubitFluxLutMan::test_generate_standard_flux_waveforms PASSED [ 38%]
pycqed/tests/test_flux_lutman.py::TestMultiQubitFluxLutMan::test_load_waveforms_onto_AWG_lookuptable PASSED [ 40%]
pycqed/tests/test_flux_lutman.py::TestMultiQubitFluxLutMan::test_length_ratio PASSED [ 43%]
pycqed/tests/test_flux_lutman.py::TestMultiQubitFluxLutMan::test_czd_signs PASSED [ 45%]
pycqed/tests/test_flux_lutman.py::TestMultiQubitFluxLutMan::test_render_wave PASSED [ 47%]
pycqed/tests/test_flux_lutman.py::TestLegacyFluxLutMan::test_program_hash_differs_AWG8_flux_lutman PASSED [ 50%]
pycqed/tests/test_flux_lutman.py::TestLegacyFluxLutMan::test_amp_to_dac_val_conversions PASSED [ 52%]
pycqed/tests/test_flux_lutman.py::TestLegacyFluxLutMan::test_partner_lutman_loading FAILED [ 54%]
pycqed/tests/test_flux_lutman.py::TestLegacyFluxLutMan::test_plot_level_diagram PASSED [ 56%]
pycqed/tests/test_flux_lutman.py::TestLegacyFluxLutMan::test_plot_cz_trajectory PASSED [ 59%]
pycqed/tests/test_flux_lutman.py::TestLegacyFluxLutMan::test_standard_cz_waveform PASSED [ 61%]
pycqed/tests/test_flux_lutman.py::TestLegacyFluxLutMan::test_double_sided_cz_waveform PASSED [ 63%]
pycqed/tests/test_flux_lutman.py::TestLegacyFluxLutMan::test_calc_amp_to_freq_unknown_state PASSED [ 65%]
pycqed/tests/test_flux_lutman.py::TestLegacyFluxLutMan::test_calc_amp_to_freq_01 PASSED [ 68%]
pycqed/tests/test_flux_lutman.py::TestLegacyFluxLutMan::test_calc_amp_to_freq_02 PASSED [ 70%]
pycqed/tests/test_flux_lutman.py::TestLegacyFluxLutMan::test_calc_amp_to_freq_10 PASSED [ 72%]
pycqed/tests/test_flux_lutman.py::TestLegacyFluxLutMan::test_calc_amp_to_freq_11 PASSED [ 75%]
pycqed/tests/test_flux_lutman.py::TestLegacyFluxLutMan::test_calc_transition_freq_inversion PASSED [ 77%]
pycqed/tests/test_flux_lutman.py::TestLegacyFluxLutMan::test_calc_amp_to_eps PASSED [ 79%]
pycqed/tests/test_flux_lutman.py::TestLegacyFluxLutMan::test_calc_detuning_freq_inversion PASSED [ 81%]
pycqed/tests/test_flux_lutman.py::TestLegacyFluxLutMan::test_custom_wf FAILED [ 84%]
pycqed/tests/test_flux_lutman.py::TestLegacyFluxLutMan::test_generate_standard_flux_waveforms PASSED [ 86%]
pycqed/tests/test_flux_lutman.py::TestLegacyFluxLutMan::test_load_waveforms_onto_AWG_lookuptable FAILED [ 88%]
pycqed/tests/test_flux_lutman.py::TestLegacyFluxLutMan::test_generate_composite PASSED [ 90%]
pycqed/tests/test_flux_lutman.py::TestLegacyFluxLutMan::test_uploading_composite_waveform PASSED [ 93%]
pycqed/tests/test_flux_lutman.py::TestLegacyFluxLutMan::test_length_ratio PASSED [ 95%]
pycqed/tests/test_flux_lutman.py::TestLegacyFluxLutMan::test_czd_signs PASSED [ 97%]
pycqed/tests/test_flux_lutman.py::TestLegacyFluxLutMan::test_render_wave PASSED [100%]
=================================================== FAILURES ====================================================
_______________________________ TestLegacyFluxLutMan.test_partner_lutman_loading ________________________________
self = <test_flux_lutman.TestLegacyFluxLutMan object at 0x113581940>
def test_partner_lutman_loading(self):
self.fluxlutman.sq_amp(.3)
self.fluxlutman_partner.sq_amp(.5)
self.k0.reset_kernels()
> self.fluxlutman.load_waveform_realtime('square')
pycqed/tests/test_flux_lutman.py:500:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AWG8_Flux_LutMan: fluxlutman_main>, waveform_name = 'square', wf_nr = None, regenerate_waveforms = True
def load_waveform_realtime(self, waveform_name: str,
wf_nr: int = None,
regenerate_waveforms: bool = True):
"""
Args:
waveform_name: (str) : name of the waveform
wf_nr (int) : what codeword to load the pulse onto
if set to None, will determine awg_nr based on self.LutMap
regenerate_waveforms (bool) : if True regenerates all waveforms
"""
if wf_nr is None:
> wf_nr = int(self.LutMap()[waveform_name][-3:])
E KeyError: 'square'
pycqed/instrument_drivers/meta_instrument/LutMans/flux_lutman.py:2646: KeyError
______________________________________ TestLegacyFluxLutMan.test_custom_wf ______________________________________
self = <test_flux_lutman.TestLegacyFluxLutMan object at 0x110ed9278>
def test_custom_wf(self):
self.fluxlutman.generate_standard_waveforms()
np.testing.assert_array_almost_equal(
self.fluxlutman._wave_dict['custom_wf'],
np.array([]))
# Tests if the custom wf is part of the default lutmap
> self.fluxlutman.load_waveforms_onto_AWG_lookuptable()
pycqed/tests/test_flux_lutman.py:673:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pycqed/instrument_drivers/meta_instrument/LutMans/flux_lutman.py:2502: in load_waveforms_onto_AWG_lookuptable
lm.load_waveform_onto_AWG_lookuptable(waveform_name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AWG8_Flux_LutMan: fluxlutman_main>, waveform_name = 0, regenerate_waveforms = False
def load_waveform_onto_AWG_lookuptable(self, waveform_name: str,
regenerate_waveforms: bool = False):
"""
Loads a specific waveform to the AWG
"""
if regenerate_waveforms:
# only regenerate the one waveform that is desired
gen_wf_func = getattr(self, '_gen_{}'.format(waveform_name))
self._wave_dict[waveform_name] = gen_wf_func()
> waveform = self._wave_dict[waveform_name]
E KeyError: 0
pycqed/instrument_drivers/meta_instrument/LutMans/flux_lutman.py:2448: KeyError
_________________________ TestLegacyFluxLutMan.test_load_waveforms_onto_AWG_lookuptable _________________________
self = <test_flux_lutman.TestLegacyFluxLutMan object at 0x110ed9208>
def test_load_waveforms_onto_AWG_lookuptable(self):
self.fluxlutman.cfg_distort(True)
> self.fluxlutman.load_waveforms_onto_AWG_lookuptable()
pycqed/tests/test_flux_lutman.py:699:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pycqed/instrument_drivers/meta_instrument/LutMans/flux_lutman.py:2502: in load_waveforms_onto_AWG_lookuptable
lm.load_waveform_onto_AWG_lookuptable(waveform_name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <AWG8_Flux_LutMan: fluxlutman_main>, waveform_name = 0, regenerate_waveforms = False
def load_waveform_onto_AWG_lookuptable(self, waveform_name: str,
regenerate_waveforms: bool = False):
"""
Loads a specific waveform to the AWG
"""
if regenerate_waveforms:
# only regenerate the one waveform that is desired
gen_wf_func = getattr(self, '_gen_{}'.format(waveform_name))
self._wave_dict[waveform_name] = gen_wf_func()
> waveform = self._wave_dict[waveform_name]
E KeyError: 0
pycqed/instrument_drivers/meta_instrument/LutMans/flux_lutman.py:2448: KeyError
=============================================== warnings summary ================================================
/Users/Adriaan/anaconda/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
from ._conv import register_converters as _register_converters
-- Docs: https://docs.pytest.org/en/latest/warnings.html
=============================== 3 failed, 41 passed, 1 warnings in 18.40 seconds ================================
Tests are fixed and added the docstring
The work of this branch is to generalize our CZ suppot for more than ONE CZ per qubit.
With this code we will allow four different CZs per qubit. To be more precise, we have redesigned the scheme of codeword usage, to allocate: Idling Pulse, CZ NE, CZ NW, CZ SW, CZ SE, Parking, Square, Custom. The underlying Lutmap has been promoted to a dictionary (like in the new MW lutman). That dictionary holds the meaningful information (type of gate, connectivity), for the lutman to upload the meaningful waveform (for example, to know whether to have an adiabatic CZ pulse, or just a phase correction).
Following a detailed list of changes: