-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomCodeForPLotting.m
More file actions
292 lines (239 loc) · 10.1 KB
/
CustomCodeForPLotting.m
File metadata and controls
292 lines (239 loc) · 10.1 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
function funcOut = CustomCodeForPlotting(analyVar, indivDataset, avgDataset)
%%% CustomCode for BMOT data in 11.11.2024_searchingforrydberg
indVarField = 'imagevcoAtom'; % The Field of an IndivDataset that is to be plotted on the X axis
depVarField = 'numberAtom'; % The field of an indivdataset that is to be plotted on the y axis
%[xdata_clean, ydata_clean] = getxy_filtered(indVarField, depVarField, analyVar, indivDataset, avgDataset);
[xdata_clean, ydata_clean] = getxy(indVarField, depVarField, analyVar, indivDataset, avgDataset);
scanIDs = analyVar.uniqScanList;
x = cell(length(scanIDs));
y = cell(length(scanIDs));
yerr = cell(length(scanIDs));
% Define the AVG sig scalar for each ScanID in the batch files.
AvgSig = zeros(size(scanIDs));
AvgSig_err = zeros(size(scanIDs));
for id = 1:length(scanIDs)
x{id} = [];
for basename = 1:analyVar.numBasenamesAtom
if scanIDs(id) == analyVar.meanListVar(basename)
x{id} = union(x{id},xdata_clean{basename});
end
end
y{id} = zeros(size(x{id}));
yerr{id} = zeros(size(x{id}));
tempy = zeros(size(analyVar.meanListVar));
for i = 1:length(x{id})
num=0;
for basename = 1:analyVar.numBasenamesAtom
if scanIDs(id) == analyVar.meanListVar(basename)
for j = 1:length(xdata_clean{basename})
if xdata_clean{basename}(j) == x{id}(i)
num = num + 1;
tempy(num) = ydata_clean{basename}(j);
end
end
end
end
num;
y{id}(i) = mean(tempy(1:num));
yerr{id}(i) = std(tempy(1:num))/sqrt(num);
end
%y{id}
AvgSig(id) = mean(y{id}); % use this to average over the independent variable and get a scalar for each scanID
AvgSig_err(id) = std(y{id}); % use this to std over the independent variable and get a scalar for each scanID
end
avgDataset.(depVarField) = y;
avgDataset.(strcat(depVarField,'_unc')) = yerr;
avgDataset.(strcat(depVarField,'_x')) = x;
%
% figure;
% hold on;
% for id = 1:length(scanIDs)
% errorbar(x{id}, y{id}, yerr{id},...
% 'LineStyle','-',...
% 'Marker', analyVar.MARKERS2(id),...
% 'MarkerSize', analyVar.markerSize,...
% 'MarkerFaceColor', analyVar.COLORS(id,:),...
% 'MarkerEdgeColor', 'none',...
% 'Color', analyVar.COLORS(id,:));
% end
% legend(num2str(scanIDs));
% title('Trapping- Scanning Mot coil Off time - 60 1D2 Line');
% xlabel('826 nm Synth with doubler ON [MHz]');
% ylabel('Total MCS Counts');
% hold off
%
% figure;
% hold on;
% errorbar(scanIDs, AvgSig, AvgSig_err,...
% 'LineStyle','-',...
% 'Marker', analyVar.MARKERS2(1),...
% 'MarkerSize', analyVar.markerSize,...
% 'MarkerFaceColor', analyVar.COLORS(1,:),...
% 'MarkerEdgeColor', 'none',...
% 'Color', analyVar.COLORS(1,:));
% %legend(num2str(scanIDs));
% title('Variation of Trapped Atoms with Different Zeeman Coil Field Strengths');
% xlabel('Zeeman Coil Current (A)');
% ylabel('Total Atom Count (Fast Fitting)');
% hold off
%% Custom plot
%state number of different plots to place onto same figuer
numberOfPlots = 8;
%create list for x, y, and error values
lsx = cell(1,numberOfPlots);
lsy = cell(1,numberOfPlots);
lserr = cell(1,numberOfPlots);
%scan through all the files.
%Each if statement grabs the files with the same decimal value in their
%ID and will place them in the same list
%% Added a hard coded normaliation value to all Avg values
for id = 1:length(scanIDs)
% if (round(scanIDs(id)-floor(scanIDs(id)),1) == .1)
% lsx{1}{end+1} = scanIDs(id)*80e-3;
% lsy{1}{end+1} = AvgSig(id);
% lserr{1}{end+1} = AvgSig_err(id);
% end
if (round(scanIDs(id)-floor(scanIDs(id)),1) == .2)
lsx{1}{end+1} = scanIDs(id);%*80e-3;
lsy{1}{end+1} = AvgSig(id);%/AvgSig(16);
lserr{1}{end+1} = AvgSig_err(id);%/AvgSig(16);
end
if (round(scanIDs(id)-floor(scanIDs(id)),1) == .3)
lsx{2}{end+1} = scanIDs(id);%*80e-3;
lsy{2}{end+1} = AvgSig(id);%/AvgSig(1);
lserr{2}{end+1} = AvgSig_err(id);%/AvgSig(1);
end
if (round(scanIDs(id)-floor(scanIDs(id)),1) == .4)
lsx{3}{end+1} = scanIDs(id);%*80e-3;
lsy{3}{end+1} = AvgSig(id);%/AvgSig(31);
lserr{3}{end+1} = AvgSig_err(id);%/AvgSig(31);
end
if (round(scanIDs(id)-floor(scanIDs(id)),1) == .5)
lsx{4}{end+1} = scanIDs(id);%*80e-3;
lsy{4}{end+1} = AvgSig(id);%/AvgSig(17);
lserr{4}{end+1} = AvgSig_err(id);%/AvgSig(1);
end
if (round(scanIDs(id)-floor(scanIDs(id)),1) == .6)
lsx{5}{end+1} = scanIDs(id);%*80e-3;
lsy{5}{end+1} = AvgSig(id);%/AvgSig(33);
lserr{5}{end+1} = AvgSig_err(id);%/AvgSig(33);
end
if (round(scanIDs(id)-floor(scanIDs(id)),1) == .7)
lsx{6}{end+1} = scanIDs(id);%*80e-3;
lsy{6}{end+1} = AvgSig(id);%/AvgSig(48);
lserr{6}{end+1} = AvgSig_err(id);%/AvgSig(48);
end
if (round(scanIDs(id)-floor(scanIDs(id)),1) == .8)
lsx{7}{end+1} = scanIDs(id);%*80e-3;
lsy{7}{end+1} = AvgSig(id);%/AvgSig(49);
lserr{7}{end+1} = AvgSig_err(id);%/AvgSig(49);
end
if (round(scanIDs(id)-floor(scanIDs(id)),1) == .9)
lsx{8}{end+1} = scanIDs(id);%*80e-3;
lsy{8}{end+1} = AvgSig(id);%/AvgSig(end);
lserr{8}{end+1} = AvgSig_err(id);%/AvgSig(end);
end
%%%Original code here
% errorbar(scanIDs*80e-3, AvgSig, AvgSig_err,...
% 'LineStyle','none',...
% 'Marker', analyVar.MARKERS2(1),...
% 'MarkerSize', analyVar.markerSize,...
% 'MarkerFaceColor', analyVar.COLORS(1,:),...
% 'MarkerEdgeColor', 'none',...
% 'Color', analyVar.COLORS(1,:));
end
%Plot all the different groups depening on how many stated above
%labels = {"Coil ON 65A, MOT OFF, ZM ON", "Coil ON 65 A, MOT OFF, ZM OFF", "Coil OFF, MOT OFF", "Coil ON 65 A, MOT ON", "Coil OFF, MOT ON", "Coil ON 30 A, MOT OFF, ZM OFF", "Coil ON 15 A, MOT OFF, ZM OFF"};
labels = {"Fluorescence Image Number", "Absorption Image Number", "MOT Coil = 70A (reverse Polarity)", "MOT Coil = 70A", "MOT Coil = 60A", "MOT Coil = 60A (reverse Polarity)", "MOT Coil = 65A", "MOT Coil = 65A (reverse Polarity)"}
Z_current = [0 2 4 6 8 10 12 13]
disp(Z_current)
figure;
hold on;
for plots = 1:numberOfPlots
x = cell2mat(lsx{plots});
y = cell2mat(lsy{plots});
err = cell2mat(lserr{plots});
errorbar(x, y, err,...
'LineStyle','none',...
'Marker', analyVar.MARKERS2(1),...
'MarkerSize', analyVar.markerSize,...
'MarkerFaceColor', analyVar.COLORS(plots,:),...
'MarkerEdgeColor', 'none',...
'Color', analyVar.COLORS(plots,:));
title('Atom Numbers for Fluo and Abs')
xlabel('File Number')
ylabel('Number Atoms (Counted with Fast Fitting in LabView)')
end
legend(labels, 'Location','northeastoutside')
hold off;
%labels = {"Coil ON 65 A, MOT OFF, ZM OFF", "Coil OFF, MOT OFF", "Coil ON 30 A, MOT OFF, ZM OFF", "Coil ON 15 A, MOT OFF, ZM OFF"};
% figure;
% hold on;
% for plots = 1:numberOfPlots
% if(plots == 1)
% continue
% end
% if(plots == 4)
% continue
% end
% if(plots == 5)
% continue
% end
% x = cell2mat(lsx{plots});
% y = cell2mat(lsy{plots});
% err = cell2mat(lserr{plots});
% errorbar(x, y, err,...
% 'LineStyle','none',...
% 'Marker', analyVar.MARKERS2(1),...
% 'MarkerSize', analyVar.markerSize,...
% 'MarkerFaceColor', analyVar.COLORS(plots,:),...
% 'MarkerEdgeColor', 'none',...
% 'Color', analyVar.COLORS(plots,:));
% end
%
% for plots = 1:numberOfPlots
% if(plots == 1)
% continue
% end
% if(plots == 4)
% continue
% end
% if(plots == 5)
% continue
% end
% x = cell2mat(lsx{plots});
% y = cell2mat(lsy{plots});
% err = cell2mat(lserr{plots});
% errorbar(x, y, err,...
% 'LineStyle','none',...
% 'Marker', analyVar.MARKERS2(1),...
% 'MarkerSize', analyVar.markerSize,...
% 'MarkerFaceColor', analyVar.COLORS(plots,:),...
% 'MarkerEdgeColor', 'none',...
% 'Color', analyVar.COLORS(plots,:));
% end
% legend(labels)
% title('SFI signal dependence vs time of experiment')
% xlabel('Total time for MCS Data (ms)')
% ylabel('Total MCS Counts')
% hold off
% figure;
% hold on;
% for id = 1:length(scanIDs)
% plot(x{id}, y{id}/trapz(x{id},y{id}),...
% 'LineStyle','-',...
% 'Marker', analyVar.MARKERS2(id),...
% 'MarkerSize', analyVar.markerSize,...
% 'MarkerFaceColor', analyVar.COLORS(id,:),...
% 'MarkerEdgeColor', 'none',...
% 'Color', analyVar.COLORS(id,:));
% end
% legend(num2str(scanIDs))
% title('Trapping- Scanning Mot coil Off time - 60 1D2 Line')
% xlabel('826 nm Synth with doubler ON [MHz]')
% ylabel('Normalized by total signal MCS Counts')
% hold off
funcOut.analyVar = analyVar;
funcOut.indivDataset = indivDataset;
funcOut.avgDataset = avgDataset;
end