Skip to content

Commit

Permalink
Merge pull request #279 from qutech/triton_200/master
Browse files Browse the repository at this point in the history
Triton 200/master
  • Loading branch information
qutech-lab committed Jun 18, 2018
2 parents 8764eb0 + e721461 commit e6b86ad
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 24 deletions.
2 changes: 1 addition & 1 deletion MATLAB/+qc/get_pulse_params.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
else
pulse_template = pulse_name_or_template;
end
pulseParameters = util.py.py2mat(pulse_template.parameter_names);
pulseParameters = sort(util.py.py2mat(pulse_template.parameter_names));

1 change: 1 addition & 0 deletions MATLAB/+qc/load_dict.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
if nargin < 2 || isempty(create_dict)
create_dict = false;
end
create_dict = create_dict || isempty(dict_string_or_struct);

if ischar(dict_string_or_struct)
dict_string_or_struct = strsplit(dict_string_or_struct, ' ');
Expand Down
48 changes: 31 additions & 17 deletions MATLAB/+qc/pulse_seq.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
global plsdata

defaultArgs = struct( ...
'repetitions', ones(1, numel(pulses)), ... % Repetition for each pulse
'repetitions', {num2cell(ones(1, numel(pulses)))}, ... % Repetition for each pulse, set to NaN to avoid using a RepetitionPT. Using a RepetitionPT however can lead to a more efficient upload.
'outerRepetition', 1, ... % Repetition for entire pulse, set to NaN to use a RepetitionPT with on repetition.
'fill_time_min', NaN, ... % If not NaN, add fill_time = py.sympy.Max(fill_time, args.fill_time_min). Might create rounding problems?
'fill_param', '', ... % Not empty: Automatically add fill_pulse to achieve total time given by this parameter.
... % 'auto': Determine fill time automatically for efficient upload on Tabor AWG
'fill_pulse_param', 'wait___t', ... % Name of pulse parameter to use for total fill time
Expand All @@ -26,7 +28,7 @@
'prefix', '' , ... % Prefix to add to each pulse parameters
'identifier', '' , ... % Empty: Do not add an identifier
... % Otherwise: Name of the final pulse
'sampleRate', uint64(plsdata.awg.sampleRate), ... % In SI units (Sa/s), should be uint
'sampleRate', uint64(plsdata.awg.sampleRate), ... % In SI units (Sa/s), should be uint
'minSamples', uint64(192), ... % Minimum number of samples for fill pulse, should be uint
'sampleQuantum', uint64(16) ... % Sample increments for fill pulse, should be uint
);
Expand All @@ -43,16 +45,16 @@
pulses{k} = qc.load_pulse(pulses{k});
end

if args.repetitions(k) > 1
pulses{k} = py.qctoolkit.pulses.RepetitionPT(pulses{k}, args.repetitions(k));
if ~any(isnan(args.repetitions{k}))
pulses{k} = py.qctoolkit.pulses.RepetitionPT(pulses{k}, args.repetitions{k});
end
end

% Sequence pulses
if ~isempty(args.measurements)
pulse = py.qctoolkit.pulses.SequencePT(pulses{:}, pyargs('measurements', args.measurements));
pulse = py.qctoolkit.pulses.RepetitionPT(py.qctoolkit.pulses.SequencePT(pulses{:}, pyargs('measurements', args.measurements)), 1);
else
pulse = py.qctoolkit.pulses.SequencePT(pulses{:});
pulse = py.qctoolkit.pulses.RepetitionPT(py.qctoolkit.pulses.SequencePT(pulses{:}), 1);
end

% Add fill if fill_param not empty
Expand All @@ -63,21 +65,24 @@
else
fill_pulse = qc.load_pulse(args.fill_pulse);
end

minDuration = args.minSamples/args.sampleRate;
durationQuantum = args.sampleQuantum/args.sampleRate;
if strcmp(args.fill_param, 'auto')
minDuration = args.minSamples/args.sampleRate;
durationQuantum = args.sampleQuantum/args.sampleRate;

