diff --git a/.gitignore b/.gitignore index f89671877..03591aa92 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ doc/build/* build/* dist/* doc/source/examples/.ipynb_checkpoints/* -**.asv \ No newline at end of file +**.asv +*.orig diff --git a/MATLAB/+qc/AWGwatch.m b/MATLAB/+qc/AWGwatch.m new file mode 100644 index 000000000..0ec6521e2 --- /dev/null +++ b/MATLAB/+qc/AWGwatch.m @@ -0,0 +1,21 @@ +function AWGwatch() +% starts a matlab (vers 2018a) app to DISPLAY SEQUENCER TABLES AND +% WAFEFORMS in qctoolkit and on the Tabor AWG simulatar +% ------------------------------------------------------------------------- +% - to edit the app open awgdisp_app.mlapp in the Matlab app designer +% - user preferences can be edited in the app private properties directly +% at the top in awgdisp_app.mlapp +% ------------------------------------------------------------------------- +% App written by Marcel Meyer 08|2018 marcel.meyer1@rwth-aachen.de + + disp('AWGwatch - app is started'); + + % the app is not on path +qc because matlab then one has problems debugging it + pathOfApp = which('qc.AWGwatch'); + pathOfApp = pathOfApp(1:end-10); + pathOfApp = [pathOfApp 'AWGwatch']; + addpath(pathOfApp); + + awgdisp_app(); + +end \ No newline at end of file diff --git a/MATLAB/+qc/AWGwatch/awgdisp_app.mlapp b/MATLAB/+qc/AWGwatch/awgdisp_app.mlapp new file mode 100644 index 000000000..f80ca709e Binary files /dev/null and b/MATLAB/+qc/AWGwatch/awgdisp_app.mlapp differ diff --git a/MATLAB/+qc/awgdisp.m b/MATLAB/+qc/awgdisp.m new file mode 100644 index 000000000..f92b16727 --- /dev/null +++ b/MATLAB/+qc/awgdisp.m @@ -0,0 +1,20 @@ +function awgdisp(source) + +if nargin < 1 + source = 'qctk'; +end + +% get AWG objects +switch source + case 'qctk' + disp('source = qctoolkit') + case 'sim' + disp('simulaotr') + otherwise + disp('no input') +end + + +% get sequence tables + +% create app \ No newline at end of file diff --git a/MATLAB/+qc/disp_awg_seq_table.m b/MATLAB/+qc/disp_awg_seq_table.m index 23c593808..7dc7a2781 100644 --- a/MATLAB/+qc/disp_awg_seq_table.m +++ b/MATLAB/+qc/disp_awg_seq_table.m @@ -1,77 +1,95 @@ +% function to display the sequence table hold by qctoolkit Tabor instance +% or given in the varargins +% ------------------------------------------------------------------------- +% Notes: +% - if varargin.seq_table is empty the sequence table saved in the qctoolkit +% Tabor object is plotted -> function uses qc.get_sequence_table internaly +% ------------------------------------------------------------------------- +% written by Marcel Meyer 08|2018 + + function disp_awg_seq_table(varargin) - - global plsdata - - defaultArgs = struct(... - 'programName', plsdata.awg.currentProgam, ... - 'advancedSeqTableFlag', false ... - ); - args = util.parse_varargin(varargin, defaultArgs); - - - - seq_table = qc.get_sequence_table(args.programName, args.advancedSeqTableFlag); - - disp(' '); - disp('[i] Table 1 is for channel pair AB and table 2 for channel pair CD.'); - disp(' '); - - for k = 1:2 - if ~args.advancedSeqTableFlag - - disp(sprintf('--- table %d -----------------', k)); - for n = 1:length(seq_table{k}) - disp(sprintf(' -- sub table %d ---------', n)); - - counter_disp_flag = false; - tmpEntry = seq_table{k}{n}{1}; - disp(tmpEntry); - counter = 0; - for i=1:length(seq_table{k}{n}) - if isequal(tmpEntry, seq_table{k}{n}{i}) - counter = counter+1; - else - disp(sprintf(' rep = %d', counter)); - tmpEntry = seq_table{k}{n}{i}; - disp(tmpEntry); - counter = 0; - counter_disp_flag = true; - end - end - if counter_disp_flag == false - disp(sprintf(' rep = %d', counter)); - end - disp('-----------------------------') - end - - - - else - - disp(sprintf('--- table %d -----------------', k)); - - counter_disp_flag = false; - tmpEntry = seq_table{k}{1}; - disp(tmpEntry); - counter = 0; - for i=1:length(seq_table{k}) - if isequal(tmpEntry, seq_table{k}{i}) - counter = counter+1; - else - disp(sprintf(' rep = %d', counter)); - tmpEntry = seq_table{k}{i}; - disp(tmpEntry); - counter = 0; - counter_disp_flag = true; - end - end - if counter_disp_flag == false - disp(sprintf(' rep = %d', counter)); - end - disp('-----------------------------') - end - - - end - + + global plsdata + + defaultArgs = struct(... + 'seq_table', {{}}, ... + 'programName', plsdata.awg.currentProgam, ... + 'advancedSeqTableFlag', false ... + ); + args = util.parse_varargin(varargin, defaultArgs); + + + if isempty(args.seq_table) + seq_table = qc.get_sequence_table(args.programName, args.advancedSeqTableFlag); + else + assert(iscell(args.seq_table), 'wrong format sequence table') + seq_table = args.seq_table; + end + + disp(' '); + disp('[i] Table 1 is for channel pair AB and table 2 for channel pair CD.'); + disp(' '); + + counter = 0; + tmpEntry = ''; + + for k = 1:2 + if isempty(seq_table{k}) + warning('-- empty sequence table at channel nr %i -- \n', k); + else + if ~args.advancedSeqTableFlag + + fprintf('--- table %d -----------------\n', k); + for n = 1:length(seq_table{k}) + fprintf(' -- sub table %d ---------\n', n); + + tmpEntry = seq_table{k}{n}{1}; + counter = 0; + for i=1:length(seq_table{k}{n}) + if isequal(tmpEntry, seq_table{k}{n}{i}) + counter = counter+1; + else + + fprintf(' rep = %d', counter); + disp(tmpEntry); + + tmpEntry = seq_table{k}{n}{i}; + counter = 1; + end + end + fprintf(' rep = %d', counter); + disp(tmpEntry); + disp('-----------------------------') + end + + + + + else + + fprintf('--- table %d -----------------\n', k); + + tmpEntry = seq_table{k}{1}; + counter = 0; + for i=1:length(seq_table{k}) + if isequal(tmpEntry, seq_table{k}{i}) + counter = counter+1; + else + fprintf(' rep = %d', counter); + disp(tmpEntry); + + tmpEntry = seq_table{k}{i}; + counter = 0; + end + end + fprintf(' rep = %d', counter); + disp(tmpEntry); + disp('-----------------------------') + + end + + + end + end end \ No newline at end of file diff --git a/MATLAB/+qc/get_awg_memory.m b/MATLAB/+qc/get_awg_memory.m new file mode 100644 index 000000000..7b830b479 --- /dev/null +++ b/MATLAB/+qc/get_awg_memory.m @@ -0,0 +1,44 @@ +% function to get waveforms and sequence tables from the AWG +% ------------------------------------------------------------------------- +% Notes: +% - the function only works with the Tabor AWG Simulator not on the real +% Tabor AWG +% - the function arms the program that is inspected +% ------------------------------------------------------------------------- +% written by Marcel Meyer 08|2018 + +function awg_memory_struct = get_awg_memory(program_name, awg_channel_pair_identifier) + + global plsdata + + assert(ischar(program_name), 'first argument of get_awg_memory must be string'); + + if nargin < 2 || isempty(awg_channel_pair_identifier) + awg_channel_pair_identifier = 'AB'; + else + assert(ischar(awg_channel_pair_identifier), 'second argument of get_awg_memory must be string'); + end + + % get AWG channelpair python object + hws = plsdata.awg.hardwareSetup; + known_awgs = util.py.py2mat(hws.known_awgs); + sort_indices = cellfun(@(x)(~isempty(strfind(char(x.identifier), awg_channel_pair_identifier))), known_awgs); + channelpair = known_awgs(find(sort_indices)); + channelpair = channelpair{1}; + + % arm program at AWG + try + channelpair.arm(program_name); + catch err + warning('program seems not to be on AWG, upload it first, returning without returning memory'); + warning(err.message); + return + end + + % get a plottable program object -> qctoolkit Tabor driver gets sequence + % tables and waveforms from the simulator + plottableProgram = channelpair.read_complete_program(); + + awg_memory_struct = util.py.py2mat(plottableProgram.to_builtin()); + +end \ No newline at end of file diff --git a/MATLAB/+qc/get_awg_seq_table.m b/MATLAB/+qc/get_awg_seq_table.m new file mode 100644 index 000000000..36fb340fc --- /dev/null +++ b/MATLAB/+qc/get_awg_seq_table.m @@ -0,0 +1,13 @@ +function seq_table = get_awg_seq_table(varargin) + + global plsdata + + defaultArgs = struct(... + 'programName', plsdata.awg.currentProgam, ... + 'advancedSeqTableFlag', false ... + ); + args = util.parse_varargin(varargin, defaultArgs); + + seq_table = qc.get_sequence_table(args.programName, args.advancedSeqTableFlag); + +end \ No newline at end of file diff --git a/MATLAB/+qc/get_segment_waveform.m b/MATLAB/+qc/get_segment_waveform.m new file mode 100644 index 000000000..8526e4906 --- /dev/null +++ b/MATLAB/+qc/get_segment_waveform.m @@ -0,0 +1,53 @@ +function [wf1, wf2] = get_segment_waveform(program_name, channel_pair_index, memory_index, awg_channel_pair_identifiers) +% Get Wafeform of Sequencer Table Element +% PLEASE NOTE: works only for the Tabor AWG SIMULATOR +% PLEASE NOTE: program gets armed by calling this function +% +% --- Outputs ------------------------------------------------------------- +% wf1 : first channel y-values of AWG channelpair +% wf2 : second channel y-values of AWG channelpair +% +% --- Inputs -------------------------------------------------------------- +% program_name : Program name for which wafeform is +% returned +% channel_pair_index : 1 for channelpair AB and 2 for channelpair +% CD. Also see awg_channel_pair_identifier +% input +% memory_index : identifier number of element at the Tabor +% AWG (corresponds to second column in +% Sequencer Table +% awg_channel_pair_identifiers : Some substring in the channel pair +% identifiers to be matched. Sequence tables +% are sorted in the same order as channel +% pair identifiers substrings passed in this +% variable. Default is {'AB', 'CD'}. +% +% ------------------------------------------------------------------------- +% 2018/08 Marcel Meyer +% (marcel.meyer1@rwth-aachen.de) + +global plsdata + hws = plsdata.awg.hardwareSetup; + + if nargin < 4 || isempty(awg_channel_pair_identifiers) + awg_channel_pair_identifiers = {'AB', 'CD'}; + end + + known_awgs = util.py.py2mat(hws.known_awgs); + sort_indices = cellfun(@(x)(find( cellfun(@(y)(~isempty(strfind(char(x.identifier), y))), awg_channel_pair_identifiers) )), known_awgs); + known_awgs = known_awgs(sort_indices); + + %one has to arm the program to access the plottableProgram object of the + %program + known_awgs{channel_pair_index}.arm(program_name); + + plottableProgram = known_awgs{channel_pair_index}.read_complete_program(); + + wf1 = plottableProgram.get_segment_waveform(uint8(0), uint8(memory_index)); + wf2 = plottableProgram.get_segment_waveform(uint8(1), uint8(memory_index)); + + wf1 = util.py.py2mat(wf1); + wf2 = util.py.py2mat(wf2); + + wf1 = cell2mat(wf1); + wf2 = cell2mat(wf2); \ No newline at end of file diff --git a/MATLAB/+qc/get_sequence_table.m b/MATLAB/+qc/get_sequence_table.m index 0d0f42ed9..0b5b5fd69 100644 --- a/MATLAB/+qc/get_sequence_table.m +++ b/MATLAB/+qc/get_sequence_table.m @@ -1,5 +1,6 @@ -function seq_table = get_sequence_table(program_name, advanced_seq_table_flag, awg_channel_pair_identifiers, verbosity) +function seq_table = get_sequence_table(program_name, advanced_seq_table_flag, awg_channel_pair_identifiers, verbosity, return_python_list) % GET_SEQUENCE_TABLE Get sequence table of program on Tabor AWG +% (not actually from AWG but from the qctoolkit Tabor Driver instance) % % --- Outputs ------------------------------------------------------------- % seq_table : Cell of sequence tables for each Tabor @@ -17,9 +18,14 @@ % variable. Default is {'AB', 'CD'}. % verbosity : Print sequence table to command line. % Default is 0. +% return_python_list : Returns a python list object instead of a +% matlab cell. This makes the function +% faster as the conversion is slow. +% Dafault is false. % % ------------------------------------------------------------------------- -% (c) 2018/06 Pascal Cerfontaine (cerfontaine@physik.rwth-aachen.de) +% (c) 2018/06 Pascal Cerfontaine and Marcel Meyer +% (cerfontaine@physik.rwth-aachen.de) global plsdata hws = plsdata.awg.hardwareSetup; @@ -33,6 +39,9 @@ if nargin < 4 || isempty(verbosity) verbosity = 0; end +if nargin < 5 || isempty(return_python_list) + return_python_list = false; +end if advanced_seq_table_flag seq_txt = 'A'; else @@ -53,20 +62,19 @@ if isfield(known_programs{k}, program_name) tabor_program{k} = known_programs{k}.(program_name){2}; - if advanced_seq_table_flag - seq_table{k} = py.getattr(tabor_program{k}, '_advanced_sequencer_table'); - else - seq_table{k} = py.getattr(tabor_program{k}, '_sequencer_tables'); - end - - if verbosity > 0 - disp(seq_table{k}); - end - -% if ~advanced_seq_table_flag -% seq_table{k} = seq_table{k}{1}; % Since it is a list inside a list -> one should pass all elements, list of list is used if advanced seq table is not trivial -% end - seq_table{k} = util.py.py2mat(seq_table{k}); + if advanced_seq_table_flag + seq_table{k} = py.getattr(tabor_program{k}, '_advanced_sequencer_table'); + else + seq_table{k} = py.getattr(tabor_program{k}, '_sequencer_tables'); + end + + if verbosity > 0 + disp(seq_table{k}); + end + + if ~return_python_list + seq_table{k} = util.py.py2mat(seq_table{k}); + end else tabor_program{k} = {}; seq_table{k} = {}; diff --git a/MATLAB/+qc/get_sequence_table_from_simulator.m b/MATLAB/+qc/get_sequence_table_from_simulator.m new file mode 100644 index 000000000..776584024 --- /dev/null +++ b/MATLAB/+qc/get_sequence_table_from_simulator.m @@ -0,0 +1,99 @@ +function seq_table = get_sequence_table_from_simulator(program_name, advanced_seq_table_flag, awg_channel_pair_identifiers, verbosity, return_python_list) +% GET_SEQUENCE_TABLE Get sequence table of program on Tabor AWG Simulator +% PLEASE NOTE: the program gets armed by the function +% +% --- Outputs ------------------------------------------------------------- +% seq_table : Cell of sequence tables for each Tabor +% channel pair +% +% --- Inputs -------------------------------------------------------------- +% program_name : Program name for which sequence table is +% returned +% advanced_seq_table_flag : Get advanced sequence table if true. +% Default is false. +% awg_channel_pair_identifiers : Some substring in the channel pair +% identifiers to be matched. Sequence tables +% are sorted in the same order as channel +% pair identifiers substrings passed in this +% variable. Default is {'AB', 'CD'}. +% verbosity : Print sequence table to command line. +% Default is 0. +% return_python_list : Returns a python list object instead of a +% matlab cell. This makes the function +% faster as the conversion is slow. +% Dafault is false. +% +% ------------------------------------------------------------------------- +% 2018/08 Marcel Meyer +% based on qc.get_sequence_table by Pascal Cerfontaine and Marcel Meyer +% (marcel.meyer1@rwth-aachen.de) + + global plsdata + hws = plsdata.awg.hardwareSetup; + + if nargin < 2 || isempty(advanced_seq_table_flag) + advanced_seq_table_flag = false; + end + if nargin < 3 || isempty(awg_channel_pair_identifiers) + awg_channel_pair_identifiers = {'AB', 'CD'}; + end + if nargin < 4 || isempty(verbosity) + verbosity = 0; + end + + if nargin < 5 || isempty(return_python_list) + return_python_list = false; + end + + if advanced_seq_table_flag + seq_txt = 'A'; + else + seq_txt = ''; + end + + known_awgs = util.py.py2mat(hws.known_awgs); + sort_indices = cellfun(@(x)(find( cellfun(@(y)(~isempty(strfind(char(x.identifier), y))), awg_channel_pair_identifiers) )), known_awgs); + known_awgs = known_awgs(sort_indices); + + for k = 1:length(known_awgs) + known_programs{k} = util.py.py2mat(py.getattr(known_awgs{k}, '_known_programs')); + + if verbosity > 0 + util.disp_section(sprintf('%s %sST: %s', awg_channel_pair_identifiers{k}, seq_txt, program_name)); + end + + if isfield(known_programs{k}, program_name) + + % one has to arm the program before accessing its plottableProgram + % object + known_awgs{k}.arm(program_name); + plottableProgram = known_awgs{k}.read_complete_program(); + + if advanced_seq_table_flag + seq_table{k} = py.getattr(plottableProgram, '_advanced_sequence_table'); + else + seq_table{k} = py.getattr(plottableProgram, '_sequence_tables'); + end + + if verbosity > 0 + disp(seq_table{k}); + end + + if ~return_python_list + seq_table{k} = util.py.py2mat(seq_table{k}); + end + + else + tabor_program{k} = {}; + seq_table{k} = {}; + + if verbosity > 0 + disp(' Program not present'); + end + end + end + +if verbosity > 0 + fprintf('\n'); + util.disp_section(); +end \ No newline at end of file diff --git a/MATLAB/+qc/plot_pulse.m b/MATLAB/+qc/plot_pulse.m index 10b682326..a4d224c7b 100644 --- a/MATLAB/+qc/plot_pulse.m +++ b/MATLAB/+qc/plot_pulse.m @@ -6,7 +6,7 @@ 'sample_rate', plsdata.awg.sampleRate, ... % in 1/s, converted to 1/ns below 'channel_names', {{}}, ... % names of channels to plot, all if empty 'parameters', struct(), ... - 'channel_mapping', py.None, ... + 'channel_mapping', [], ... 'window_mapping' , py.None, ... 'fig_id', plsdata.qc.figId, ... 'subplots', [121 122], ... @@ -23,6 +23,10 @@ args = util.parse_varargin(varargin, defaultArgs); + if isempty(args.channel_mapping) + args.channel_mapping = py.dict(py.zip(pulse.defined_channels, pulse.defined_channels)); + end + args.sample_rate = args.sample_rate * 1e-9; % convert to 1/ns instantiatedPulse = qc.instantiate_pulse(pulse, 'parameters', args.parameters, 'channel_mapping', args.channel_mapping, 'window_mapping', args.window_mapping); diff --git a/MATLAB/+qc/qcToolkitTestSetupUploadProgram.m b/MATLAB/+qc/qcToolkitTestSetupUploadProgram.m new file mode 100644 index 000000000..bfe977314 --- /dev/null +++ b/MATLAB/+qc/qcToolkitTestSetupUploadProgram.m @@ -0,0 +1,67 @@ +% set upload pulse +% upload_pulse = 'dnp_wait_dbz_4chan'; +% upload_pulse = 'decay_j_fid_4chan'; +% upload_pulse = 's_pumping_AB_4chan'; +% upload_pulse = 'pumping_s_stp'; +% upload_pulse = 'pumping_s'; +% upload_scan = 'dnp_decay_dbz_fid_4chan'; +upload_scan = 'line'; +% upload_scan = 'lead'; +% upload_scan = 'tl'; + + + + +%% Just an example with the Tabor AWG simulator +% awgctrl('default except offsets') +plsdata.awg.inst.send_cmd(':OUTP:COUP:ALL HV'); +args = tunedata.run{1}.(upload_scan).opts(1).scan.configfn(4).args; +args{end}.window_mapping.A = py.None; +args{end}.window_mapping.B = py.None; +args{end}.window_mapping.DBZFID_A = py.None; +args{end}.window_mapping.DBZFID_B = py.None; +args{end}.operations = {}; +feval(args{2:end}); + + +%% test scan to test if why one can not upload pump pulses created with qctk concatenate +myname = 'dnp_ABCD_4chan' + + +window_mapping = struct('A', py.None, 'B', py.None); + +myargs = struct('program_name', myname, ... + 'pulse_template', myname, ... + 'channel_mapping', struct('W', 'TABOR_A', 'X', 'TABOR_B', 'Y', 'TABOR_C', 'Z', 'TABOR_D', 'MTrig', 'TABOR_A_MARKER', 'M1', 'TABOR_B_MARKER', 'M2', 'TABOR_C_MARKER'), ... + 'parameters_and_dicts', {{'common', 'common_d12', 'common_d34', 'common_d12 d12', 'common_d34 d34'}}, ... + 'window_mapping', window_mapping ... + ); + +plsdata.awg.inst.send_cmd(':OUTP:COUP:ALL HV'); +myinput = {'awg_program', @qc.awg_program, 'add', myargs}; +feval(myinput{2:end}); + + +%% reset AWG +awgctrl('default except offsets'); + +%% check out sequ table wait_4chan +entries = qc.get_sequence_table('wait_4chan', false) +entries{1}{end} +entries{1}{end-1} +entries{1}{end-2} +entries{1}{end-5} + + +%% check seq table j_fid_4chan +entries = qc.get_sequence_table('j_fid_4chan', false) +entries{1}{end} +entries{1}{end-1} +entries{1}{end-2} +entries{1}{end-5} + +%% +entries = qc.get_sequence_table('wait_4chan', true) +disp(entries{1}{1}); +disp(entries{2}{1}); +% disp(entries{3}{1}); \ No newline at end of file diff --git a/MATLAB/+qc/qctoolkitTestSetup.m b/MATLAB/+qc/qctoolkitTestSetup.m index 52e19151c..66692c053 100644 --- a/MATLAB/+qc/qctoolkitTestSetup.m +++ b/MATLAB/+qc/qctoolkitTestSetup.m @@ -1,9 +1,9 @@ %% --- Test setup without AWG and Alazar (only qctoolkit) ----------------- global plsdata plsdata = struct( ... - 'path', 'C:\Users\Pascal\Janeway\Cerfontaine\Code\qc-toolkit-pulses', ... + 'path', 'C:\Users\meyer\Documents\_meyer_local_\code\qc-toolkit-pulses', ... 'awg', struct('inst', [], 'hardwareSetup', [], 'sampleRate', 2e9, 'currentProgam', '', 'registeredPrograms', struct(), 'defaultChannelMapping', struct(), 'defaultWindowMapping', struct(), 'defaultParametersAndDicts', {{}}, 'defaultAddMarker', {{}}), ... - 'dict', struct('cache', [], 'path', 'C:\Users\Pascal\Janeway\Cerfontaine\Code\qc-toolkit-dicts'), ... + 'dict', struct('cache', [], 'path', 'C:\Users\meyer\Documents\_meyer_local_\code\qc-toolkit-dicts'), ... 'qc', struct('figId', 801), ... 'daq', struct('inst', [], 'defaultOperations', {{}}, 'reuseOperations', false) ... ); @@ -17,10 +17,10 @@ % Need the triton_200 repo on the path (for awgctrl) % Path for Triton 200 backups -loadPath = 'C:\Users\Pascal\Janeway\Common\GaAs\Triton 200\Backup\DATA\workspace'; +loadPath = 'X:\Common\GaAs\Triton 200\Backup\DATA\workspace'; pulsePath = plsdata.path; dictPath = plsdata.dict.path; -tunePath = 'C:\Users\Pascal\Janeway\Cerfontaine\Code\dev\+tune\data'; +tunePath = 'Z:\DATA'; % Loading try @@ -32,7 +32,8 @@ info = dir(fullfile(tunePath, 'smdata_recent.mat')); fprintf('Loaded smdata from %s\n', datestr(info.datenum)); try - copyfile(fullfile(loadPath, 'tunedata_recent.mat'), fullfile(tunePath, 'tunedata_recent.mat')); + copyfile(fullfile(loadPath, 'tunedata_recent.mat'), fullfile(tunePath, 'tunedata_recent.mat')); +% copyfile(fullfile(loadPath, 'tunedata_2018_06_25_21_08.mat'), fullfile(tunePath, 'tunedata_recent.mat')); catch err warning(err.getReport()); end @@ -51,7 +52,7 @@ global tunedata global plsdata -tunedata.run{tunedata.runIndex}.opts.loadFile = 'C:\Users\Pascal\Janeway\Common\GaAs\Triton 200\Backup\DATA\tune#most_recent_file'; +tunedata.run{tunedata.runIndex}.opts.loadFile = 'X:\Common\GaAs\Triton 200\Backup\DATA\tune'; import tune.tune plsdata.path = pulsePath; @@ -65,7 +66,7 @@ % Initializes hardware setup % Can also be used for deleting all programs/resetting but then also need to setup Alazar again, i.e. the cell above and the three cells below ) plsdata.awg.hardwareSetup = []; -qc.setup_tabor_awg('realAWG', false, 'simulateAWG', true, 'taborDriverPath', 'C:\Users\Pascal\Janeway\Cerfontaine\Code\tabor'); +qc.setup_tabor_awg('realAWG', false, 'simulateAWG', true, 'taborDriverPath', 'C:\Users\meyer\Documents\_meyer_local_\code\python-TaborDriver'); % AWG default settings awgctrl('default'); @@ -75,7 +76,7 @@ % Execute after setting up the AWG since needs hardware setup initialized % Need to test whether need to restart Matlab if execute % qc.setup_alazar_measurements twice -% qc.setup_alazar_measurements('nQubits', 2, 'nMeasPerQubit', 4, 'disp', true); +qc.setup_alazar_measurements('nQubits', 2, 'nMeasPerQubit', 4, 'disp', true); % Qctoolkit plsdata.qc.backend = py.qctoolkit.serialization.FilesystemBackend(pulsePath); @@ -84,4 +85,8 @@ % Tune tunedata.run{tunedata.runIndex}.opts.path = tunePath; + + +import tune.tune +disp('done'); % ------------------------------------------------------------------------- \ No newline at end of file diff --git a/MATLAB/+qc/setup_tabor_awg.m b/MATLAB/+qc/setup_tabor_awg.m index 358b9d928..e24d85539 100644 --- a/MATLAB/+qc/setup_tabor_awg.m +++ b/MATLAB/+qc/setup_tabor_awg.m @@ -60,7 +60,7 @@ function setup_tabor_awg(varargin) end plsdata.awg.inst = smdata.inst(sminstlookup(args.taborName)).data.tawg; - if args.realAWG + if args.realAWG && exist('awgctrl.m', 'file') awgctrl('off'); end diff --git a/qctoolkit/hardware/awgs/tabor.py b/qctoolkit/hardware/awgs/tabor.py index c42957376..e9a1e16ee 100644 --- a/qctoolkit/hardware/awgs/tabor.py +++ b/qctoolkit/hardware/awgs/tabor.py @@ -721,6 +721,10 @@ def get_waveforms(self, channel: int) -> List[np.ndarray]: return [ch_getter(self._segments[segment_no - 1]) for _, segment_no, _ in self._iter_segment_table_entry()] + def get_segment_waveform(self, channel: int, segment_no: int) -> np.ndarray: + ch_getter = (operator.attrgetter('ch_a'), operator.attrgetter('ch_b'))[channel] + return [ch_getter(self._segments[segment_no - 1])] + def get_repetitions(self) -> np.ndarray: return np.fromiter((segment_repeat for segment_repeat, *_ in self._iter_segment_table_entry()), dtype=np.uint32)