Skip to content

Commit

Permalink
completed function to check pulse parameter influence
Browse files Browse the repository at this point in the history
  • Loading branch information
M-superposition committed Aug 27, 2018
1 parent 397250d commit 9eaba93
Showing 1 changed file with 39 additions and 3 deletions.
42 changes: 39 additions & 3 deletions MATLAB/+qc/check_pulse_4chan_parameter_dependency.m
Original file line number Diff line number Diff line change
@@ -1,16 +1,36 @@
function check_pulse_4chan_parameter_dependency(pulse, check_parameter, check_values, varargin)
% plot function to visualize the influence of one pulse parameter on the
% pulse shape:
% ----------------------------------------------------------------------
% input:
% pulse : loaded qctoolkit pulse
% check_paramter : name of the paramter under investigation
% check_values : values the parameter is set to, array []
% varargin : standard varargin that one also uses for
% qc.plot_pulse
% ----------------------------------------------------------------------
% written by Marcel Meyer 08|2018 (marcel.meyer1@rwth-aachen.de)

global plsdata

defaultArgs = struct(...
'sample_rate', plsdata.awg.sampleRate, ... % in 1/s, converted to 1/ns below
'channel_mapping', py.None, ...
'window_mapping' , py.None, ...
'parameters', struct() ...
'parameters', struct(), ...
'removeTrigChans', true, ...
'figID', 2018 ...
);

args = util.parse_varargin(varargin, defaultArgs);

if isempty(args.channel_mapping) || args.channel_mapping == py.None
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

figure();
figure(args.figID);

for k = 1:numel(check_values)
args.parameters.(check_parameter) = check_values(k);
Expand All @@ -19,8 +39,24 @@ function check_pulse_4chan_parameter_dependency(pulse, check_parameter, check_va
data = util.py.py2mat(py.qctoolkit.pulses.plotting.render(instantiatedPulse, pyargs('sample_rate', args.sample_rate, 'render_measurements', true)));

subplot(1, numel(check_values), k);
plot(data)

hold on;

if args.removeTrigChans
data{2} = rmfield(data{2}, 'MTrig');
data{2} = rmfield(data{2}, 'M1');
data{2} = rmfield(data{2}, 'M2');
end

channelNames = fieldnames(data{2});

for channelInd = 1:numel(channelNames)
plot(data{1}*1e-9, data{2}.(channelNames{channelInd}));
end
hold off;
legend(channelNames);
xlabel('t(s)');
title(sprintf('%s = %.2d', check_parameter, check_values(k)));
end

end

0 comments on commit 9eaba93

Please sign in to comment.