-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_molasses.m
More file actions
92 lines (82 loc) · 2.64 KB
/
Copy pathplot_molasses.m
File metadata and controls
92 lines (82 loc) · 2.64 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
%%
% Plots a graph showing the output of the zeeman_slower example.
wd = run_example('molasses_1d');
output = utils.read_output(fullfile(wd,'vel.txt'));
velocity = {output.vec};
velocity = cat(3, velocity{:});
vz = squeeze(velocity(:,3,:));
t = 10*(1:size(vz,2)); %1us timestep, output every 10
% Color code the entries by the initial velocities.
c1 = [ 0.1608 0.5804 0.6980 ];
c0 = [ 0.0118 0.0196 0.1176 ];
c = interp1([0; 30], [ c0; c1 ], vz(:,1), 'linear', 1);
clf;
for i=1:size(vz,1)
plot(t,vz(i,:), 'k', 'Color', c(i,:)); hold on;
end
set(gcf, 'Color', 'w');
xlabel('$t$ ($\mu$s)', 'interpreter', 'latex');
ylabel('$v_z$ (m/s)', 'interpreter', 'latex');
set(get(gca, 'XAxis'), 'TickLabelInterpreter', 'latex');
set(get(gca, 'YAxis'), 'TickLabelInterpreter', 'latex');
grid on;
set(gca, 'GridLineStyle', ':');
xlim([ 0 1000 ]);
% Render to file
set(gcf, 'Units', 'centimeters');
pos = get(gcf, 'Position');
set(gcf, 'Position', [ pos(1) pos(2) 9 7.5 ]);
set(gcf, 'Units', 'centimeters');
pos = get(gcf, 'Position');
w = pos(3);
h = pos(4);
p = 0.01;
set(gcf,...
'PaperUnits','centimeters',...
'PaperPosition',[p*w p*h w h],...
'PaperSize',[w*(1+2*p) h*(1+2*p)]);
set(gcf, 'Renderer', 'painters')
saveas(gcf, 'molasses.pdf')
%%
% Plot scattering rates
format = '%f,%f,';
output = utils.read_output(fullfile(wd,'scattered.txt'), 'Format', format);
rates = {output.vec};
rates = cat(3, rates{2:end});
rates_a = squeeze(rates(:,1,:));
rates_b = squeeze(rates(:,2,:));
t = 10*(0:(size(rates,3)-1)); %1us timestep, output every 10
% Color code the entries by the initial velocities.
c1a = [ 0.1608 0.5804 0.6980 ];
c0a = [ 0.0118 0.0196 0.1176 ];
c1b = [ 1.0000 0.1000 0.1000 ];
c0b = [ 0.3333 0.0000 0.0000 ];
c_a = interp1([0.4; 9 ], [ c0a; c1a ], rates_a(:,1), 'linear', 1);
c_b = interp1([0.2; 1.0 ], [ c0b; c1b ], rates_b(:,1), 'linear', 1);
clf;
for i=1:size(rates,1)
plot(t,rates_a(i,:), 'k', 'Color', c_a(i,:)); hold on;
plot(t,rates_b(i,:), 'k', 'Color', c_b(i,:)); hold on;
end
set(gcf, 'Color', 'w');
xlabel('$t$ ($\mu$s)', 'interpreter', 'latex');
ylabel('$N_i$ ($\gamma$/step)', 'interpreter', 'latex');
set(get(gca, 'XAxis'), 'TickLabelInterpreter', 'latex');
set(get(gca, 'YAxis'), 'TickLabelInterpreter', 'latex');
grid on;
set(gca, 'GridLineStyle', ':');
% Render to file
set(gcf, 'Units', 'centimeters');
pos = get(gcf, 'Position');
set(gcf, 'Position', [ pos(1) pos(2) 9 7.5 ]);
set(gcf, 'Units', 'centimeters');
pos = get(gcf, 'Position');
w = pos(3);
h = pos(4);
p = 0.01;
set(gcf,...
'PaperUnits','centimeters',...
'PaperPosition',[p*w p*h w h],...
'PaperSize',[w*(1+2*p) h*(1+2*p)]);
set(gcf, 'Renderer', 'painters')
saveas(gcf, 'rates.pdf')