-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:qutech/qc-toolkit
Conflicts: qctoolkit/pulses/function_pulse_template.py
- Loading branch information
Showing
11 changed files
with
190 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
function pulse_group = convert_qctoolkit(qct_output) | ||
% pulse_group = convert_qctoolkit(qct_output) | ||
% | ||
% Registers pulses and converts pulse group data obtained from the qc-toolkit. | ||
% | ||
% qct_output: The output tuple of the | ||
% PulseControlInterface.create_pulse_group() method. | ||
|
||
qct_pulses = qct_output{2}; | ||
|
||
% Convert Python dicts of pulses to pulse control waveform pulse structs | ||
% and register them using plsreg. Remember index in pulse database. | ||
pulse_indices = zeros(size(qct_pulses, 2)); | ||
for i = 1:size(qct_pulses, 2) | ||
pulse = struct(qct_pulses{i}); | ||
pulse.name = arrayfun(@char, pulse.name); | ||
pulse.data = struct(pulse.data); | ||
pulse.data.marker = cell2mat(cell(pulse.data.marker)); | ||
pulse.data.wf = cell2mat(cell(pulse.data.wf)); | ||
pulse_indices(i) = plsreg(pulse); | ||
end | ||
|
||
% Convert Python dict of pulse group to pulse control struct. | ||
% Replace pulse indices in pulse_group.pulses with the indices of the | ||
% pulses in the pulse database (plsdata). | ||
pulse_group = struct(qct_output{1}); | ||
pulse_group.chan = double(pulse_group.chan); | ||
pulse_group.name = arrayfun(@char, pulse_group.name); | ||
pulse_group.ctrl = arrayfun(@char, pulse_group.ctrl); | ||
pulse_group.nrep = cellfun(@double, cell(pulse_group.nrep)); | ||
pulse_group.pulses = cellfun(@double, cell(pulse_group.pulses)); | ||
for i = 1:size(pulse_group.pulses, 2) | ||
pulse_group.pulses(i) = pulse_indices(pulse_group.pulses(i) + 1); | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
clear | ||
|
||
% Setup temporary plsdata | ||
global plsdata; | ||
plsdata = []; | ||
plsdata.datafile = [tempdir 'hardwaretest\plsdata_hw']; | ||
plsdata.grpdir = [tempdir 'hardwaretest\plsdef\plsgrp']; | ||
try | ||
rmdir([tempdir 'hardwaretest'],'s'); | ||
end | ||
mkdir(plsdata.grpdir); | ||
|
||
plsdata.pulses = struct('data', {}, 'name', {}, 'xval',{}, 'taurc',{}, 'pardef',{},'trafofn',{},'format',{}); | ||
plsdata.tbase = 1000; | ||
|
||
% Define some TablePulseTemplates | ||
table_pulse_1 = py.qctoolkit.pulses.TablePulseTemplate(); | ||
table_pulse_1.add_entry('foo', 10); | ||
table_pulse_1.add_entry(100, 0); | ||
|
||
table_pulse_2 = py.qctoolkit.pulses.TablePulseTemplate(); | ||
table_pulse_2.add_entry(25, -10); | ||
table_pulse_2.add_entry(50, 0); | ||
|
||
|
||
% Build a sequence of TablePulseTemplates with given parameters | ||
sequencer = py.qctoolkit.pulses.Sequencer(); | ||
|
||
clear parameters; | ||
parameters.foo = 45; | ||
|
||
sequencer.push(table_pulse_1, parameters); | ||
sequencer.push(table_pulse_2); | ||
parameters.foo = 80; | ||
sequencer.push(table_pulse_1, parameters); | ||
sequencer.push(table_pulse_1, parameters); | ||
|
||
block = sequencer.build(); | ||
sequence = block.compile_sequence(); | ||
|
||
% Convert the instruction sequence to pulse_control pulses and a | ||
% pulse_group | ||
pci = py.qctoolkit.qcmatlab.pulse_control.PulseControlInterface(1e3); | ||
qct_output = pci.create_pulse_group(sequence, 'foo'); | ||
|
||
pulse_group = convert_qctoolkit(qct_output); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,28 @@ | ||
# qc-toolkit: Quantum Computing Toolkit | ||
[![Coverage Status](https://coveralls.io/repos/qutech/qc-toolkit/badge.svg?branch=master&service=github)](https://coveralls.io/github/qutech/qc-toolkit?branch=master) | ||
[![Build Status](https://travis-ci.org/qutech/qc-toolkit.svg?branch=master)](https://travis-ci.org/qutech/qc-toolkit) | ||
[![Documentation Status](https://readthedocs.org/projects/qc-toolkit/badge/?version=latest)](http://qc-toolkit.readthedocs.org/en/latest/?badge=latest) | ||
|
||
|
||
The qc-toolkit project aims to produce a software toolkit facilitating experiments (or productive use of) involving pulse driven state manipulation of physical qubits. | ||
The qc-toolkit project aims to produce a software toolkit facilitating experiments involving pulse driven state manipulation of physical qubits. | ||
It will provide a hardware independent object representation of pulses and pulse templates as well as means to translate this representation to hardware instructions, execute these instructions and perform corresponding measurements. | ||
Pulses may be as complex as specifying conditional branching/looping and the object representation features easy reuse of previously defined pulse templates. | ||
|
||
## Status | ||
Note that the project is in early development and thus neither feature-complete nor necessarily bug free. Additionally, interfaces and design decisions are subject to change. | ||
|
||
## Installation | ||
qc-toolkit is developed using Python 3.5 but should also run on previous 3.x versions (without guarantee) if the [typing module](https://github.com/JukkaL/typing) is installed. | ||
Currently, there are no other required dependencies on external modules. | ||
The optional script tests/utils/syntax_check.py invokes pyflakes to perform a static code analysis, so pyflakes should be installed if its usage is intended. | ||
qc-toolkit is developed using Python 3.5 but should also run on previous 3.3+ versions. | ||
|
||
The package is installed with: | ||
``` | ||
python3 setup.py install | ||
``` | ||
|
||
The optional script *tests/utils/syntax_check.py* invokes pyflakes to perform a static code analysis, so pyflakes should be installed if its usage is intended. | ||
|
||
## Folder Structure | ||
The repository primarily consists of the folders *src* and *tests*. | ||
The repository primarily consists of the folders *qctoolkit* and *tests*. | ||
|
||
*src* contains the entire source code of the project and is further partitioned into packages of related modules (i.e. a package folder *pulses* which contains all modules related to pulse representation and translation). | ||
*qctoolkit* contains the entire source code of the project and is further partitioned into packages of related modules (i.e. a package folder *pulses* which contains all modules related to pulse representation and translation). | ||
|
||
Contents of *tests* mirror the structure of *src*. For every *<module>.py* somewhere in *src* there should exist a *<module>Tests.py* in the corresponding subdirectory of *tests*. | ||
Contents of *tests* mirror the structure of *qctoolkit*. For every *<module>* somewhere in *qctoolkit* there should exist a *<module>Tests.py* in the corresponding subdirectory of *tests*. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.