Compare old and new. Add simulation with LUT
@ -88,8 +88,8 @@ In this section, we suppose that we are in the frame of one fast jack (all trans
|
|||||||
Let's say with make a Bragg angle scan between 10deg and 60deg during 100s.
|
Let's say with make a Bragg angle scan between 10deg and 60deg during 100s.
|
||||||
#+begin_src matlab
|
#+begin_src matlab
|
||||||
Fs = 10e3; % Sample Frequency [Hz]
|
Fs = 10e3; % Sample Frequency [Hz]
|
||||||
t = 0:1/Fs:100; % Time vector [s]
|
t = 0:1/Fs:10; % Time vector [s]
|
||||||
theta = linspace(10, 60, length(t)); % Bragg Angle [deg]
|
theta = linspace(10, 40, length(t)); % Bragg Angle [deg]
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
The IcePAP steps are following the theoretical formula:
|
The IcePAP steps are following the theoretical formula:
|
||||||
@ -190,28 +190,54 @@ exportFig('figs/generated_lut_icepap.pdf', 'width', 'wide', 'height', 'normal');
|
|||||||
#+RESULTS:
|
#+RESULTS:
|
||||||
[[file:figs/generated_lut_icepap.png]]
|
[[file:figs/generated_lut_icepap.png]]
|
||||||
|
|
||||||
We can see that the LUT is *not* the motion error (Figure [[fig:lut_correct_and_motion_error]]).
|
The current LUT implementation is the following:
|
||||||
#+begin_src matlab
|
#+begin_src matlab
|
||||||
motion_error_lut = zeros(size(lut_range));
|
motion_error_lut = zeros(size(lut_range));
|
||||||
for i = 1:length(lut_range)
|
for i = 1:length(lut_range)
|
||||||
% Get points indices where the icepap step is close to the wanted one
|
% Get points indices where the icepap step is close to the wanted one
|
||||||
close_points = icepap_steps > 1e-6*lut_range(i) - 500e-9 & icepap_steps < 1e-6*lut_range(i) + 500e-9;
|
close_points = icepap_steps > 1e-6*lut_range(i) - 500e-9 & icepap_steps < 1e-6*lut_range(i) + 500e-9;
|
||||||
% Get the corresponding motion error
|
% Get the corresponding motion error
|
||||||
motion_error_lut(i) = lut_range(i) - 1e6*mean(measured_motion(close_points)); % [um]
|
motion_error_lut(i) = lut_range(i) + (lut_range(i) - round(1e6*mean(measured_motion(close_points)))); % [um]
|
||||||
end
|
end
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
Let's compare the two Lookup Table in Figure [[fig:lut_comparison_two_methods]].
|
||||||
|
#+begin_src matlab :exports none
|
||||||
|
%% Comparison of the two Generated Lookup Table
|
||||||
|
figure;
|
||||||
|
hold on;
|
||||||
|
plot(lut_range, lut, ...
|
||||||
|
'DisplayName', 'New LUT');
|
||||||
|
plot(lut_range, motion_error_lut, ...
|
||||||
|
'DisplayName', 'Old LUT');
|
||||||
|
hold off;
|
||||||
|
xlabel('IcePAP input step [um]'); ylabel('Lookup Table output [um]');
|
||||||
|
legend('location', 'southeast');
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
#+begin_src matlab :tangle no :exports results :results file replace
|
||||||
|
exportFig('figs/lut_comparison_two_methods.pdf', 'width', 'wide', 'height', 'normal');
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
#+name: fig:lut_comparison_two_methods
|
||||||
|
#+caption: Comparison of the two lookup tables
|
||||||
|
#+RESULTS:
|
||||||
|
[[file:figs/lut_comparison_two_methods.png]]
|
||||||
|
|
||||||
|
If we plot the "corrected steps" for all steps for both methods, we clearly see the difference (Figure [[fig:lut_correct_and_motion_error]]).
|
||||||
|
|
||||||
#+begin_src matlab :exports none
|
#+begin_src matlab :exports none
|
||||||
%% Corrected motion and motion error at each step position
|
%% Corrected motion and motion error at each step position
|
||||||
figure;
|
figure;
|
||||||
hold on;
|
hold on;
|
||||||
plot(lut_range, lut-lut_range, ...
|
plot(lut_range, lut-lut_range, ...
|
||||||
'DisplayName', 'Lookup Table Correction');
|
'DisplayName', 'New LUT');
|
||||||
plot(lut_range, motion_error_lut, ...
|
plot(lut_range, motion_error_lut-lut_range, ...
|
||||||
'DisplayName', 'Motion Error');
|
'DisplayName', 'Old LUT');
|
||||||
hold off;
|
hold off;
|
||||||
xlabel('IcePAP Steps [um]'); ylabel('Corrected motion [um]');
|
xlabel('IcePAP Steps [um]'); ylabel('Corrected motion [um]');
|
||||||
ylim([-110, 110])
|
ylim([-110, 110])
|
||||||
|
legend('location', 'southeast');
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
#+begin_src matlab :tangle no :exports results :results file replace
|
#+begin_src matlab :tangle no :exports results :results file replace
|
||||||
@ -223,6 +249,53 @@ exportFig('figs/lut_correct_and_motion_error.pdf', 'width', 'wide', 'height', 'n
|
|||||||
#+RESULTS:
|
#+RESULTS:
|
||||||
[[file:figs/lut_correct_and_motion_error.png]]
|
[[file:figs/lut_correct_and_motion_error.png]]
|
||||||
|
|
||||||
|
Let's now implement both LUT to see which implementation is correct.
|
||||||
|
#+begin_src matlab :exports none
|
||||||
|
icepap_steps_output_new = lut(round(1e6*icepap_steps)-lut_range(1)+1);
|
||||||
|
i = round(1e6*icepap_steps)-motion_error_lut(1)+1;
|
||||||
|
i(i>length(motion_error_lut)) = length(motion_error_lut);
|
||||||
|
icepap_steps_output_old = motion_error_lut(i);
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
#+begin_src matlab
|
||||||
|
motion_new = zeros(size(icepap_steps_output_new));
|
||||||
|
motion_old = zeros(size(icepap_steps_output_old));
|
||||||
|
|
||||||
|
for i = 1:length(icepap_steps_output_new)
|
||||||
|
[~, i_step] = min(abs(icepap_steps_output_new(i) - 1e6*icepap_steps));
|
||||||
|
motion_new(i) = measured_motion(i_step);
|
||||||
|
|
||||||
|
[~, i_step] = min(abs(icepap_steps_output_old(i) - 1e6*icepap_steps));
|
||||||
|
motion_old(i) = measured_motion(i_step);
|
||||||
|
end
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
#+begin_src matlab :exports none
|
||||||
|
%% Measured Motion and Idealized Motion
|
||||||
|
% Use only middle motion where the LUT is working
|
||||||
|
i = round(0.1*length(icepap_steps)):round(0.9*length(icepap_steps));
|
||||||
|
figure;
|
||||||
|
hold on;
|
||||||
|
plot(icepap_steps(i), motion_new(i), ...
|
||||||
|
'DisplayName', 'Motion (new LUT)');
|
||||||
|
plot(icepap_steps(i), motion_old(i), ...
|
||||||
|
'DisplayName', 'Motion (old LUT)');
|
||||||
|
plot(icepap_steps(i), perfect_motion(i), 'k--', ...
|
||||||
|
'DisplayName', 'Ideal Motion');
|
||||||
|
hold off;
|
||||||
|
xlabel('IcePAP Steps [m]'); ylabel('Measured Motion [m]');
|
||||||
|
legend('location', 'southeast');
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
#+begin_src matlab :tangle no :exports results :results file replace
|
||||||
|
exportFig('figs/compare_old_new_lut_motion.pdf', 'width', 'wide', 'height', 'normal');
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
#+name: fig:compare_old_new_lut_motion
|
||||||
|
#+caption: Comparison of the obtained motion with new and old LUT
|
||||||
|
#+RESULTS:
|
||||||
|
[[file:figs/compare_old_new_lut_motion.png]]
|
||||||
|
|
||||||
* Attocube Calibration :noexport:
|
* Attocube Calibration :noexport:
|
||||||
|
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
BIN
figs/compare_old_new_lut_motion.pdf
Normal file
BIN
figs/compare_old_new_lut_motion.png
Normal file
After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 19 KiB |
BIN
figs/lut_comparison_two_methods.pdf
Normal file
BIN
figs/lut_comparison_two_methods.png
Normal file
After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |