-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathExpScripter.example.m
54 lines (45 loc) · 1.73 KB
/
ExpScripter.example.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
% timeDomain
function ExpScripter(expName)
exp = ExpManager();
deviceName = 'IBM_PhaseII';
exp.dataFileHandler = HDF5DataHandler(DataNamer.get_data_filename(deviceName, expName));
expSettings = json.read(getpref('qlab', 'CurScripterFile'));
exp.dataFileHeader = expSettings;
exp.CWMode = expSettings.CWMode;
instrSettings = expSettings.instruments;
sweepSettings = expSettings.sweeps;
measSettings = expSettings.measurements;
for instrument = fieldnames(instrSettings)'
fprintf('Connecting to %s\n', instrument{1});
instr = InstrumentFactory(instrument{1}, instrSettings.(instrument{1}));
add_instrument(exp, instrument{1}, instr, instrSettings.(instrument{1}));
end
for sweep = fieldnames(sweepSettings)'
add_sweep(exp, sweepSettings.(sweep{1}).order, SweepFactory(sweepSettings.(sweep{1}), exp.instruments));
end
%Loop over the measurments: insert the single channel measurements, keep
%back the correlators and then apply them
correlators = {};
measFilters = struct();
measNames = fieldnames(measSettings);
for meas = measNames'
measName = meas{1};
params = measSettings.(measName);
if strcmp(params.filterType,'Correlator')
%If it is a correlator than hold it back
correlators{end+1} = measName;
else
%Otherwise load it and keep a reference to it
measFilters.(measName) = MeasFilters.(params.filterType)(measName,params);
add_measurement(exp, measName, measFilters.(measName));
end
end
%Loop back and apply any correlators
for meas = correlators
measName = meas{1};
childFilters = cellfun(@(x) measFilters.(x), measSettings.(measName).filters, 'UniformOutput', false);
add_measurement(exp, measName, MeasFilters.Correlator(childFilters{:}));
end
exp.init();
exp.run();
end