fill_time = ...
py.sympy.ceiling( ... If duration > minDuration, get the next higher
( py.sympy.Max(duration.sympified_expression-minDuration, durationQuantum) )/durationQuantum ... integer number of durationQuantum above minDuration
( py.sympy.Max(duration.sympified_expression-minDuration, 0) )/durationQuantum ... integer number of durationQuantum above minDuration
)*durationQuantum ... but with minimum of one durationQuantum so pulse length not 0
+ minDuration ... Enforce that duration always longer than minDuration
- duration.sympified_expression;

- duration.sympified_expression;
else
fill_time = args.fill_param - duration;
end

if ~any(isnan(args.fill_time_min))
fill_time = py.sympy.Max(fill_time, args.fill_time_min);
end

fill_pulse = py.qctoolkit.pulses.MappingPT( ...
pyargs( ...
'template', fill_pulse, ...
Expand Down Expand Up @@ -106,11 +111,20 @@
);
end

% Add pulse identifier of identifier not empty
if ~isempty(args.identifier)
pulse = py.qctoolkit.pulses.SequencePT( ...
pulse, ...
if any(isnan(args.outerRepetition))
outerRepetition = 1;
else
outerRepetition = args.outerRepetition;
end

% Add pulse identifier if identifier not empty
if ~isempty(args.identifier)
pulse = py.qctoolkit.pulses.RepetitionPT( ...
pulse, outerRepetition, ...
pyargs('identifier', args.identifier) ...
);
);
else
pulse = py.qctoolkit.pulses.RepetitionPT( ...
pulse, args.outerRepetition);
end

30 changes: 24 additions & 6 deletions MATLAB/+qc/qctoolkitTestSetup.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,38 @@

% Loading
if util.yes_no_input('Really load smdata?', 'n')
load(fullfile(loadPath, 'smdata_recent.mat'));
info = dir(fullfile(loadPath, 'smdata_recent.mat'));
try
copyfile(fullfile(loadPath, 'smdata_recent.mat'), fullfile(tunePath, 'smdata_recent.mat'));
catch err
warning(err.getReport());
end
load(fullfile(tunePath, 'smdata_recent.mat'));
info = dir(fullfile(tunePath, 'smdata_recent.mat'));
fprintf('Loaded smdata from %s', datestr(info.datenum));
end
load(fullfile(loadPath, 'tunedata_recent.mat'));
info = dir(fullfile(loadPath, 'tunedata_recent.mat'));
try
copyfile(fullfile(loadPath, 'tunedata_recent.mat'), fullfile(tunePath, 'tunedata_recent.mat'));
catch err
warning(err.getReport());
end
load(fullfile(tunePath, 'tunedata_recent.mat'));
info = dir(fullfile(tunePath, 'tunedata_recent.mat'));
fprintf('Loaded tunedata from %s', datestr(info.datenum));

load(fullfile(loadPath, 'plsdata_recent.mat'));
info = dir(fullfile(loadPath, 'plsdata_recent.mat'));
try
copyfile(fullfile(loadPath, 'plsdata_recent.mat'), fullfile(tunePath, 'plsdata_recent.mat'));
catch err
warning(err.getReport());
end
load(fullfile(tunePath, 'plsdata_recent.mat'));
info = dir(fullfile(tunePath, 'plsdata_recent.mat'));
fprintf('Loaded plsdata from %s', datestr(info.datenum));

global tunedata
global plsdata
tunedata.run{tunedata.runIndex}.opts.loadFile = 'C:\Users\Pascal\Janeway\Common\GaAs\Triton 200\Backup\DATA\tune';
import tune.tune

plsdata.path = pulsePath;

% Alazar dummy instrument (simulator not implemented yet)
Expand Down

0 comments on commit e6b86ad

Please sign in to comment.