-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_2d_plus_mot_from_oven.m
More file actions
66 lines (57 loc) · 1.41 KB
/
plot_2d_plus_mot_from_oven.m
File metadata and controls
66 lines (57 loc) · 1.41 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
%%
%
wd = run_example('2d_plus_mot_from_oven');
%% Load trajectories and plot results.
%
output = utils.read_output(fullfile(wd, 'pos.txt'));
position = {output.vec};
fprintf('Positions loaded.\n')
f = figure(1);
clf; set(gcf, 'Color', 'w');
frame = position{1};
atoms = plot3(frame(:,1), frame(:,2), frame(:,3), '.k');
view([ 45 45 ]); axis equal;
xlim([ -0.1 0.1 ]);
ylim([ -0.01 0.01 ]);
zlim([ -0.01 0.1 ]);
i=1;
while ishandle(f)
frame = position{i};
set(atoms, 'XData', frame(:,1), 'YData', frame(:,2), 'ZData', frame(:,3));
i = i + 1;
if i == length(position)
i = 1;
pause(0.2);
end
title(sprintf('%d', i));
pause(0.2);
end
%%
% Identify the atoms that are pushed out of the 2D MOT, and plot their
% trajectories.
ids = [];
for frame=output'
captured = frame.vec(:,3) > 0.015;
ids = unique([ids; frame.id(captured)]);
end
% Note: the atoms will not have position vectors of equal length.
trajectories = cell(length(ids),1);
for i=1:length(ids)
id = ids(i);
for frame=output'
mask = frame.id == id;
trajectories{i} = [ trajectories{i}; frame.vec(mask,:) ];
end
end
% Plot the trajectories
clf; set(gcf, 'Color', 'w');
for trajectory=trajectories'
pos = trajectory{1};
plot3(pos(:,1), pos(:,2), pos(:,3), '-k'); hold on;
end
axis equal;
%%
% Close up on the source itself
xlim([ -0.01 0.01 ]);
ylim([ -0.01 0.01 ]);
zlim([ -0.01 0.01 ]);