Calculations/MOT Simulator/+Scripts/scanForSidebandEnhancement.m

33 lines
1.9 KiB
Mathematica
Raw Normal View History

function [LoadingRateArray, StandardErrorArray, ConfidenceIntervalArray] = scanForSidebandEnhancement(ovenObj, MOTobj, CBBeamName, SBBeamName, SBDetuningArray, SBPowerArray)
Beams = MOTobj.Beams;
CoolingBeam = Beams{cellfun(@(x) strcmpi(x.Alias, CBBeamName), Beams)};
SidebandBeam = Beams{cellfun(@(x) strcmpi(x.Alias, SBBeamName), Beams)};
NumberOfPointsForFirstParam = length(SBDetuningArray);
NumberOfPointsForSecondParam = length(SBPowerArray);
LoadingRateArray = zeros(NumberOfPointsForFirstParam, NumberOfPointsForSecondParam);
StandardErrorArray = zeros(NumberOfPointsForFirstParam, NumberOfPointsForSecondParam);
ConfidenceIntervalArray = zeros(NumberOfPointsForFirstParam, NumberOfPointsForSecondParam, 2);
for i=1:NumberOfPointsForFirstParam
eval(sprintf('SidebandBeam.%s = %d;', 'Detuning', SBDetuningArray(i)));
for j=1:NumberOfPointsForSecondParam
eval(sprintf('SidebandBeam.%s = %d;', 'Power', SBPowerArray(j)));
eval(sprintf('CoolingBeam.%s = %d;', 'Power', MOTobj.TotalPower - SBPowerArray(j)));
[LoadingRateArray(i,j), StandardErrorArray(i,j), ConfidenceIntervalArray(i,j,:)] = MOTobj.runSimulation(ovenObj);
end
end
if MOTobj.DoSave
LoadingRate = struct;
LoadingRate.Values = LoadingRateArray;
LoadingRate.Errors = StandardErrorArray;
LoadingRate.CI = ConfidenceIntervalArray;
MOTobj.Results = LoadingRate;
SaveFolder = [MOTobj.SaveDirectory filesep 'Results'];
Filename = ['TwoParameterScan_' datestr(now,'yyyymmdd_HHMM')];
eval([sprintf('%s_Object', Filename) ' = MOTobj;']);
mkdir(SaveFolder);
save([SaveFolder filesep Filename], sprintf('%s_Object', Filename));
end
end