dcm-stepper-calibration/dcm_lookup_tables.html

5354 lines
257 KiB
HTML
Raw Normal View History

2022-02-15 14:12:21 +01:00
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2022-02-15 mar. 14:11 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>ESRF Double Crystal Monochromator - Compensating Repeatable Positioning Errors of Fast Jacks</title>
<meta name="author" content="Dehaeze Thomas" />
<meta name="generator" content="Org Mode" />
<link rel="stylesheet" type="text/css" href="https://research.tdehaeze.xyz/css/style.css"/>
<script type="text/javascript" src="https://research.tdehaeze.xyz/js/script.js"></script>
<script>
MathJax = {
svg: {
scale: 1,
fontCache: "global"
},
tex: {
tags: "ams",
multlineWidth: "%MULTLINEWIDTH",
tagSide: "right",
macros: {bm: ["\\boldsymbol{#1}",1],},
tagIndent: ".8em"
}
};
</script>
<script id="MathJax-script" async
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js"></script>
</head>
<body>
<div id="org-div-home-and-up">
<a accesskey="h" href="../index.html"> UP </a>
|
<a accesskey="H" href="../index.html"> HOME </a>
</div><div id="content" class="content">
<h1 class="title">ESRF Double Crystal Monochromator - Compensating Repeatable Positioning Errors of Fast Jacks</h1>
<div id="table-of-contents" role="doc-toc">
<h2>Table of Contents</h2>
<div id="text-table-of-contents" role="doc-toc">
<ul>
<li><a href="#orgc2f986b">1. Hardware and Software Implementation</a>
<ul>
<li><a href="#org9ffdfea">1.1. Measurement setup</a></li>
<li><a href="#orgdfaf163">1.2. LUT Implementation</a></li>
</ul>
</li>
<li><a href="#org2543bb5">2. Initial and proposed LUT computations</a>
<ul>
<li><a href="#org0c0db33">2.1. Patterns in the Fast Jack motion errors</a></li>
<li><a href="#orgc556924">2.2. Experimental Data - Current Method</a></li>
<li><a href="#orgfc8e24c">2.3. Simulation</a></li>
<li><a href="#org16d0e40">2.4. Experimental Data - Proposed method (BLISS first implementation)</a></li>
<li><a href="#org0ad2a22">2.5. Comparison of the errors in the reciprocal length space</a></li>
<li><a href="#orgfb3cd1d">2.6. Period of errors</a>
<ul>
<li>
<ul>
<li><a href="#org3e9dab6">2.6.0.1. Load Test Data</a></li>
<li><a href="#org8e58609">2.6.0.2. FIR Filters</a></li>
<li><a href="#org199aeaf">2.6.0.3. Filtered Data</a></li>
<li><a href="#org2ee6be7">2.6.0.4. Discussion</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li><a href="#org50b88dd">3. LUT creation from experimental data</a>
<ul>
<li><a href="#org406d5cb">3.1. Load Data</a></li>
<li><a href="#orgab14298">3.2. IcePAP generated Steps</a></li>
<li><a href="#orgd0709fe">3.3. Bragg and Fast Jack Velocities</a></li>
<li><a href="#orgc163a34">3.4. Bragg Angle Errors / Delays</a></li>
<li><a href="#orgb4227a3">3.5. Errors in the Frame of the Crystals</a></li>
<li><a href="#org96856e0">3.6. Errors in the Frame of the Fast Jacks</a></li>
<li><a href="#org26629e2">3.7. Analysis of the obtained error</a></li>
<li><a href="#orge83d6a7">3.8. Filtering of Data</a></li>
<li><a href="#orgfb954c6">3.9. LUT creation</a></li>
<li><a href="#org9fa568c">3.10. Cubic Interpolation of the LUT</a></li>
</ul>
</li>
<li><a href="#orgf08a190">4. Position Repeatability</a>
<ul>
<li><a href="#org45feeef">4.1. Repeatability over several minutes</a></li>
<li><a href="#org207d90d">4.2. Repeatability over several days</a></li>
<li><a href="#org00c772f">4.3. Which error is repeatable and which is not?</a></li>
<li><a href="#org9131f0a">4.4. Estimation of the errors in mode B</a></li>
<li><a href="#orge3c38c5">4.5. Conclusion</a></li>
</ul>
</li>
<li><a href="#orge4327b1">5. LUT Software Implementation</a>
<ul>
<li><a href="#orge7d7451">5.1. Matlab implementation</a>
<ul>
<li><a href="#org0847718">5.1.1. LUT Creation</a></li>
<li><a href="#org346d396">5.1.2. Compare Mode A and Mode B</a></li>
<li><a href="#org692b5f7">5.1.3. Analysis of the remaining errors</a></li>
</ul>
</li>
<li><a href="#org18efe32">5.2. Python implementation</a>
<ul>
<li><a href="#orgd31fecc">5.2.1. Load Data</a></li>
<li><a href="#orgf8d52c6">5.2.2. Convert Data in the frame of the fast jack</a></li>
<li><a href="#org7fb5cd2">5.2.3. Filter Data</a></li>
<li><a href="#orga41902a">5.2.4. Get Only Interesting Data</a></li>
<li><a href="#org2e651bd">5.2.5. LUT creation</a></li>
</ul>
</li>
<li><a href="#org6f54d35">5.3. New Method (Python)</a>
<ul>
<li><a href="#orga6a9fd2">5.3.1. Load Data</a></li>
<li><a href="#org4ddd4af">5.3.2. Convert Data in the frame of the fast jack</a></li>
<li><a href="#org10034dc">5.3.3. Filter Data</a></li>
<li><a href="#org7dbe041">5.3.4. Get Only Interesting Data</a></li>
<li><a href="#org55dad3f">5.3.5. New LUT creation</a></li>
<li><a href="#org1905da4">5.3.6. LUT creation</a></li>
<li><a href="#orgf855193">5.3.7. Merge LUT</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#orgcd970e0">6. Optimal Trajectory</a>
<ul>
<li><a href="#org9d94c86">6.1. Filtering Disturbances and Noise</a>
<ul>
<li>
<ul>
<li><a href="#org9308e02">6.1.0.1. Errors induced by the Fast Jack</a></li>
<li><a href="#org8fbb27a">6.1.0.2. Vibrations induced by <code>mcoil</code></a></li>
<li><a href="#orgd503603">6.1.0.3. Measurement noise of the interferometers</a></li>
<li><a href="#org3089049">6.1.0.4. Interferometer - Periodic non-linearity</a></li>
<li><a href="#orgea613b6">6.1.0.5. Implemented Filter</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#org3c7a43c">6.2. First Estimation of the optimal trajectory</a></li>
<li><a href="#org663fdc6">6.3. Constant Fast Jack Velocity</a></li>
<li><a href="#orgad7eae4">6.4. Constant Bragg Angular Velocity</a></li>
<li><a href="#org05b1343">6.5. Mixed Trajectory</a></li>
</ul>
</li>
<li><a href="#orgd3f82f7">7. Constant Fast Jack velocity</a>
<ul>
<li><a href="#orgfba3d3d">7.1. Analysis of measured motion</a></li>
<li><a href="#orga35bfe1">7.2. LUT Creation</a></li>
<li><a href="#org36adeca">7.3. Comparison of errors in mode A and mode B</a></li>
<li><a href="#org71c2a4c">7.4. Test LUT just after making it</a></li>
<li><a href="#org50e7208">7.5. Make a LUT based on mode B</a></li>
<li><a href="#org1d65b2e">7.6. Repeatability of stepper errors</a></li>
</ul>
</li>
<li><a href="#orgaebc0bd">8. Effect of the number of points in the trajectory in mode B</a>
<ul>
<li><a href="#orgf9bc8cd">8.1. LUT</a></li>
<li><a href="#orgdd5f20e">8.2. Trajectory with increment of \(1\,\mu m\)</a></li>
<li><a href="#org83f340c">8.3. Trajectory with increment of \(0.4\,\mu m\)</a></li>
<li><a href="#org8a16601">8.4. Spatial Errors - Comparison</a></li>
</ul>
</li>
<li><a href="#org639e647">9. LUT for energy scans (XANES)</a>
<ul>
<li><a href="#orga40ac29">9.1. Velocities</a></li>
<li><a href="#org45aab76">9.2. test</a></li>
</ul>
</li>
<li><a href="#org41393ae">10. Merge LUT</a>
<ul>
<li><a href="#orgd63ad79">10.1. Merge LUT</a></li>
</ul>
</li>
</ul>
</div>
</div>
<hr>
<p>This report is also available as a <a href="./dcm_lookup_tables.pdf">pdf</a>.</p>
<hr>
<p>
This document summarizes the studies done on the compensation of repeatable errors of the Fast Jacks.
</p>
<p>
Each Fast Jack is composed of one stepper motor directly driving (i.e. without any reducer) a ball screw with a pitch of 1mm (i.e. 1 stepper motor turn makes a 1mm linear motion).
</p>
<p>
When scanning using the fast jack without any sort of control (i.e. in <code>mode A</code>), rather large positioning errors can be measured by the interferometers.
Some of these errors are repeatable while other are not repeatable (see Section <a href="#org7d7ef9a">4</a>).
</p>
<p>
It is here studied how to measure these repeatable positioning errors and how to compensate them using a Lookup Table (LUT).
This functioning mode is called <code>mode B</code>.
</p>
<p>
Then there is a piezoelectric stack in series with the fast-jack which is working in closed-loop with the interferometer signals and that is used to compensate the remaining (mostly non-repeatable) errors induced by the stepper motor and other disturbances.
This is called <code>mode C</code>.
</p>
<p>
The compensation of repeatable errors using the Lookup Tables has several goals:
</p>
<ul class="org-ul">
<li>Reducing the positioning errors below the stroke of the piezoelectric stack actuator.
Otherwise the stroke of the piezoelectric stack in mode C (feedback control) could be too small and errors cannot be further controlled.</li>
<li>Reducing the errors above the bandwidth of the feedback controller.
The bandwidth of the feedback controller is limited by the mechanical behavior of the DCM, and therefore vibrations outside this bandwidth can only be compensated using calibration / lookup tables.</li>
</ul>
<p>
The general procedure to compute and use the LUT is shown in Figure <a href="#org0cf0a34">1</a>.
Note that there is some exchange of information between each step indicated by the arrow and some <code>.dat</code> file containing the data.
It can separated into four main steps:
</p>
<ol class="org-ol">
<li>Perform a scan in mode A in order to properly measure the Fast Jack motion errors.
The scan should be done in such a way that the motion errors of the Fast Jack can be separated from the other disturbances and non-repeatable errors by the use of filtering.
This is the subject of Sections <a href="#orgb3f5ef4">6</a> and <a href="#org6767318">7</a></li>
<li>Compute the LUT from the measured errors.
For each Fast Jack, the LUT associates the wanted position with the corresponding IcePAP step at which the Fast Jack is effectively at the correct position (as measured during the previous scan).
This is discussed in Section <a href="#org8fcfd0c">2</a> and the software implementation is described in Section <a href="#orgef2f072">5</a>.
The LUT data is stored in a <code>lut.dat</code> file and can be further loaded in the next step.</li>
<li>Generate a trajectory.
The trajectory links several motors for synchronization (mainly bragg with fast jacks).
The LUT data is included in this trajectory such that the measured repeatable errors that are included in the LUT are compensated.
This is discussed in Section <a href="#org14c7f5c">8</a>.</li>
<li>Make a scan in mode B.
The IcePAP is moving all motors in a synchronized way and tries to follow the trajectory data with included compensation of repeatable errors.</li>
</ol>
<p>
The Hardware and Software setup used for the measurement and tests of the lookup table is described in Section <a href="#org428a9b8">1</a>.
</p>
<p>
For each of these steps, several problems can lead to inaccuracies in the computed LUT and trajectory which will result in non optimal compensation of repeatable errors during a scan in mode B.
In order to have the best possible mode B positioning accuracy, each of these problems are studied in this document.
</p>
<p>
A comparison between the way the LUT was built before December 2021 and after is performed in Section <a href="#org8fcfd0c">2</a>.
Complete process from measurement of Fast-Jack errors to the tests in mode B is described in Section <a href="#org1906062">3</a>.
</p>
<p>
As the DCM will be used for X-ray absorption techniques such as XANES, recommended scan parameters are given in Section <a href="#org1cee83a">9</a>.
</p>
<div id="org0cf0a34" class="figure">
<p><img src="figs/lut_process_steps.png" alt="lut_process_steps.png" />
</p>
<p><span class="figure-number">Figure 1: </span>Overview of the process to make the LUT and associated possible issues.</p>
</div>
<div id="outline-container-orgc2f986b" class="outline-2">
<h2 id="orgc2f986b"><span class="section-number-2">1.</span> Hardware and Software Implementation</h2>
<div class="outline-text-2" id="text-1">
<p>
<a id="org428a9b8"></a>
</p>
<p>
In this section, a brief description of the experimental setup required to computed the Lookup Tables is given (Section <a href="#org2af4994">1.2</a>).
</p>
<p>
It is important also to see how the trajectories and Lookup Tables are computed and implemented in terms of software in order to understand the possible limitations.
This is described in Section <a href="#org9369f95">1.1</a>.
</p>
</div>
<div id="outline-container-org9ffdfea" class="outline-3">
<h3 id="org9ffdfea"><span class="section-number-3">1.1.</span> Measurement setup</h3>
<div class="outline-text-3" id="text-1-1">
<p>
<a id="org9369f95"></a>
</p>
<p>
In order to measure the errors induced by the fast jacks, scans have to be made, and the following signals have to be measured simultaneously:
</p>
<ul class="org-ul">
<li>The wanted fast jack position: step sent by the IcePAP</li>
<li>The actual (measured) position</li>
</ul>
<p>
The experimental setup is schematically shown in Figure <a href="#org4902687">2</a>.
</p>
<p>
The procedure is the following:
</p>
<ul class="org-ul">
<li>A Bragg angle trajectory \(\theta\) is generated from Bliss and loaded in the IcePAP as a kind of lookup table.
This lookup table is only used to synchronize all the motors, and no compensation of errors are implemented.</li>
<li>The IcePAP generates some steps \([u_{u_r},\ u_{u_h},\ u_{d}]\) that are sent to the fast jacks.</li>
<li>The motion of the crystals \([d_z,\ r_y,\ r_x]\) is measured with the interferometers.
The transformation from interferometers values to position and orientation errors of crystals is performed inside the Speedgoat.</li>
<li>Finally, the corresponding motion \([d_{u_r},\ r_{u_h},\ r_d]\) of the each fast jack is computed afterwards in BLISS.</li>
</ul>
<p>
In order to create the LUT, the measured motion of the fast jacks \([d_{u_r},\ r_{u_h},\ r_d]\) and the IcePAP steps \([u_{u_r},\ u_{u_h},\ u_{d}]\) have to be measured simultaneously.
</p>
<div id="org4902687" class="figure">
<p><img src="figs/block_diagram_lut_stepper.png" alt="block_diagram_lut_stepper.png" />
</p>
<p><span class="figure-number">Figure 2: </span>Block diagram of the experiment to create the Lookup Table</p>
</div>
</div>
</div>
<div id="outline-container-orgdfaf163" class="outline-3">
<h3 id="orgdfaf163"><span class="section-number-3">1.2.</span> LUT Implementation</h3>
<div class="outline-text-3" id="text-1-2">
<p>
<a id="org2af4994"></a>
</p>
<p>
The computation of the LUT consists of generating an array with 4 columns.
The first column corresponds to the position (in mm) where it is wanted to position the Fast Jack.
The remaining three columns are corresponding (for each motor: <code>fjpur</code>, <code>fjpuh</code> and <code>fjpd</code>) to the position (i.e. step) where the IcePAP should position the motors such that the real position is corresponding to the first column.
This array <code>lut.dat</code> can have as many lines as wanted.
</p>
<p>
In BLISS, it is specified where the LUT is stored using the following command:
</p>
<div class="org-src-container">
<pre class="src src-python">dcm.lut.load(data_file=<span class="org-string">"lut.dat"</span>, data_dir=<span class="org-string">"directory_where_lut_are_stored"</span>)
</pre>
</div>
<p>
Then, to use the LUT, a trajectory has to be loaded with the <code>use_lut=True</code> parameter:
</p>
<div class="org-src-container">
<pre class="src src-python">dcm.trajectory.load_bragg(<span class="org-highlight-numbers-number">12</span>, <span class="org-highlight-numbers-number">18</span>, <span class="org-highlight-numbers-number">1000</span>, use_lut=<span class="org-constant">True</span>)
</pre>
</div>
<p>
To perform the trajectory (synchronization of several motors), a &ldquo;trajectory motor&rdquo; is used in the IcePAP.
This motor is virtual and is used to synchronize the following motors: <code>mbrag</code>, <code>msafe</code>, <code>mcoil</code>, <code>fjsur</code>, <code>fjsuh</code> and <code>fjsd</code>.
To specify how to do the trajectory, an array with 7 columns is used.
The first column corresponds to the &ldquo;trajectory motor&rdquo; (i.e. Bragg, FJS, Energy, &#x2026;).
The remaining 6 columns are the 6 real motors that have to be synchronized.
Values are computed based on theoretical positions.
</p>
<p>
The lines of this array are separated with an constant <code>fjs</code> increment which is specified by the parameter <code>1000</code> when loading the trajectory.
The parameter <code>1000</code> indicates that the trajectory should contains 1000 points every millimeter of the Fast Jack motion.
In that case, the trajectory will be specific for every micrometer of fast jack motion.
Note that the loaded points of the trajectory are always with constant Fast Jack motion increment even though the trajectory is made over Bragg angle or energy.
</p>
<p>
Then, if <code>use_lut=True</code> is used, the LUT data will be integrated in the motor trajectory by modifying the columns corresponding to the <code>fjsur</code>, <code>fjsuh</code> and <code>fjsd</code> motors.
For every point in the trajectory:
</p>
<ul class="org-ul">
<li>the data in the LUT corresponding to the wanted position of the fast-jack is found</li>
<li>a linear interpolation between the two adjacent points is performed, and the result is loaded in the array</li>
</ul>
<p>
Then, when performing a trajectory, the IcePAP will use the loaded data (including the LUT information) to control the position of each motor.
Spline interpolation is performed between the specified points in the LUT.
</p>
<div class="important" id="org9b5a73a">
<p>
Therefore, several errors can be introduced even though the LUT is computed from perfect data:
</p>
<ul class="org-ul">
<li>Linear interpolation of the LUT when computing the trajectory points can result in large errors if not enough points are used in the LUT</li>
<li>Spline interpolation in the IcePAP can introduce errors</li>
</ul>
</div>
</div>
</div>
</div>
<div id="outline-container-org2543bb5" class="outline-2">
<h2 id="org2543bb5"><span class="section-number-2">2.</span> Initial and proposed LUT computations</h2>
<div class="outline-text-2" id="text-2">
<p>
<a id="org8fcfd0c"></a>
</p>
</div>
<div id="outline-container-org0c0db33" class="outline-3">
<h3 id="org0c0db33"><span class="section-number-3">2.1.</span> Patterns in the Fast Jack motion errors</h3>
<div class="outline-text-3" id="text-2-1">
<p>
In order to understand what should be the &ldquo;sampling distance&rdquo; for the lookup table of the stepper motor, we have to analyze the displacement errors induced by the stepper motor.
</p>
<p>
Let&rsquo;s load the measurements of one bragg angle scan without any LUT.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Load Data of the new LUT method</span>
ol_bragg = (<span class="org-matlab-math">pi</span><span class="org-builtin">/</span>180)<span class="org-builtin">*</span>1e<span class="org-builtin">-</span>5<span class="org-builtin">*</span>double(h5read(<span class="org-string">'Qutools_test_0001.h5'</span>,<span class="org-string">'/33.1/instrument/trajmot/data'</span>)); <span class="org-comment-delimiter">% </span><span class="org-comment">Bragg angle [rad]</span>
ol_dzw = 10.5e<span class="org-builtin">-</span>3<span class="org-builtin">./</span>(2<span class="org-builtin">*</span>cos(ol_bragg)); <span class="org-comment-delimiter">% </span><span class="org-comment">Wanted distance between crystals [m]</span>
ol_dz = 1e<span class="org-builtin">-</span>9<span class="org-builtin">*</span>double(h5read(<span class="org-string">'Qutools_test_0001.h5'</span>,<span class="org-string">'/33.1/instrument/xtal_111_dz_filter/data'</span>)); <span class="org-comment-delimiter">% </span><span class="org-comment">Dz distance between crystals [m]</span>
ol_dry = 1e<span class="org-builtin">-</span>9<span class="org-builtin">*</span>double(h5read(<span class="org-string">'Qutools_test_0001.h5'</span>,<span class="org-string">'/33.1/instrument/xtal_111_dry_filter/data'</span>)); <span class="org-comment-delimiter">% </span><span class="org-comment">Ry [rad]</span>
ol_drx = 1e<span class="org-builtin">-</span>9<span class="org-builtin">*</span>double(h5read(<span class="org-string">'Qutools_test_0001.h5'</span>,<span class="org-string">'/33.1/instrument/xtal_111_drx_filter/data'</span>)); <span class="org-comment-delimiter">% </span><span class="org-comment">Rx [rad]</span>
ol_t = 1e<span class="org-builtin">-</span>6<span class="org-builtin">*</span>double(h5read(<span class="org-string">'Qutools_test_0001.h5'</span>,<span class="org-string">'/33.1/instrument/time/data'</span>)); <span class="org-comment-delimiter">% </span><span class="org-comment">Time [s]</span>
ol_ddz = ol_dzw<span class="org-builtin">-</span>ol_dz; <span class="org-comment-delimiter">% </span><span class="org-comment">Distance Error between crystals [m]</span>
</pre>
</div>
<div id="orge7eb5d9" class="figure">
<p><img src="figs/exp_without_lut_xtal_pos_errors.png" alt="exp_without_lut_xtal_pos_errors.png" />
</p>
<p><span class="figure-number">Figure 3: </span>Orientation and Distance error of the Crystal measured by the interferometers</p>
</div>
<p>
Now let&rsquo;s convert the errors from the frame of the crystal to the frame of the fast jacks (inverse kinematics problem) using the Jacobian matrix.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Compute Fast Jack position errors</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">Jacobian matrix for Fast Jacks and 111 crystal</span>
J_a_111 = [1, 0.14, <span class="org-builtin">-</span>0.1525
1, 0.14, 0.0675
1, <span class="org-builtin">-</span>0.14, 0.0425];
ol_de_111 = [ol_ddz<span class="org-builtin">'</span>; ol_dry<span class="org-builtin">'</span>; ol_drx<span class="org-builtin">'</span>];
<span class="org-comment-delimiter">% </span><span class="org-comment">Fast Jack position errors</span>
ol_de_fj = J_a_111<span class="org-builtin">*</span>ol_de_111;
ol_fj_ur = ol_de_fj(1,<span class="org-builtin">:</span>);
ol_fj_uh = ol_de_fj(2,<span class="org-builtin">:</span>);
ol_fj_d = ol_de_fj(3,<span class="org-builtin">:</span>);
</pre>
</div>
<div id="org0ab4765" class="figure">
<p><img src="figs/exp_without_lut_fj_pos_errors.png" alt="exp_without_lut_fj_pos_errors.png" />
</p>
<p><span class="figure-number">Figure 4: </span>Estimated motion errors of the fast jacks during the scan</p>
</div>
<p>
Let&rsquo;s now identify this pattern as a function of the fast-jack position.
</p>
<p>
As we want to done frequency Fourier transform, we need to have uniform sampling along the fast jack position.
To do so, the function <code>resample</code> is used.
</p>
<div class="org-src-container">
<pre class="src src-matlab">Xs = 0.1e<span class="org-builtin">-</span>6; <span class="org-comment-delimiter">% </span><span class="org-comment">Sampling Distance [m]</span>
<span class="org-matlab-cellbreak">%% Re-sampled data with uniform spacing [m]</span>
ol_fj_ur_u = resample(ol_fj_ur, ol_dzw, 1<span class="org-builtin">/</span>Xs);
ol_fj_uh_u = resample(ol_fj_uh, ol_dzw, 1<span class="org-builtin">/</span>Xs);
ol_fj_d_u = resample(ol_fj_d, ol_dzw, 1<span class="org-builtin">/</span>Xs);
ol_fj_u = Xs<span class="org-builtin">*</span>[1<span class="org-builtin">:</span>length(ol_fj_ur_u)]; <span class="org-comment-delimiter">% </span><span class="org-comment">Sampled Jack Position</span>
</pre>
</div>
<p>
The result is shown in Figure <a href="#org410be7a">5</a>.
</p>
<div id="org410be7a" class="figure">
<p><img src="figs/exp_without_lut_fj_pos_errors_distance.png" alt="exp_without_lut_fj_pos_errors_distance.png" />
</p>
<p><span class="figure-number">Figure 5: </span>Position error of fast jacks as a function of the fast jack motion</p>
</div>
<p>
Let&rsquo;s now perform a Power Spectral Analysis of the measured displacement errors of the Fast Jack.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-comment-delimiter">% </span><span class="org-comment">Hanning Windows with 250um width</span>
win = hanning(floor(400e<span class="org-builtin">-</span>6<span class="org-builtin">/</span>Xs));
<span class="org-comment-delimiter">% </span><span class="org-comment">Power Spectral Density [m2/(1/m)]</span>
[S_fj_ur, f] = pwelch(ol_fj_ur_u<span class="org-builtin">-</span>mean(ol_fj_ur_u), win, 0, [], 1<span class="org-builtin">/</span>Xs);
[S_fj_uh, <span class="org-builtin">~</span>] = pwelch(ol_fj_uh_u<span class="org-builtin">-</span>mean(ol_fj_uh_u), win, 0, [], 1<span class="org-builtin">/</span>Xs);
[S_fj_d, <span class="org-builtin">~</span>] = pwelch(ol_fj_d_u <span class="org-builtin">-</span>mean(ol_fj_d_u ), win, 0, [], 1<span class="org-builtin">/</span>Xs);
</pre>
</div>
<p>
As shown in Figure <a href="#orge8a4ddd">6</a>, we can see a fundamental &ldquo;reciprocal length&rdquo; of \(5 \cdot 10^4\,[1/m]\) and its harmonics.
This corresponds to a length of \(\frac{1}{5\cdot 10^4} = 20\,[\mu m]\).
</p>
<div id="orge8a4ddd" class="figure">
<p><img src="figs/exp_without_lut_wavenumber_asd.png" alt="exp_without_lut_wavenumber_asd.png" />
</p>
<p><span class="figure-number">Figure 6: </span>Spectral content of the error as a function of the reciprocal length</p>
</div>
<p>
Instead of looking at that as a function of the reciprocal length, we can look at it as a function of the spectral distance (Figure <a href="#orgfc5181e">7</a>).
</p>
<p>
We see that the errors have a pattern with &ldquo;spectral distances&rdquo; equal to \(5\,[\mu m]\), \(10\,[\mu m]\), \(20\,[\mu m]\) and smaller harmonics.
</p>
<div id="orgfc5181e" class="figure">
<p><img src="figs/exp_without_lut_spectral_content_fj_error.png" alt="exp_without_lut_spectral_content_fj_error.png" />
</p>
<p><span class="figure-number">Figure 7: </span>Spectral content of the error as a function of the spectral distance</p>
</div>
<p>
Let&rsquo;s try to understand these results.
One turn of the stepper motor corresponds to a vertical motion of 1mm.
The stepper motor has 50 pairs of poles, therefore one pair of pole corresponds to a motion of \(20\,[\mu m]\) which is the fundamental &ldquo;spectral distance&rdquo; we observe.
</p>
<div class="org-src-container">
<pre class="src src-matlab">CPS_ur = flip(<span class="org-builtin">-</span>cumtrapz(flip(f), flip(S_fj_ur)));
CPS_uh = flip(<span class="org-builtin">-</span>cumtrapz(flip(f), flip(S_fj_uh)));
CPS_d = flip(<span class="org-builtin">-</span>cumtrapz(flip(f), flip(S_fj_d)));
</pre>
</div>
<p>
From Figure <a href="#org002674d">8</a>, we can see that if the motion errors with a period of \(5\,[\mu m]\) and \(10\,[\mu m]\) can be dealt with the lookup table, this will reduce a lot the positioning errors of the fast jack.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Cumulative Spectrum</span>
<span class="org-builtin">figure</span>;
<span class="org-builtin">hold</span> <span class="org-matlab-commanddual-string">on;</span>
<span class="org-builtin">plot</span>(1e6<span class="org-builtin">./</span>f, sqrt(CPS_ur), <span class="org-string">'DisplayName'</span>, <span class="org-string">'$u_r$'</span>);
<span class="org-builtin">plot</span>(1e6<span class="org-builtin">./</span>f, sqrt(CPS_uh), <span class="org-string">'DisplayName'</span>, <span class="org-string">'$u_j$'</span>);
<span class="org-builtin">plot</span>(1e6<span class="org-builtin">./</span>f, sqrt(CPS_d), <span class="org-string">'DisplayName'</span>, <span class="org-string">'$d$'</span>);
<span class="org-builtin">hold</span> <span class="org-matlab-commanddual-string">off;</span>
<span class="org-builtin">set</span>(<span class="org-variable-name">gca</span>, <span class="org-string">'xscale'</span>, <span class="org-string">'log'</span>); <span class="org-builtin">set</span>(<span class="org-variable-name">gca</span>, <span class="org-string">'yscale'</span>, <span class="org-string">'log'</span>);
<span class="org-builtin">xlabel</span>(<span class="org-string">'Spectral Distance [$\mu m$]'</span>); <span class="org-builtin">ylabel</span>(<span class="org-string">'Cumulative Spectrum [$m$]'</span>)
<span class="org-builtin">xlim</span>([1, 500]); <span class="org-builtin">ylim</span>([1e<span class="org-builtin">-</span>9, 1e<span class="org-builtin">-</span>5]);
<span class="org-builtin">legend</span>(<span class="org-string">'location'</span>, <span class="org-string">'northwest'</span>);
</pre>
</div>
<div id="org002674d" class="figure">
<p><img src="figs/exp_without_lut_cas_pos_error.png" alt="exp_without_lut_cas_pos_error.png" />
</p>
<p><span class="figure-number">Figure 8: </span>Cumulative spectrum from small spectral distances to large spectral distances</p>
</div>
</div>
</div>
<div id="outline-container-orgc556924" class="outline-3">
<h3 id="orgc556924"><span class="section-number-3">2.2.</span> Experimental Data - Current Method</h3>
<div class="outline-text-3" id="text-2-2">
<p>
The current used method is an iterative one.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Load Experimental Data</span>
ol_bragg = double(h5read(<span class="org-string">'first_beam_0001.h5'</span>,<span class="org-string">'/31.1/instrument/trajmot/data'</span>));
ol_drx = h5read(<span class="org-string">'first_beam_0001.h5'</span>,<span class="org-string">'/31.1/instrument/xtal_111_drx_filter/data'</span>);
lut_1_bragg = double(h5read(<span class="org-string">'first_beam_0001.h5'</span>,<span class="org-string">'/32.1/instrument/trajmot/data'</span>));
lut_1_drx = h5read(<span class="org-string">'first_beam_0001.h5'</span>,<span class="org-string">'/32.1/instrument/xtal_111_drx_filter/data'</span>);
lut_2_bragg = double(h5read(<span class="org-string">'first_beam_0001.h5'</span>,<span class="org-string">'/33.1/instrument/trajmot/data'</span>));
lut_2_drx = h5read(<span class="org-string">'first_beam_0001.h5'</span>,<span class="org-string">'/33.1/instrument/xtal_111_drx_filter/data'</span>);
lut_3_bragg = double(h5read(<span class="org-string">'first_beam_0001.h5'</span>,<span class="org-string">'/34.1/instrument/trajmot/data'</span>));
lut_3_drx = h5read(<span class="org-string">'first_beam_0001.h5'</span>,<span class="org-string">'/34.1/instrument/xtal_111_drx_filter/data'</span>);
lut_4_bragg = double(h5read(<span class="org-string">'first_beam_0001.h5'</span>,<span class="org-string">'/36.1/instrument/trajmot/data'</span>));
lut_4_drx = h5read(<span class="org-string">'first_beam_0001.h5'</span>,<span class="org-string">'/36.1/instrument/xtal_111_drx_filter/data'</span>);
</pre>
</div>
<p>
The relative orientation of the two <code>111</code> mirrors in the \(x\) directions are compared in Figure <a href="#org90e1f2b">9</a> for several iterations.
We can see that after the first iteration, the orientation error has an opposite sign as for the case without LUT.
</p>
<div id="org90e1f2b" class="figure">
<p><img src="figs/lut_old_method_exp_data.png" alt="lut_old_method_exp_data.png" />
</p>
<p><span class="figure-number">Figure 9: </span>\(R_x\) error with the current LUT method</p>
</div>
</div>
</div>
<div id="outline-container-orgfc8e24c" class="outline-3">
<h3 id="orgfc8e24c"><span class="section-number-3">2.3.</span> Simulation</h3>
<div class="outline-text-3" id="text-2-3">
<p>
In this section, we suppose that we are in the frame of one fast jack (all transformations are already done), and we wish to create a LUT for one fast jack.
</p>
<p>
Let&rsquo;s say with make a Bragg angle scan between 10deg and 60deg during 100s.
</p>
<div class="org-src-container">
<pre class="src src-matlab">Fs = 10e3; <span class="org-comment-delimiter">% </span><span class="org-comment">Sample Frequency [Hz]</span>
t = 0<span class="org-builtin">:</span>1<span class="org-builtin">/</span>Fs<span class="org-builtin">:</span>10; <span class="org-comment-delimiter">% </span><span class="org-comment">Time vector [s]</span>
theta = linspace(10, 40, length(t)); <span class="org-comment-delimiter">% </span><span class="org-comment">Bragg Angle [deg]</span>
</pre>
</div>
<p>
The IcePAP steps are following the theoretical formula:
</p>
\begin{equation}
d_z = \frac{d_{\text{off}}}{2 \cos \theta}
\end{equation}
<p>
with \(\theta\) the bragg angle and \(d_{\text{off}} = 10\,mm\).
</p>
<p>
The motion to follow is then:
</p>
<div class="org-src-container">
<pre class="src src-matlab">perfect_motion = 10e<span class="org-builtin">-</span>3<span class="org-builtin">./</span>(2<span class="org-builtin">*</span>cos(theta<span class="org-builtin">*</span><span class="org-matlab-math">pi</span><span class="org-builtin">/</span>180)); <span class="org-comment-delimiter">% </span><span class="org-comment">Perfect motion [m]</span>
</pre>
</div>
<p>
And the IcePAP is generated those steps:
</p>
<div class="org-src-container">
<pre class="src src-matlab">icepap_steps = perfect_motion; <span class="org-comment-delimiter">% </span><span class="org-comment">IcePAP steps measured by Speedgoat [m]</span>
</pre>
</div>
<div id="org4f3d670" class="figure">
<p><img src="figs/bragg_angle_icepap_steps_idealized.png" alt="bragg_angle_icepap_steps_idealized.png" />
</p>
<p><span class="figure-number">Figure 10: </span>IcePAP Steps as a function of the Bragg Angle</p>
</div>
<p>
Then, we are measuring the motion of the Fast Jack using the Interferometer.
The motion error is larger than in reality to be angle to see it more easily.
</p>
<div class="org-src-container">
<pre class="src src-matlab">motion_error = 100e<span class="org-builtin">-</span>6<span class="org-builtin">*</span>sin(2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>perfect_motion<span class="org-builtin">/</span>1e<span class="org-builtin">-</span>3); <span class="org-comment-delimiter">% </span><span class="org-comment">Error motion [m]</span>
measured_motion = perfect_motion <span class="org-builtin">+</span> motion_error; <span class="org-comment-delimiter">% </span><span class="org-comment">Measured motion of the Fast Jack [m]</span>
</pre>
</div>
<div id="org0997eb4" class="figure">
<p><img src="figs/measured_and_ideal_motion_fast_jacks.png" alt="measured_and_ideal_motion_fast_jacks.png" />
</p>
<p><span class="figure-number">Figure 11: </span>Measured motion as a function of the IcePAP Steps</p>
</div>
<p>
Let&rsquo;s now compute the lookup table.
For each micrometer of the IcePAP step, another step is associated that correspond to a position closer to the wanted position.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Get range for the LUT</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">We correct only in the range of tested/measured motion</span>
lut_range = round(1e6<span class="org-builtin">*</span>min(icepap_steps))<span class="org-builtin">:</span>round(1e6<span class="org-builtin">*</span>max(icepap_steps)); <span class="org-comment-delimiter">% </span><span class="org-comment">IcePAP steps [um]</span>
<span class="org-matlab-cellbreak">%% Initialize the LUT</span>
lut = zeros(size(lut_range));
<span class="org-matlab-cellbreak">%% For each um in this range</span>
<span class="org-keyword">for</span> <span class="org-variable-name"><span class="org-matlab-math">i</span></span> = <span class="org-constant">1:length(lut_range)</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">Get points indices where the measured motion is closed to the wanted one</span>
close_points = measured_motion <span class="org-builtin">&gt;</span> 1e<span class="org-builtin">-</span>6<span class="org-builtin">*</span>lut_range(<span class="org-matlab-math">i</span>) <span class="org-builtin">-</span> 500e<span class="org-builtin">-</span>9 <span class="org-builtin">&amp;</span> measured_motion <span class="org-builtin">&lt;</span> 1e<span class="org-builtin">-</span>6<span class="org-builtin">*</span>lut_range(<span class="org-matlab-math">i</span>) <span class="org-builtin">+</span> 500e<span class="org-builtin">-</span>9;
<span class="org-comment-delimiter">% </span><span class="org-comment">Get the corresponding closest IcePAP step</span>
lut(<span class="org-matlab-math">i</span>) = round(1e6<span class="org-builtin">*</span>mean(icepap_steps(close_points))); <span class="org-comment-delimiter">% </span><span class="org-comment">[um]</span>
<span class="org-keyword">end</span>
</pre>
</div>
<div id="org93d89c8" class="figure">
<p><img src="figs/generated_lut_icepap.png" alt="generated_lut_icepap.png" />
</p>
<p><span class="figure-number">Figure 12: </span>Generated Lookup Table</p>
</div>
<p>
The current LUT implementation is the following:
</p>
<div class="org-src-container">
<pre class="src src-matlab">motion_error_lut = zeros(size(lut_range));
<span class="org-keyword">for</span> <span class="org-variable-name"><span class="org-matlab-math">i</span></span> = <span class="org-constant">1:length(lut_range)</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">Get points indices where the icepap step is close to the wanted one</span>
close_points = icepap_steps <span class="org-builtin">&gt;</span> 1e<span class="org-builtin">-</span>6<span class="org-builtin">*</span>lut_range(<span class="org-matlab-math">i</span>) <span class="org-builtin">-</span> 500e<span class="org-builtin">-</span>9 <span class="org-builtin">&amp;</span> icepap_steps <span class="org-builtin">&lt;</span> 1e<span class="org-builtin">-</span>6<span class="org-builtin">*</span>lut_range(<span class="org-matlab-math">i</span>) <span class="org-builtin">+</span> 500e<span class="org-builtin">-</span>9;
<span class="org-comment-delimiter">% </span><span class="org-comment">Get the corresponding motion error</span>
motion_error_lut(<span class="org-matlab-math">i</span>) = lut_range(<span class="org-matlab-math">i</span>) <span class="org-builtin">+</span> (lut_range(<span class="org-matlab-math">i</span>) <span class="org-builtin">-</span> round(1e6<span class="org-builtin">*</span>mean(measured_motion(close_points)))); <span class="org-comment-delimiter">% </span><span class="org-comment">[um]</span>
<span class="org-keyword">end</span>
</pre>
</div>
<p>
Let&rsquo;s compare the two Lookup Table in Figure <a href="#orgf04c95e">13</a>.
</p>
<div id="orgf04c95e" class="figure">
<p><img src="figs/lut_comparison_two_methods.png" alt="lut_comparison_two_methods.png" />
</p>
<p><span class="figure-number">Figure 13: </span>Comparison of the two lookup tables</p>
</div>
<p>
If we plot the &ldquo;corrected steps&rdquo; for all steps for both methods, we clearly see the difference (Figure <a href="#org98585f1">14</a>).
</p>
<div id="org98585f1" class="figure">
<p><img src="figs/lut_correct_and_motion_error.png" alt="lut_correct_and_motion_error.png" />
</p>
<p><span class="figure-number">Figure 14: </span>LUT correction and motion error as a function of the IcePAP steps</p>
</div>
<p>
Let&rsquo;s now implement both LUT to see which implementation is correct.
</p>
<div class="org-src-container">
<pre class="src src-matlab">motion_new = zeros(size(icepap_steps_output_new));
motion_old = zeros(size(icepap_steps_output_old));
<span class="org-keyword">for</span> <span class="org-variable-name"><span class="org-matlab-math">i</span></span> = <span class="org-constant">1:length(icepap_steps_output_new)</span>
[<span class="org-builtin">~</span>, i_step] = min(abs(icepap_steps_output_new(<span class="org-matlab-math">i</span>) <span class="org-builtin">-</span> 1e6<span class="org-builtin">*</span>icepap_steps));
motion_new(<span class="org-matlab-math">i</span>) = measured_motion(i_step);
[<span class="org-builtin">~</span>, i_step] = min(abs(icepap_steps_output_old(<span class="org-matlab-math">i</span>) <span class="org-builtin">-</span> 1e6<span class="org-builtin">*</span>icepap_steps));
motion_old(<span class="org-matlab-math">i</span>) = measured_motion(i_step);
<span class="org-keyword">end</span>
</pre>
</div>
<p>
The output motion with both LUT are shown in Figure <a href="#org2744d4d">15</a>.
It is confirmed that the new LUT is the correct one.
Also, it is interesting to note that the old LUT gives an output motion that is above the ideal one, as was seen during the experiments.
</p>
<div id="org2744d4d" class="figure">
<p><img src="figs/compare_old_new_lut_motion.png" alt="compare_old_new_lut_motion.png" />
</p>
<p><span class="figure-number">Figure 15: </span>Comparison of the obtained motion with new and old LUT</p>
</div>
</div>
</div>
<div id="outline-container-org16d0e40" class="outline-3">
<h3 id="org16d0e40"><span class="section-number-3">2.4.</span> Experimental Data - Proposed method (BLISS first implementation)</h3>
<div class="outline-text-3" id="text-2-4">
<p>
The new proposed method has been implemented and tested.
</p>
<p>
The result is shown in Figure <a href="#org235d7ce">16</a>.
After only one iteration, the result is close to the previous method.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Load Data of the new LUT method</span>
ol_new_bragg = double(h5read(<span class="org-string">'Qutools_test_0001.h5'</span>,<span class="org-string">'/33.1/instrument/trajmot/data'</span>));
ol_new_drx = h5read(<span class="org-string">'Qutools_test_0001.h5'</span>,<span class="org-string">'/33.1/instrument/xtal_111_drx_filter/data'</span>);
lut_new_bragg = double(h5read(<span class="org-string">'Qutools_test_0001.h5'</span>,<span class="org-string">'/34.1/instrument/trajmot/data'</span>));
lut_new_drx = h5read(<span class="org-string">'Qutools_test_0001.h5'</span>,<span class="org-string">'/34.1/instrument/xtal_111_drx_filter/data'</span>);
</pre>
</div>
<div id="org235d7ce" class="figure">
<p><img src="figs/lut_comp_old_new_experiment.png" alt="lut_comp_old_new_experiment.png" />
</p>
<p><span class="figure-number">Figure 16: </span>Comparison of the \(R_x\) error for the current LUT method and the proposed one</p>
</div>
<p>
If we zoom on the 20deg to 25deg bragg angles, we can see that the new method has much less &ldquo;periodic errors&rdquo; as compared to the previous one which shows some patterns.
</p>
<div id="orgc7c1b59" class="figure">
<p><img src="figs/lut_comp_old_new_experiment_zoom.png" alt="lut_comp_old_new_experiment_zoom.png" />
</p>
<p><span class="figure-number">Figure 17: </span>Comparison of the residual motion after old LUT and new LUT</p>
</div>
</div>
</div>
<div id="outline-container-org0ad2a22" class="outline-3">
<h3 id="org0ad2a22"><span class="section-number-3">2.5.</span> Comparison of the errors in the reciprocal length space</h3>
<div class="outline-text-3" id="text-2-5">
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Load Data of the new LUT method</span>
ol_bragg = (<span class="org-matlab-math">pi</span><span class="org-builtin">/</span>180)<span class="org-builtin">*</span>1e<span class="org-builtin">-</span>5<span class="org-builtin">*</span>double(h5read(<span class="org-string">'Qutools_test_0001.h5'</span>,<span class="org-string">'/33.1/instrument/trajmot/data'</span>));
ol_dz = 1e<span class="org-builtin">-</span>9<span class="org-builtin">*</span>double(h5read(<span class="org-string">'Qutools_test_0001.h5'</span>,<span class="org-string">'/33.1/instrument/xtal_111_dz_filter/data'</span>));
ol_dry = 1e<span class="org-builtin">-</span>9<span class="org-builtin">*</span>double(h5read(<span class="org-string">'Qutools_test_0001.h5'</span>,<span class="org-string">'/33.1/instrument/xtal_111_dry_filter/data'</span>));
ol_drx = 1e<span class="org-builtin">-</span>9<span class="org-builtin">*</span>double(h5read(<span class="org-string">'Qutools_test_0001.h5'</span>,<span class="org-string">'/33.1/instrument/xtal_111_drx_filter/data'</span>));
ol_dzw = 10.5e<span class="org-builtin">-</span>3<span class="org-builtin">./</span>(2<span class="org-builtin">*</span>cos(ol_bragg)); <span class="org-comment-delimiter">% </span><span class="org-comment">Wanted distance between crystals [m]</span>
ol_t = 1e<span class="org-builtin">-</span>6<span class="org-builtin">*</span>double(h5read(<span class="org-string">'Qutools_test_0001.h5'</span>,<span class="org-string">'/33.1/instrument/time/data'</span>)); <span class="org-comment-delimiter">% </span><span class="org-comment">Time [s]</span>
ol_ddz = ol_dzw<span class="org-builtin">-</span>ol_dz; <span class="org-comment-delimiter">% </span><span class="org-comment">Distance Error between crystals [m]</span>
lut_bragg = (<span class="org-matlab-math">pi</span><span class="org-builtin">/</span>180)<span class="org-builtin">*</span>1e<span class="org-builtin">-</span>5<span class="org-builtin">*</span>double(h5read(<span class="org-string">'Qutools_test_0001.h5'</span>,<span class="org-string">'/34.1/instrument/trajmot/data'</span>));
lut_dz = 1e<span class="org-builtin">-</span>9<span class="org-builtin">*</span>double(h5read(<span class="org-string">'Qutools_test_0001.h5'</span>,<span class="org-string">'/34.1/instrument/xtal_111_dz_filter/data'</span>));
lut_dry = 1e<span class="org-builtin">-</span>9<span class="org-builtin">*</span>double(h5read(<span class="org-string">'Qutools_test_0001.h5'</span>,<span class="org-string">'/34.1/instrument/xtal_111_dry_filter/data'</span>));
lut_drx = 1e<span class="org-builtin">-</span>9<span class="org-builtin">*</span>double(h5read(<span class="org-string">'Qutools_test_0001.h5'</span>,<span class="org-string">'/34.1/instrument/xtal_111_drx_filter/data'</span>));
lut_dzw = 10.5e<span class="org-builtin">-</span>3<span class="org-builtin">./</span>(2<span class="org-builtin">*</span>cos(lut_bragg)); <span class="org-comment-delimiter">% </span><span class="org-comment">Wanted distance between crystals [m]</span>
lut_t = 1e<span class="org-builtin">-</span>6<span class="org-builtin">*</span>double(h5read(<span class="org-string">'Qutools_test_0001.h5'</span>,<span class="org-string">'/34.1/instrument/time/data'</span>)); <span class="org-comment-delimiter">% </span><span class="org-comment">Time [s]</span>
lut_ddz = lut_dzw<span class="org-builtin">-</span>lut_dz; <span class="org-comment-delimiter">% </span><span class="org-comment">Distance Error between crystals [m]</span>
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Compute Fast Jack position errors</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">Jacobian matrix for Fast Jacks and 111 crystal</span>
J_a_111 = [1, 0.14, <span class="org-builtin">-</span>0.1525
1, 0.14, 0.0675
1, <span class="org-builtin">-</span>0.14, 0.0425];
ol_de_111 = [ol_ddz<span class="org-builtin">'</span>; ol_dry<span class="org-builtin">'</span>; ol_drx<span class="org-builtin">'</span>];
<span class="org-comment-delimiter">% </span><span class="org-comment">Fast Jack position errors</span>
ol_de_fj = J_a_111<span class="org-builtin">*</span>ol_de_111;
ol_fj_ur = ol_de_fj(1,<span class="org-builtin">:</span>);
ol_fj_uh = ol_de_fj(2,<span class="org-builtin">:</span>);
ol_fj_d = ol_de_fj(3,<span class="org-builtin">:</span>);
lut_de_111 = [lut_ddz<span class="org-builtin">'</span>; lut_dry<span class="org-builtin">'</span>; lut_drx<span class="org-builtin">'</span>];
<span class="org-comment-delimiter">% </span><span class="org-comment">Fast Jack position errors</span>
lut_de_fj = J_a_111<span class="org-builtin">*</span>lut_de_111;
lut_fj_ur = lut_de_fj(1,<span class="org-builtin">:</span>);
lut_fj_uh = lut_de_fj(2,<span class="org-builtin">:</span>);
lut_fj_d = lut_de_fj(3,<span class="org-builtin">:</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">Xs = 0.1e<span class="org-builtin">-</span>6; <span class="org-comment-delimiter">% </span><span class="org-comment">Sampling Distance [m]</span>
<span class="org-matlab-cellbreak">%% Re-sampled data with uniform spacing [m]</span>
ol_fj_ur_u = resample(ol_fj_ur, ol_dzw, 1<span class="org-builtin">/</span>Xs);
ol_fj_uh_u = resample(ol_fj_uh, ol_dzw, 1<span class="org-builtin">/</span>Xs);
ol_fj_d_u = resample(ol_fj_d, ol_dzw, 1<span class="org-builtin">/</span>Xs);
ol_fj_u = Xs<span class="org-builtin">*</span>[1<span class="org-builtin">:</span>length(ol_fj_ur_u)]; <span class="org-comment-delimiter">% </span><span class="org-comment">Sampled Jack Position</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">Only take first 500um</span>
ol_fj_ur_u = ol_fj_ur_u(ol_fj_u<span class="org-builtin">&lt;</span>0.5e<span class="org-builtin">-</span>3);
ol_fj_uh_u = ol_fj_uh_u(ol_fj_u<span class="org-builtin">&lt;</span>0.5e<span class="org-builtin">-</span>3);
ol_fj_d_u = ol_fj_d_u (ol_fj_u<span class="org-builtin">&lt;</span>0.5e<span class="org-builtin">-</span>3);
ol_fj_u = ol_fj_u (ol_fj_u<span class="org-builtin">&lt;</span>0.5e<span class="org-builtin">-</span>3);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Re-sampled data with uniform spacing [m]</span>
lut_fj_ur_u = resample(lut_fj_ur, lut_dzw, 1<span class="org-builtin">/</span>Xs);
lut_fj_uh_u = resample(lut_fj_uh, lut_dzw, 1<span class="org-builtin">/</span>Xs);
lut_fj_d_u = resample(lut_fj_d, lut_dzw, 1<span class="org-builtin">/</span>Xs);
lut_fj_u = Xs<span class="org-builtin">*</span>[1<span class="org-builtin">:</span>length(lut_fj_ur_u)]; <span class="org-comment-delimiter">% </span><span class="org-comment">Sampled Jack Position</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">Only take first 500um</span>
lut_fj_ur_u = lut_fj_ur_u(lut_fj_u<span class="org-builtin">&lt;</span>0.5e<span class="org-builtin">-</span>3);
lut_fj_uh_u = lut_fj_uh_u(lut_fj_u<span class="org-builtin">&lt;</span>0.5e<span class="org-builtin">-</span>3);
lut_fj_d_u = lut_fj_d_u (lut_fj_u<span class="org-builtin">&lt;</span>0.5e<span class="org-builtin">-</span>3);
lut_fj_u = lut_fj_u (lut_fj_u<span class="org-builtin">&lt;</span>0.5e<span class="org-builtin">-</span>3);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-comment-delimiter">% </span><span class="org-comment">Hanning Windows with 250um width</span>
win = hanning(floor(400e<span class="org-builtin">-</span>6<span class="org-builtin">/</span>Xs));
<span class="org-comment-delimiter">% </span><span class="org-comment">Power Spectral Density [m2/(1/m)]</span>
[S_ol_ur, f] = pwelch(ol_fj_ur_u<span class="org-builtin">-</span>mean(ol_fj_ur_u), win, 0, [], 1<span class="org-builtin">/</span>Xs);
[S_ol_uh, <span class="org-builtin">~</span>] = pwelch(ol_fj_uh_u<span class="org-builtin">-</span>mean(ol_fj_uh_u), win, 0, [], 1<span class="org-builtin">/</span>Xs);
[S_ol_d, <span class="org-builtin">~</span>] = pwelch(ol_fj_d_u <span class="org-builtin">-</span>mean(ol_fj_d_u ), win, 0, [], 1<span class="org-builtin">/</span>Xs);
[S_lut_ur, <span class="org-builtin">~</span>] = pwelch(lut_fj_ur_u<span class="org-builtin">-</span>mean(lut_fj_ur_u), win, 0, [], 1<span class="org-builtin">/</span>Xs);
[S_lut_uh, <span class="org-builtin">~</span>] = pwelch(lut_fj_uh_u<span class="org-builtin">-</span>mean(lut_fj_uh_u), win, 0, [], 1<span class="org-builtin">/</span>Xs);
[S_lut_d, <span class="org-builtin">~</span>] = pwelch(lut_fj_d_u <span class="org-builtin">-</span>mean(lut_fj_d_u ), win, 0, [], 1<span class="org-builtin">/</span>Xs);
</pre>
</div>
<p>
As seen in Figure <a href="#org54d4586">18</a>, the LUT as an effect only on spatial errors with a period of at least few \(\mu m\).
This is very logical considering the \(1\,\mu m\) sampling of the LUT in the IcePAP.
</p>
<div id="org54d4586" class="figure">
<p><img src="figs/effect_lut_on_psd_error_spatial.png" alt="effect_lut_on_psd_error_spatial.png" />
</p>
<p><span class="figure-number">Figure 18: </span>Effect of the LUT on the spectral content of the positioning errors</p>
</div>
<p>
Let&rsquo;s now look at it in a cumulative way.
</p>
<div class="org-src-container">
<pre class="src src-matlab">CPS_ol_ur = flip(<span class="org-builtin">-</span>cumtrapz(flip(f), flip(S_ol_ur)));
CPS_ol_uh = flip(<span class="org-builtin">-</span>cumtrapz(flip(f), flip(S_ol_uh)));
CPS_ol_d = flip(<span class="org-builtin">-</span>cumtrapz(flip(f), flip(S_ol_d)));
CPS_lut_ur = flip(<span class="org-builtin">-</span>cumtrapz(flip(f), flip(S_lut_ur)));
CPS_lut_uh = flip(<span class="org-builtin">-</span>cumtrapz(flip(f), flip(S_lut_uh)));
CPS_lut_d = flip(<span class="org-builtin">-</span>cumtrapz(flip(f), flip(S_lut_d)));
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Cumulative Spectrum</span>
<span class="org-builtin">figure</span>;
<span class="org-builtin">hold</span> <span class="org-matlab-commanddual-string">on;</span>
<span class="org-builtin">plot</span>(1e6<span class="org-builtin">./</span>f, sqrt(CPS_ol_ur) , <span class="org-string">'DisplayName'</span>, <span class="org-string">'$u_r$ - OL'</span>);
<span class="org-builtin">plot</span>(1e6<span class="org-builtin">./</span>f, sqrt(CPS_lut_ur), <span class="org-string">'DisplayName'</span>, <span class="org-string">'$u_r$ - LUT'</span>);
<span class="org-builtin">hold</span> <span class="org-matlab-commanddual-string">off;</span>
<span class="org-builtin">set</span>(<span class="org-variable-name">gca</span>, <span class="org-string">'xscale'</span>, <span class="org-string">'log'</span>); <span class="org-builtin">set</span>(<span class="org-variable-name">gca</span>, <span class="org-string">'yscale'</span>, <span class="org-string">'log'</span>);
<span class="org-builtin">xlabel</span>(<span class="org-string">'Spectral Distance [$\mu m$]'</span>); <span class="org-builtin">ylabel</span>(<span class="org-string">'Cumulative Spectrum [$m$]'</span>)
<span class="org-builtin">xlim</span>([1, 500]); <span class="org-builtin">ylim</span>([1e<span class="org-builtin">-</span>9, 1e<span class="org-builtin">-</span>5]);
<span class="org-builtin">legend</span>(<span class="org-string">'location'</span>, <span class="org-string">'northwest'</span>);
</pre>
</div>
<div id="org66908e4" class="figure">
<p><img src="figs/effect_lut_on_cps_error_spatial.png" alt="effect_lut_on_cps_error_spatial.png" />
</p>
<p><span class="figure-number">Figure 19: </span>Cumulative Spectrum with and without the LUT</p>
</div>
</div>
</div>
<div id="outline-container-orgfb3cd1d" class="outline-3">
<h3 id="orgfb3cd1d"><span class="section-number-3">2.6.</span> Period of errors</h3>
<div class="outline-text-3" id="text-2-6">
<p>
The positioning errors of the fast jacks have different origins with different spatial periods:
</p>
<ul class="org-ul">
<li>\(1mm\) due to non-perfect planetary roller screw system</li>
<li>\(20\mu m\), \(10\mu m\) and \(5\mu m\) periods due non-perfect magnetic poles of the stepper motor.</li>
</ul>
<p>
In this section, we wish to see which of these errors are repeatable from one scan to the other.
This could help to determine which errors should be included in the LUT.
</p>
</div>
<div id="outline-container-org3e9dab6" class="outline-5">
<h5 id="org3e9dab6"><span class="section-number-5">2.6.0.1.</span> Load Test Data</h5>
<div class="outline-text-5" id="text-2-6-0-1">
<p>
A scan in mode A is performed at constant Fast Jack velocity.
</p>
<div class="org-src-container">
<pre class="src src-matlab">fj_vel = 0.125e<span class="org-builtin">-</span>3; <span class="org-comment-delimiter">% </span><span class="org-comment">Fast Jack Velocity [m/s]</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org8e58609" class="outline-5">
<h5 id="org8e58609"><span class="section-number-5">2.6.0.2.</span> FIR Filters</h5>
<div class="outline-text-5" id="text-2-6-0-2">
<div id="org2ae55eb" class="figure">
<p><img src="figs/fir_response_1mm_to_5um.png" alt="fir_response_1mm_to_5um.png" />
</p>
<p><span class="figure-number">Figure 20: </span>Amplitude response of FIR filters to only keep certain errors</p>
</div>
</div>
</div>
<div id="outline-container-org199aeaf" class="outline-5">
<h5 id="org199aeaf"><span class="section-number-5">2.6.0.3.</span> Filtered Data</h5>
<div class="outline-text-5" id="text-2-6-0-3">
<p>
Now the same data is filtered with each filter.
</p>
<p>
The filtered data are shown in Figure <a href="#org3185071">21</a>.
</p>
<div id="org3185071" class="figure">
<p><img src="figs/remain_motion_5um.png" alt="remain_motion_5um.png" />
</p>
<p><span class="figure-number">Figure 21: </span>Fast Jack measured error and filtered data</p>
</div>
</div>
</div>
<div id="outline-container-org2ee6be7" class="outline-5">
<h5 id="org2ee6be7"><span class="section-number-5">2.6.0.4.</span> Discussion</h5>
</div>
</div>
</div>
<div id="outline-container-org50b88dd" class="outline-2">
<h2 id="org50b88dd"><span class="section-number-2">3.</span> LUT creation from experimental data</h2>
<div class="outline-text-2" id="text-3">
<p>
<a id="org1906062"></a>
</p>
<p>
In this section, the full process from measurement, filtering of data to generation of the LUT is detailed.
</p>
<p>
The computation is performed with Matlab.
</p>
</div>
<div id="outline-container-org406d5cb" class="outline-3">
<h3 id="org406d5cb"><span class="section-number-3">3.1.</span> Load Data</h3>
<div class="outline-text-3" id="text-3-1">
<p>
A Bragg scan is performed using <code>thtraj</code> and data are acquired using the <code>fast_DAQ</code>.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Load Raw Data</span>
load(<span class="org-string">"scan_10_70_lut_1.mat"</span>)
</pre>
</div>
<p>
Measured data are:
</p>
<ul class="org-ul">
<li><code>bragg</code>: Bragg angle in deg</li>
<li><code>dz</code>: distance between crystals in nm</li>
<li><code>dry</code>, <code>drx</code>: orientation errors between crystals in nrad</li>
<li><code>fjur</code>, <code>fjuh</code>, <code>fjd</code>: generated steps by the IcePAP in tens of nm</li>
</ul>
<p>
All are sampled at 10kHz with no filtering.
</p>
<p>
First, convert all the data to SI units (rad, and m).
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Convert Data to Standard Units</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">Bragg Angle [rad]</span>
bragg = <span class="org-matlab-math">pi</span><span class="org-builtin">/</span>180<span class="org-builtin">*</span>bragg;
<span class="org-comment-delimiter">% </span><span class="org-comment">Rx rotation of 1st crystal w.r.t. 2nd crystal [rad]</span>
drx = 1e<span class="org-builtin">-</span>9<span class="org-builtin">*</span>drx;
<span class="org-comment-delimiter">% </span><span class="org-comment">Ry rotation of 1st crystal w.r.t. 2nd crystal [rad]</span>
dry = 1e<span class="org-builtin">-</span>9<span class="org-builtin">*</span>dry;
<span class="org-comment-delimiter">% </span><span class="org-comment">Z distance between crystals [m]</span>
dz = 1e<span class="org-builtin">-</span>9<span class="org-builtin">*</span>dz;
<span class="org-comment-delimiter">% </span><span class="org-comment">Z error between second crystal and first crystal [m]</span>
ddz = 10.5e<span class="org-builtin">-</span>3<span class="org-builtin">./</span>(2<span class="org-builtin">*</span>cos(bragg)) <span class="org-builtin">-</span> dz;
<span class="org-comment-delimiter">% </span><span class="org-comment">Steps for Ur motor [m]</span>
fjur = 1e<span class="org-builtin">-</span>8<span class="org-builtin">*</span>fjur;
<span class="org-comment-delimiter">% </span><span class="org-comment">Steps for Uh motor [m]</span>
fjuh = 1e<span class="org-builtin">-</span>8<span class="org-builtin">*</span>fjuh;
<span class="org-comment-delimiter">% </span><span class="org-comment">Steps for D motor [m]</span>
fjd = 1e<span class="org-builtin">-</span>8<span class="org-builtin">*</span>fjd;
</pre>
</div>
</div>
</div>
<div id="outline-container-orgab14298" class="outline-3">
<h3 id="orgab14298"><span class="section-number-3">3.2.</span> IcePAP generated Steps</h3>
<div class="outline-text-3" id="text-3-2">
<p>
Here is how the steps of the IcePAP (<code>fjsur</code>, <code>fjsuh</code> and <code>fjsd</code>) are computed in mode A:
</p>
\begin{equation}
\begin{bmatrix}
\text{fjsur} \\
\text{fjsuh} \\
\text{fjsd}
\end{bmatrix} (\theta) = \text{fjs}_0 +
\bm{J}_{a,111} \cdot \begin{bmatrix}
0 \\
\text{fjsry} \\
\text{fjsrx}
\end{bmatrix} - \frac{10.5 \cdot 10^{-3}}{2 \cos (\theta)}
\end{equation}
<p>
There is a first offset \(\text{fjs}_0\) that is initialized once, and a second offset which is a function of <code>fjsry</code> and <code>fjsrx</code>.
</p>
<p>
Let&rsquo;s compute the offset which is a function of <code>fjsry</code> and <code>fjsrx</code>:
</p>
<div class="org-src-container">
<pre class="src src-matlab">fjsry = 0.53171e<span class="org-builtin">-</span>3; <span class="org-comment-delimiter">% </span><span class="org-comment">[rad]</span>
fjsrx = 0.144e<span class="org-builtin">-</span>3; <span class="org-comment-delimiter">% </span><span class="org-comment">[rad]</span>
J_a_111 = [1, 0.14, <span class="org-builtin">-</span>0.0675
1, 0.14, 0.1525
1, <span class="org-builtin">-</span>0.14, 0.0425];
fjs_offset = J_a_111<span class="org-builtin">*</span>[0; fjsry; fjsrx]; <span class="org-comment-delimiter">% </span><span class="org-comment">ur,uh,d offsets [m]</span>
</pre>
</div>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-right" />
</colgroup>
<tbody>
<tr>
<td class="org-right">6.4719e-05</td>
</tr>
<tr>
<td class="org-right">9.6399e-05</td>
</tr>
<tr>
<td class="org-right">-6.8319e-05</td>
</tr>
</tbody>
</table>
<p>
Let&rsquo;s now compute \(\text{fjs}_0\) using first second of data where there is no movement and bragg axis is fixed at \(\theta_0\):
</p>
\begin{equation}
\text{fjs}_0 = \begin{bmatrix}
\text{fjsur} \\
\text{fjsuh} \\
\text{fjsd}
\end{bmatrix} (\theta_0) + \frac{10.5 \cdot 10^{-3}}{2 \cos (\theta_0)} -
\bm{J}_{a,111} \cdot \begin{bmatrix}
0 \\
\text{fjsry} \\
\text{fjsrx}
\end{bmatrix}
\end{equation}
<div class="org-src-container">
<pre class="src src-matlab">FJ0 = <span class="org-comment-delimiter">.</span><span class="org-comment">..</span>
mean([fjur(time <span class="org-builtin">&lt;</span> 1), fjuh(time <span class="org-builtin">&lt;</span> 1), fjd(time <span class="org-builtin">&lt;</span> 1)])<span class="org-builtin">'</span> <span class="org-comment-delimiter">.</span><span class="org-comment">..</span>
<span class="org-builtin">+</span> ones(3,1)<span class="org-builtin">*</span>10.5e<span class="org-builtin">-</span>3<span class="org-builtin">./</span>(2<span class="org-builtin">*</span>cos(mean(bragg(time <span class="org-builtin">&lt;</span> 1)))) <span class="org-comment-delimiter">.</span><span class="org-comment">..</span>
<span class="org-builtin">-</span> fjs_offset; <span class="org-comment-delimiter">% </span><span class="org-comment">[m]</span>
</pre>
</div>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-right" />
</colgroup>
<tbody>
<tr>
<td class="org-right">0.030427</td>
</tr>
<tr>
<td class="org-right">0.030427</td>
</tr>
<tr>
<td class="org-right">0.030427</td>
</tr>
</tbody>
</table>
<p>
Values are very close for all three axis.
Therefore we take the mean of the three values for \(\text{fjs}_0\).
</p>
<div class="org-src-container">
<pre class="src src-matlab">FJ0 = mean(FJ0);
</pre>
</div>
<p>
This approximately corresponds to the distance between the crystals for a Bragg angle of 80 degrees:
</p>
<div class="org-src-container">
<pre class="src src-matlab">10.5e<span class="org-builtin">-</span>3<span class="org-builtin">/</span>(2<span class="org-builtin">*</span>cos(80<span class="org-builtin">*</span><span class="org-matlab-math">pi</span><span class="org-builtin">/</span>180))
</pre>
</div>
<pre class="example">
0.030234
</pre>
<p>
The measured IcePAP steps are compared with the theoretical formulas in Figure <a href="#org5e215aa">22</a>.
</p>
<p>
If we were to zoom a lot, we would see a small delay between the estimation and the steps sent by the IcePAP.
This is due to the fact that the estimation is performed based on the measured Bragg angle while the IcePAP steps are based on the &ldquo;requested&rdquo; Bragg angle.
As will be shown in the next section, there is a small delay between the requested and obtained bragg angle which explains this delay.
</p>
<div id="org5e215aa" class="figure">
<p><img src="figs/step_lut_estimation_wanted_fj_pos.png" alt="step_lut_estimation_wanted_fj_pos.png" />
</p>
<p><span class="figure-number">Figure 22: </span>Measured IcePAP Steps and estimation from theoretical formula</p>
</div>
</div>
</div>
<div id="outline-container-orgd0709fe" class="outline-3">
<h3 id="orgd0709fe"><span class="section-number-3">3.3.</span> Bragg and Fast Jack Velocities</h3>
<div class="outline-text-3" id="text-3-3">
<p>
In order to estimate velocities from measured positions, a filter is used which approximate a pure derivative filter.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Filter to compute velocities</span>
G_diff = (s<span class="org-builtin">/</span>2<span class="org-builtin">/</span><span class="org-matlab-math">pi</span><span class="org-builtin">/</span>10)<span class="org-builtin">/</span>(1 <span class="org-builtin">+</span> s<span class="org-builtin">/</span>2<span class="org-builtin">/</span><span class="org-matlab-math">pi</span><span class="org-builtin">/</span>10);
<span class="org-comment-delimiter">% </span><span class="org-comment">Make sure the gain w = 2pi is equal to 2pi</span>
G_diff = 2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>G_diff<span class="org-builtin">/</span>(abs(evalfr(G_diff, 1<span class="org-constant">j</span><span class="org-builtin">*</span>2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span>)));
</pre>
</div>
<p>
Only the high frequency amplitude is reduced to not amplified the measurement noise (Figure <a href="#org44c4a91">23</a>).
</p>
<div id="org44c4a91" class="figure">
<p><img src="figs/step_lut_deriv_filter.png" alt="step_lut_deriv_filter.png" />
</p>
<p><span class="figure-number">Figure 23: </span>Magnitude of filter used to approximate the derivative</p>
</div>
<p>
Using the filter, the Bragg velocity is estimated (Figure <a href="#org3ca32cf">24</a>).
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Bragg Velocity</span>
bragg_vel = lsim(G_diff, bragg, time);
</pre>
</div>
<div id="org3ca32cf" class="figure">
<p><img src="figs/step_lut_bragg_vel.png" alt="step_lut_bragg_vel.png" />
</p>
<p><span class="figure-number">Figure 24: </span>Estimated Bragg Velocity curing acceleration phase</p>
</div>
<p>
Now, the Fast Jack velocity is estimated (Figure <a href="#orgb4a56ba">25</a>).
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Fast Jack Velocity</span>
fjur_vel = lsim(G_diff, fjur, time);
fjuh_vel = lsim(G_diff, fjuh, time);
fjd_vel = lsim(G_diff, fjd , time);
</pre>
</div>
<div id="orgb4a56ba" class="figure">
<p><img src="figs/step_lut_fast_jack_vel.png" alt="step_lut_fast_jack_vel.png" />
</p>
<p><span class="figure-number">Figure 25: </span>Estimated velocity of fast jacks</p>
</div>
<div id="org6ccf536" class="figure">
<p><img src="figs/step_lut_fast_jack_vel_fct_pos.png" alt="step_lut_fast_jack_vel_fct_pos.png" />
</p>
<p><span class="figure-number">Figure 26: </span>Fast Jack Velocity as a function of its position</p>
</div>
</div>
</div>
<div id="outline-container-orgc163a34" class="outline-3">
<h3 id="orgc163a34"><span class="section-number-3">3.4.</span> Bragg Angle Errors / Delays</h3>
<div class="outline-text-3" id="text-3-4">
<p>
From the measured <code>fjur</code> steps generated by the IcePAP, we can estimate the steps generated corresponding to the Bragg angle.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Estimated Bragg angle requested by IcePAP</span>
bragg_icepap = acos(10.5e<span class="org-builtin">-</span>3<span class="org-builtin">./</span>(2<span class="org-builtin">*</span>(FJ0 <span class="org-builtin">+</span> fjs_offset(1) <span class="org-builtin">-</span> fjur)));
</pre>
</div>
<p>
The generated steps by the IcePAP and the measured angle are compared in Figure <a href="#org081fd95">27</a>.
There is clearly a lag of the Bragg angle compared to the generated IcePAP steps.
</p>
<div id="org081fd95" class="figure">
<p><img src="figs/lut_step_bragg_angle_error_aerotech.png" alt="lut_step_bragg_angle_error_aerotech.png" />
</p>
<p><span class="figure-number">Figure 27: </span>Estimated generated steps by the IcePAP and measured Bragg angle</p>
</div>
<p>
If we plot the error between the measured and the requested bragg angle as a function of the bragg velocity (Figure <a href="#orgab82387">28</a>), we can see an almost linear relationship.
</p>
<p>
This corresponds to a &ldquo;time lag&rdquo; of approximately:
</p>
<pre class="example">
2.4 ms
</pre>
<div id="orgab82387" class="figure">
<p><img src="figs/lut_step_bragg_error_fct_velocity.png" alt="lut_step_bragg_error_fct_velocity.png" />
</p>
<p><span class="figure-number">Figure 28: </span>Bragg Error as a function fo the Bragg Velocity</p>
</div>
<div class="important" id="org3bbfbaf">
<p>
There is a &ldquo;lag&rdquo; between the Bragg steps sent by the IcePAP and the measured angle by the encoders.
This is probably due to the single integrator in the &ldquo;Aerotech&rdquo; controller.
Indeed, two integrators are required to have no tracking error during ramp reference signals.
</p>
</div>
</div>
</div>
<div id="outline-container-orgb4227a3" class="outline-3">
<h3 id="orgb4227a3"><span class="section-number-3">3.5.</span> Errors in the Frame of the Crystals</h3>
<div class="outline-text-3" id="text-3-5">
<p>
The <code>dz</code>, <code>dry</code> and <code>drx</code> measured relative motion of the crystals are defined as follows:
</p>
<ul class="org-ul">
<li>An increase of <code>dz</code> means the crystals are moving away from each other</li>
<li>An positive <code>dry</code> means the second crystals has positive rotation around <code>y</code></li>
<li>An positive <code>drx</code> means the second crystals has positive rotation around <code>x</code></li>
</ul>
<p>
The error in crystals&rsquo; distance <code>ddz</code> is defined as:
</p>
\begin{equation}
ddz(\theta) = \frac{10.5 \cdot 10^{-3}}{2 \cos(\theta)} - dz(\theta)
\end{equation}
<p>
Therefore, a positive <code>ddz</code> means that the second crystal is too high (fast jacks have to move down).
</p>
<p>
The errors measured in the frame of the crystals are shown in Figure <a href="#org9d0b8c8">29</a>.
</p>
<div id="org9d0b8c8" class="figure">
<p><img src="figs/lut_step_measured_errors.png" alt="lut_step_measured_errors.png" />
</p>
<p><span class="figure-number">Figure 29: </span>Measured errors in the frame of the crystals as a function of the fast jack position</p>
</div>
</div>
</div>
<div id="outline-container-org96856e0" class="outline-3">
<h3 id="org96856e0"><span class="section-number-3">3.6.</span> Errors in the Frame of the Fast Jacks</h3>
<div class="outline-text-3" id="text-3-6">
<p>
From <code>ddz,dry,drx</code>, the motion errors of the jast-jacks (<code>fjur_e</code>, <code>fjuh_e</code> and <code>jfd_e</code>) as measured by the interferometers are computed.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Actuator Jacobian</span>
J_a_111 = [1, 0.14, <span class="org-builtin">-</span>0.0675
1, 0.14, 0.1525
1, <span class="org-builtin">-</span>0.14, 0.0425];
<span class="org-matlab-cellbreak">%% Computation of the position of the FJ as measured by the interferometers</span>
error = J_a_111 <span class="org-builtin">*</span> [ddz, dry, drx]<span class="org-builtin">'</span>;
fjur_e = error(1,<span class="org-builtin">:</span>)<span class="org-builtin">'</span>; <span class="org-comment-delimiter">% </span><span class="org-comment">[m]</span>
fjuh_e = error(2,<span class="org-builtin">:</span>)<span class="org-builtin">'</span>; <span class="org-comment-delimiter">% </span><span class="org-comment">[m]</span>
fjd_e = error(3,<span class="org-builtin">:</span>)<span class="org-builtin">'</span>; <span class="org-comment-delimiter">% </span><span class="org-comment">[m]</span>
</pre>
</div>
<p>
The result is shown in Figure <a href="#orgce0300b">30</a>.
</p>
<div id="orgce0300b" class="figure">
<p><img src="figs/lut_step_measured_error_fj.png" alt="lut_step_measured_error_fj.png" />
</p>
<p><span class="figure-number">Figure 30: </span>Position error of the Fast jacks</p>
</div>
<div id="org0bce9b9" class="figure">
<p><img src="figs/lut_step_measured_error_fj_zoom.png" alt="lut_step_measured_error_fj_zoom.png" />
</p>
<p><span class="figure-number">Figure 31: </span>Position error of the Fast jacks - Zoom near two positions</p>
</div>
</div>
</div>
<div id="outline-container-org26629e2" class="outline-3">
<h3 id="org26629e2"><span class="section-number-3">3.7.</span> Analysis of the obtained error</h3>
<div class="outline-text-3" id="text-3-7">
<p>
The measured position of the fast jacks are displayed as a function of the IcePAP steps (Figure <a href="#org62d6f14">32</a>).
</p>
<div class="important" id="orgfec9356">
<p>
From Figure <a href="#org62d6f14">32</a>, it seems the position as a function of the IcePAP steps is not a bijection function.
Therefore, a measured position can corresponds to several IcePAP Steps.
This is very problematic for building a LUT that will be used to compensated the measured errors.
</p>
</div>
<p>
Also, it seems that the (spatial) period of the error depends on the actual position of the Fast Jack (and therefore of its velocity).
If we compute the equivalent temporal period, we find a frequency of around 370 Hz.
</p>
<div id="org62d6f14" class="figure">
<p><img src="figs/lut_step_meas_pos_fct_wanted_pos.png" alt="lut_step_meas_pos_fct_wanted_pos.png" />
</p>
<p><span class="figure-number">Figure 32: </span>Measured Fast Jack position as a function of the IcePAP steps</p>
</div>
<p>
In order to better investigate what is going on, a spectrogram is computed (Figure <a href="#org5157223">33</a>).
</p>
<p>
We clearly observe:
</p>
<ul class="org-ul">
<li>Some rather constant vibrations with a frequency at around 363Hz and 374Hz.
This corresponds to the clear periods in Figure <a href="#org62d6f14">32</a>.
These are due to the <code>mcoil</code> stepper motor (magnetic period).</li>
<li>Several frequencies which are increasing with time.
These corresponds to (spatial) periodic errors of the stepper motor.
The frequency of these errors are increasing because the velocity of the fast jack is also increasing with time (see Figure <a href="#orgb4a56ba">25</a>).
The black dashed line in Figure <a href="#org5157223">33</a> shows the frequency of errors with a period of \(5\,\mu m\).
We can also see lower frequencies corresponding to periods of \(10\,\mu m\) and \(20\,\mu m\) and lots of higher frequencies with are also exciting resonances of the system (second crystal) at around 200Hz</li>
</ul>
<div id="org5157223" class="figure">
<p><img src="figs/lut_step_meas_pos_error_spectrogram.png" alt="lut_step_meas_pos_error_spectrogram.png" />
</p>
<p><span class="figure-number">Figure 33: </span>Spectrogram of the \(u_h\) errors. The black dashed line corresponds to an error with a period of \(5\,\mu m\)</p>
</div>
<div class="important" id="org88259a0">
<p>
As we would like to only measure the repeatable mechanical errors of the fast jacks and not the vibrations of natural frequencies of the system, we have to filter the data.
</p>
</div>
</div>
</div>
<div id="outline-container-orge83d6a7" class="outline-3">
<h3 id="orge83d6a7"><span class="section-number-3">3.8.</span> Filtering of Data</h3>
<div class="outline-text-3" id="text-3-8">
<p>
As seen in Figure <a href="#org5157223">33</a>, the errors we wish to calibrate are below 160Hz while the vibrations we wish to ignore are above 200Hz.
We have to use a low pass filter that does not affects frequencies below 160Hz while having good rejection above 200Hz.
</p>
<p>
The filter used for current LUT is a moving average filter with a length of 100:
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Moving Average Filter</span>
B_mov_avg = 1<span class="org-builtin">/</span>101<span class="org-builtin">*</span>ones(101,1); <span class="org-comment-delimiter">% </span><span class="org-comment">FIR Filter coeficients</span>
</pre>
</div>
<p>
We may also try a second order low pass filter:
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% 2nd order Low Pass Filter</span>
G_lpf = 1<span class="org-builtin">/</span>(1 <span class="org-builtin">+</span> 2<span class="org-builtin">*</span>s<span class="org-builtin">/</span>(2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>80) <span class="org-builtin">+</span> s<span class="org-builtin">^</span>2<span class="org-builtin">/</span>(2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>80)<span class="org-builtin">^</span>2);
</pre>
</div>
<p>
And a FIR filter with linear phase:
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% FIR with Linear Phase</span>
Fs = 1e4; <span class="org-comment-delimiter">% </span><span class="org-comment">Sampling Frequency [Hz]</span>
B_fir = firls(1000, <span class="org-comment-delimiter">.</span><span class="org-comment">.. % Filter's order</span>
[0 140<span class="org-builtin">/</span>(Fs<span class="org-builtin">/</span>2) 180<span class="org-builtin">/</span>(Fs<span class="org-builtin">/</span>2) 1], <span class="org-comment-delimiter">.</span><span class="org-comment">.. % Frequencies [Hz]</span>
[1 1 0 0]); <span class="org-comment-delimiter">% </span><span class="org-comment">Wanted Magnitudes</span>
</pre>
</div>
<p>
Filters&rsquo; responses are computed and compared in the Bode plot of Figure <a href="#orgbfab916">34</a>.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Computation of filters' responses</span>
[h_mov_avg, f] = freqz(B_mov_avg, 1, 10000, Fs);
[h_fir, <span class="org-builtin">~</span>] = freqz(B_fir, 1, 10000, Fs);
h_lpf = squeeze(freqresp(G_lpf, f, <span class="org-string">'Hz'</span>));
</pre>
</div>
<div id="orgbfab916" class="figure">
<p><img src="figs/step_lut_filters_bode_plot.png" alt="step_lut_filters_bode_plot.png" />
</p>
<p><span class="figure-number">Figure 34: </span>Bode plot of filters that could be used before making the LUT</p>
</div>
<p>
Clearly, the currently used moving average filter is filtering too much below 160Hz and too little above 200Hz.
The FIR filter seems more suited for this case.
</p>
<p>
Let&rsquo;s now compare the filtered data.
</p>
<div class="org-src-container">
<pre class="src src-matlab">fjur_e_cur = filter(B_mov_avg, 1, fjur_e);
fjur_e_fir = filter(B_fir, 1, fjur_e);
fjur_e_lpf = lsim(G_lpf, fjur_e, time);
</pre>
</div>
<p>
As the FIR filter introduce some delays, we can identify this relay and shift the filtered data:
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Compensate the FIR delay</span>
delay = mean(grpdelay(B_fir));
</pre>
</div>
<pre class="example">
500
</pre>
<div class="org-src-container">
<pre class="src src-matlab">fjur_e_fir(1<span class="org-builtin">:</span>end<span class="org-builtin">-</span>delay) = fjur_e_fir(delay<span class="org-builtin">+</span>1<span class="org-builtin">:</span>end);
</pre>
</div>
<p>
The same is done for the moving average filter
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Compensate the Moving average delay</span>
delay = mean(grpdelay(B_mov_avg));
fjur_e_cur(1<span class="org-builtin">:</span>end<span class="org-builtin">-</span>delay) = fjur_e_cur(delay<span class="org-builtin">+</span>1<span class="org-builtin">:</span>end);
</pre>
</div>
<p>
The raw and filtered motion errors are displayed in Figure <a href="#org400372d">35</a>.
</p>
<div class="important" id="orgf5ea77d">
<p>
It is shown that while the moving average average filter is working relatively well for low speeds (at around 20mm) it is not for high speeds (near 15mm).
This is because the frequency of the error is above 100Hz and the moving average is flipping the sign of the filtered data.
</p>
<p>
The IIR low pass filter has some phase issues.
</p>
<p>
Finally the FIR filter is perfectly in phase while showing good attenuation of the disturbances.
</p>
</div>
<div id="org400372d" class="figure">
<p><img src="figs/step_lut_filtered_errors_comp.png" alt="step_lut_filtered_errors_comp.png" />
</p>
<p><span class="figure-number">Figure 35: </span>Raw measured error and filtered data</p>
</div>
<p>
If we now look at the measured position as a function of the IcePAP steps (Figure <a href="#org4463b4a">36</a>), we can see that we obtain a monotonous function for the FIR filtered data which is great to make the LUT.
</p>
<div id="org4463b4a" class="figure">
<p><img src="figs/step_lut_filtered_motion_comp.png" alt="step_lut_filtered_motion_comp.png" />
</p>
<p><span class="figure-number">Figure 36: </span>Raw measured motion and filtered motion as a function of the IcePAP Steps</p>
</div>
<p>
If we subtract the raw data with the FIR filtered data, we obtain the remaining motion shown in Figure <a href="#orgd487d12">37</a> that only contains the high frequency motion not filtered.
</p>
<div id="orgd487d12" class="figure">
<p><img src="figs/step_lut_remain_motion_remove_filtered.png" alt="step_lut_remain_motion_remove_filtered.png" />
</p>
<p><span class="figure-number">Figure 37: </span>Remaining motion error after removing the filtered part</p>
</div>
</div>
</div>
<div id="outline-container-orgfb954c6" class="outline-3">
<h3 id="orgfb954c6"><span class="section-number-3">3.9.</span> LUT creation</h3>
<div class="outline-text-3" id="text-3-9">
<p>
The procedure used to make the Lookup Table is schematically represented in Figure <a href="#org0abf62e">38</a>.
</p>
<p>
For each IcePAP step separated by a constant value (typically \(1\,\mu m\)) a point of the LUT is computed:
</p>
<ul class="org-ul">
<li>Points where the measured position is close to the wanted ideal position (i.e. the current IcePAP step) are found</li>
<li>The corresponding IcePAP step at which the Fast Jack is at the wanted position is stored in the LUT</li>
</ul>
<p>
Therefore the LUT gives the IcePAP step for which the fast jack is at the wanted position as measured by the metrology, which is what we want.
</p>
<div id="org0abf62e" class="figure">
<p><img src="figs/step_lut_schematic_principle.png" alt="step_lut_schematic_principle.png" />
</p>
<p><span class="figure-number">Figure 38: </span>Schematic of the principle used to make the Lookup Table</p>
</div>
<p>
Let&rsquo;s first initialize the LUT which is table with 4 columns and 26001 rows.
The columns are:
</p>
<ol class="org-ol">
<li>IcePAP Step indices from 0 to 26mm with a step of \(1\,\mu m\) (thus the 26001 rows)</li>
<li>IcePAP step for <code>fjur</code> at which point the fast jack is at the wanted position</li>
<li>Same for <code>fjuh</code></li>
<li>Same for <code>fjd</code></li>
</ol>
<p>
All the units of the LUT are in mm.
We will work in meters and convert to mm at the end.
</p>
<p>
Let&rsquo;s initialize the Lookup table:
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Initialization of the LUT</span>
lut = [0<span class="org-builtin">:</span>1e<span class="org-builtin">-</span>6<span class="org-builtin">:</span>26e<span class="org-builtin">-</span>3]<span class="org-builtin">'*</span>ones(1,4);
</pre>
</div>
<p>
And verify that it has the wanted size:
</p>
<pre class="example">
size(lut)
ans =
26001 4
</pre>
<p>
The measured Fast Jack position are filtered using the FIR filter:
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% FIR Filter</span>
Fs = 1e4; <span class="org-comment-delimiter">% </span><span class="org-comment">Sampling Frequency [Hz]</span>
fir_order = 1000; <span class="org-comment-delimiter">% </span><span class="org-comment">Filter's order</span>
delay = fir_order<span class="org-builtin">/</span>2; <span class="org-comment-delimiter">% </span><span class="org-comment">Delay induced by the filter</span>
B_fir = firls(fir_order, <span class="org-comment-delimiter">.</span><span class="org-comment">.. % Filter's order</span>
[0 140<span class="org-builtin">/</span>(Fs<span class="org-builtin">/</span>2) 180<span class="org-builtin">/</span>(Fs<span class="org-builtin">/</span>2) 1], <span class="org-comment-delimiter">.</span><span class="org-comment">.. % Frequencies [Hz]</span>
[1 1 0 0]); <span class="org-comment-delimiter">% </span><span class="org-comment">Wanted Magnitudes</span>
<span class="org-matlab-cellbreak">%% Filtering all measured Fast Jack Position using the FIR filter</span>
fjur_e_filt = filter(B_fir, 1, fjur_e);
fjuh_e_filt = filter(B_fir, 1, fjuh_e);
fjd_e_filt = filter(B_fir, 1, fjd_e);
<span class="org-matlab-cellbreak">%% Compensation of the delay introduced by the FIR filter</span>
fjur_e_filt(1<span class="org-builtin">:</span>end<span class="org-builtin">-</span>delay) = fjur_e_filt(delay<span class="org-builtin">+</span>1<span class="org-builtin">:</span>end);
fjuh_e_filt(1<span class="org-builtin">:</span>end<span class="org-builtin">-</span>delay) = fjuh_e_filt(delay<span class="org-builtin">+</span>1<span class="org-builtin">:</span>end);
fjd_e_filt( 1<span class="org-builtin">:</span>end<span class="org-builtin">-</span>delay) = fjd_e_filt( delay<span class="org-builtin">+</span>1<span class="org-builtin">:</span>end);
</pre>
</div>
<p>
The indices where the LUT will be populated are initialized.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Vector of Fast Jack positions [unit of lut_inc]</span>
fjur_pos = floor(min(1e6<span class="org-builtin">*</span>fjur))<span class="org-builtin">:</span>floor(max(1e6<span class="org-builtin">*</span>fjur));
fjuh_pos = floor(min(1e6<span class="org-builtin">*</span>fjuh))<span class="org-builtin">:</span>floor(max(1e6<span class="org-builtin">*</span>fjuh));
fjd_pos = floor(min(1e6<span class="org-builtin">*</span>fjd ))<span class="org-builtin">:</span>floor(max(1e6<span class="org-builtin">*</span>fjd ));
</pre>
</div>
<p>
And the LUT is computed and shown in Figure <a href="#org0e7ad57">39</a>.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Build the LUT</span>
<span class="org-keyword">for</span> <span class="org-variable-name"><span class="org-matlab-math">i</span></span> = <span class="org-constant">fjur_pos</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">Find indices where measured motion is close to the wanted one</span>
indices = fjur <span class="org-builtin">+</span> fjur_e_filt <span class="org-builtin">&gt;</span> lut(<span class="org-matlab-math">i</span>,1) <span class="org-builtin">-</span> 500e<span class="org-builtin">-</span>9 <span class="org-builtin">&amp;</span> <span class="org-comment-delimiter">.</span><span class="org-comment">..</span>
fjur <span class="org-builtin">+</span> fjur_e_filt <span class="org-builtin">&lt;</span> lut(<span class="org-matlab-math">i</span>,1) <span class="org-builtin">+</span> 500e<span class="org-builtin">-</span>9;
<span class="org-comment-delimiter">% </span><span class="org-comment">Poputate the LUT with the mean of the IcePAP steps</span>
lut(<span class="org-matlab-math">i</span>,2) = mean(fjur(indices));
<span class="org-keyword">end</span>
<span class="org-keyword">for</span> <span class="org-variable-name"><span class="org-matlab-math">i</span></span> = <span class="org-constant">fjuh_pos</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">Find indices where measuhed motion is close to the wanted one</span>
indices = fjuh <span class="org-builtin">+</span> fjuh_e_filt <span class="org-builtin">&gt;</span> lut(<span class="org-matlab-math">i</span>,1) <span class="org-builtin">-</span> 500e<span class="org-builtin">-</span>9 <span class="org-builtin">&amp;</span> <span class="org-comment-delimiter">.</span><span class="org-comment">..</span>
fjuh <span class="org-builtin">+</span> fjuh_e_filt <span class="org-builtin">&lt;</span> lut(<span class="org-matlab-math">i</span>,1) <span class="org-builtin">+</span> 500e<span class="org-builtin">-</span>9;
<span class="org-comment-delimiter">% </span><span class="org-comment">Poputate the LUT with the mean of the IcePAP steps</span>
lut(<span class="org-matlab-math">i</span>,3) = mean(fjuh(indices));
<span class="org-keyword">end</span>
<span class="org-keyword">for</span> <span class="org-variable-name"><span class="org-matlab-math">i</span></span> = <span class="org-constant">fjd_pos</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">Poputate the LUT with the mean of the IcePAP steps</span>
indices = fjd <span class="org-builtin">+</span> fjd_e_filt <span class="org-builtin">&gt;</span> lut(<span class="org-matlab-math">i</span>,1) <span class="org-builtin">-</span> 500e<span class="org-builtin">-</span>9 <span class="org-builtin">&amp;</span> <span class="org-comment-delimiter">.</span><span class="org-comment">..</span>
fjd <span class="org-builtin">+</span> fjd_e_filt <span class="org-builtin">&lt;</span> lut(<span class="org-matlab-math">i</span>,1) <span class="org-builtin">+</span> 500e<span class="org-builtin">-</span>9;
<span class="org-comment-delimiter">% </span><span class="org-comment">Poputate the LUT</span>
lut(<span class="org-matlab-math">i</span>,4) = mean(fjd(indices));
<span class="org-keyword">end</span>
</pre>
</div>
<div id="org0e7ad57" class="figure">
<p><img src="figs/step_lut_obtained_lut.png" alt="step_lut_obtained_lut.png" />
</p>
<p><span class="figure-number">Figure 39: </span>Lookup Table correction</p>
</div>
</div>
</div>
<div id="outline-container-org9fa568c" class="outline-3">
<h3 id="org9fa568c"><span class="section-number-3">3.10.</span> Cubic Interpolation of the LUT</h3>
<div class="outline-text-3" id="text-3-10">
<p>
<a id="org92d1d9a"></a>
Once the LUT is built and loaded to the IcePAP, generated steps are taking the step values in the LUT and cubic spline interpolation is performed.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Estimation of the IcePAP output steps after interpolation</span>
fjur_out_steps = spline(lut(<span class="org-builtin">:</span>,1), lut(<span class="org-builtin">:</span>,2), fjur);
</pre>
</div>
<p>
The LUT data points as well as the spline interpolation values and the ideal values are compared in Figure <a href="#orgefd8b61">40</a>.
It is shown that the spline interpolation seems to be quite accurate.
</p>
<div id="orgefd8b61" class="figure">
<p><img src="figs/step_lut_spline_interpolation_lut.png" alt="step_lut_spline_interpolation_lut.png" />
</p>
<p><span class="figure-number">Figure 40: </span>Output IcePAP Steps avec spline interpolation compared with the ideal steps</p>
</div>
<p>
The difference between the perfect step generation and the step generated after spline interpolation is shown in Figure <a href="#org9044caf">41</a>.
The remaining position error is in the order of 100nm peak to peak which is acceptable here.
</p>
<div id="org9044caf" class="figure">
<p><img src="figs/step_lut_error_after_interpolation.png" alt="step_lut_error_after_interpolation.png" />
</p>
<p><span class="figure-number">Figure 41: </span>Errors on the computed IcePAP output steps after LUT generation and spline interpolation</p>
</div>
<div class="important" id="orge4dfcd6">
<p>
In order to limit the errors due to spline interpolation, more points in the LUT should be included (ideally one point every 100nm).
This only makes the computation of the LUT a little bit longer.
</p>
</div>
</div>
</div>
</div>
<div id="outline-container-orgf08a190" class="outline-2">
<h2 id="orgf08a190"><span class="section-number-2">4.</span> Position Repeatability</h2>
<div class="outline-text-2" id="text-4">
<p>
<a id="org7d7ef9a"></a>
</p>
<p>
In this section, the repeatability of the Fast Jacks over time is studied.
</p>
<p>
The goal is to determine:
</p>
<ol class="org-ol">
<li>How good the positioning accuracy can be when using the Lookup Table to correct the non-repeatability of the fast jack motion (i.e. mode B)?</li>
<li>During how long the lookup table are remaining valid?</li>
<li>Which errors are repeatable and which are not?</li>
</ol>
<p>
The trajectories to test the repeatability is the following:
</p>
<div class="org-src-container">
<pre class="src src-python">tdh.lut_constant_fj_vel(<span class="org-highlight-numbers-number">15</span>, <span class="org-highlight-numbers-number">22</span>, pts_per_mm=<span class="org-highlight-numbers-number">1000</span>, use_lut=<span class="org-constant">False</span>)
</pre>
</div>
<p>
The Fast Jack are scanned at constant velocity from 22mm to 15mm in mode A (no LUT).
The velocity is set to 0.125mm/s.
</p>
</div>
<div id="outline-container-org45feeef" class="outline-3">
<h3 id="org45feeef"><span class="section-number-3">4.1.</span> Repeatability over several minutes</h3>
<div class="outline-text-3" id="text-4-1">
<p>
<a id="orgf0949a7"></a>
</p>
<p>
10 scans are done one after the other in mode A.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Filenames for the measurements</span>
data_files_min = {
<span class="org-string">"lut_const_fj_vel_14012022_1517.dat"</span>,
<span class="org-string">"lut_const_fj_vel_14012022_1519.dat"</span>,
<span class="org-string">"lut_const_fj_vel_14012022_1521.dat"</span>,
<span class="org-string">"lut_const_fj_vel_14012022_1523.dat"</span>,
<span class="org-string">"lut_const_fj_vel_14012022_1525.dat"</span>,
<span class="org-string">"lut_const_fj_vel_14012022_1527.dat"</span>,
<span class="org-string">"lut_const_fj_vel_14012022_1528.dat"</span>,
<span class="org-string">"lut_const_fj_vel_14012022_1530.dat"</span>,
<span class="org-string">"lut_const_fj_vel_14012022_1532.dat"</span>,
<span class="org-string">"lut_const_fj_vel_14012022_1534.dat"</span>
};
</pre>
</div>
<p>
The data are filtered such that most of the disturbances and noise are filtered out.
There is only the motion errors induced by the fast jack left in the data.
The measured position errors of <code>fjur</code> are shown in Figure <a href="#org60b8397">42</a> for the 10 scans.
</p>
<div id="org60b8397" class="figure">
<p><img src="figs/repeat_error_over_min.png" alt="repeat_error_over_min.png" />
</p>
<p><span class="figure-number">Figure 42: </span>Repeatability of <code>fjur</code> over several minutes</p>
</div>
<p>
The non-repeatable part (measured motion of scan i minus the measured motion of the first scan) is shown in Figure <a href="#orgc251a51">43</a>.
Visually, we see that we cannot expect the positioning errors to be less than several hundreds of nanometers in mode B.
</p>
<div id="orgc251a51" class="figure">
<p><img src="figs/repeat_error_over_min_non_repeat_part.png" alt="repeat_error_over_min_non_repeat_part.png" />
</p>
<p><span class="figure-number">Figure 43: </span>Non Repeatable part over several minutes</p>
</div>
<p>
The RMS value of the non repeatable part is computed for each scan and summarized in Table <a href="#orgc047a69">1</a>.
It is visually shown in Figure <a href="#orgcf2b77a">44</a>.
</p>
<p>
Clearly, the error is getting worse as more scan are performed and/or as elapse time is longer.
</p>
<table id="orgc047a69" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<caption class="t-above"><span class="table-number">Table 1:</span> RMS value of the Non-repeatable part when during several identical scans within few minutes</caption>
<colgroup>
<col class="org-right" />
<col class="org-right" />
<col class="org-right" />
<col class="org-right" />
</colgroup>
<thead>
<tr>
<th scope="col" class="org-right">Elapse Time [m]</th>
<th scope="col" class="org-right"><code>fjur</code> [nm]</th>
<th scope="col" class="org-right"><code>fjuh</code> [nm]</th>
<th scope="col" class="org-right"><code>fjd</code> [nm]</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-right">2.0</td>
<td class="org-right">47.9</td>
<td class="org-right">32.4</td>
<td class="org-right">38.1</td>
</tr>
<tr>
<td class="org-right">4.0</td>
<td class="org-right">62.5</td>
<td class="org-right">42.0</td>
<td class="org-right">54.1</td>
</tr>
<tr>
<td class="org-right">6.0</td>
<td class="org-right">74.7</td>
<td class="org-right">50.4</td>
<td class="org-right">66.0</td>
</tr>
<tr>
<td class="org-right">8.0</td>
<td class="org-right">85.8</td>
<td class="org-right">53.7</td>
<td class="org-right">81.3</td>
</tr>
<tr>
<td class="org-right">10.0</td>
<td class="org-right">95.0</td>
<td class="org-right">59.9</td>
<td class="org-right">90.4</td>
</tr>
<tr>
<td class="org-right">11.0</td>
<td class="org-right">104.6</td>
<td class="org-right">65.3</td>
<td class="org-right">98.0</td>
</tr>
<tr>
<td class="org-right">13.0</td>
<td class="org-right">115.7</td>
<td class="org-right">68.6</td>
<td class="org-right">105.6</td>
</tr>
<tr>
<td class="org-right">15.0</td>
<td class="org-right">126.8</td>
<td class="org-right">68.4</td>
<td class="org-right">112.6</td>
</tr>
<tr>
<td class="org-right">17.0</td>
<td class="org-right">138.4</td>
<td class="org-right">70.8</td>
<td class="org-right">123.2</td>
</tr>
</tbody>
</table>
<div id="orgcf2b77a" class="figure">
<p><img src="figs/repeat_error_fct_time_min.png" alt="repeat_error_fct_time_min.png" />
</p>
<p><span class="figure-number">Figure 44: </span>Remaining motion as a function of the elapse time / number of iteration</p>
</div>
</div>
</div>
<div id="outline-container-org207d90d" class="outline-3">
<h3 id="org207d90d"><span class="section-number-3">4.2.</span> Repeatability over several days</h3>
<div class="outline-text-3" id="text-4-2">
<p>
<a id="org4c88b2c"></a>
</p>
<p>
The same scan is done with approximately 8 hours of time interval over three days.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Filenames for the measurements</span>
data_files_day = {
<span class="org-string">"lut_const_fj_vel_14012022_1824.dat"</span>,
<span class="org-string">"lut_const_fj_vel_15012022_0234.dat"</span>,
<span class="org-string">"lut_const_fj_vel_15012022_1043.dat"</span>,
<span class="org-string">"lut_const_fj_vel_15012022_1852.dat"</span>,
<span class="org-string">"lut_const_fj_vel_16012022_0302.dat"</span>,
<span class="org-string">"lut_const_fj_vel_16012022_1111.dat"</span>,
<span class="org-string">"lut_const_fj_vel_16012022_1920.dat"</span>
};
</pre>
</div>
<p>
The measured position errors of <code>fjur</code> during all the scans are shown in Figure <a href="#orgab5399b">45</a>.
Clearly, the repeatability is worse than when the scans where only spaced by few minutes (Figure <a href="#org60b8397">42</a>).
</p>
<div id="orgab5399b" class="figure">
<p><img src="figs/repeat_error_over_hours.png" alt="repeat_error_over_hours.png" />
</p>
<p><span class="figure-number">Figure 45: </span>Repeatability of <code>fjur</code> over several hours</p>
</div>
<p>
The non-repeatable part is computed, summarized in Table <a href="#orgf467123">2</a> and visually shown in Figure <a href="#org8c783e7">46</a>.
</p>
<table id="orgf467123" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<caption class="t-above"><span class="table-number">Table 2:</span> RMS value of the Non-repeatable part when during several identical scans within few days</caption>
<colgroup>
<col class="org-right" />
<col class="org-right" />
<col class="org-right" />
<col class="org-right" />
</colgroup>
<thead>
<tr>
<th scope="col" class="org-right">Elapse Time [days]</th>
<th scope="col" class="org-right"><code>fjur</code> [nm]</th>
<th scope="col" class="org-right"><code>fjuh</code> [nm]</th>
<th scope="col" class="org-right"><code>fjd</code> [nm]</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-right">0.3</td>
<td class="org-right">102.9</td>
<td class="org-right">65.4</td>
<td class="org-right">76.0</td>
</tr>
<tr>
<td class="org-right">0.7</td>
<td class="org-right">147.3</td>
<td class="org-right">75.1</td>
<td class="org-right">91.5</td>
</tr>
<tr>
<td class="org-right">1.0</td>
<td class="org-right">188.8</td>
<td class="org-right">86.9</td>
<td class="org-right">106.2</td>
</tr>
<tr>
<td class="org-right">1.4</td>
<td class="org-right">220.8</td>
<td class="org-right">97.2</td>
<td class="org-right">107.2</td>
</tr>
<tr>
<td class="org-right">1.7</td>
<td class="org-right">244.2</td>
<td class="org-right">106.6</td>
<td class="org-right">104.3</td>
</tr>
<tr>
<td class="org-right">2.0</td>
<td class="org-right">252.7</td>
<td class="org-right">117.6</td>
<td class="org-right">106.1</td>
</tr>
</tbody>
</table>
<div id="org8c783e7" class="figure">
<p><img src="figs/repeat_error_fct_time_hours.png" alt="repeat_error_fct_time_hours.png" />
</p>
<p><span class="figure-number">Figure 46: </span>RMS value of the non-repeatable part for scans spaced by 8 hours</p>
</div>
</div>
</div>
<div id="outline-container-org00c772f" class="outline-3">
<h3 id="org00c772f"><span class="section-number-3">4.3.</span> Which error is repeatable and which is not?</h3>
<div class="outline-text-3" id="text-4-3">
<p>
In the previous section, it was shown that the non-repeatable part of the fast jack motion is in the order of several hundreds of nano-meters.
</p>
<p>
In this section, we wish to see if this non-repeatable error is due to:
</p>
<ul class="org-ul">
<li>Thermal drifts?</li>
<li>non-repeatability of the ball-screw mechanism (1mm error period)</li>
<li>non-repeatability of the \(20\mu m/10\mu m/5\mu m\) period errors</li>
</ul>
<p>
To do so, a spectral analysis of the non-repeatable part is performed.
</p>
<p>
First, we look at the errors with small spatial periods in Figure <a href="#org64f10db">47</a>.
It is clear that:
</p>
<ul class="org-ul">
<li>errors with periods of \(5\mu m\) and \(20\mu m\) are very repeatable over several days</li>
<li>errors with periods of \(10\mu m\) are well repeatable over several minutes but less over not hours/days (Figure <a href="#org64f10db">47</a>, right)</li>
</ul>
<div id="org64f10db" class="figure">
<p><img src="figs/non_repeatable_part_small_periods_min_hour.png" alt="non_repeatable_part_small_periods_min_hour.png" />
</p>
<p><span class="figure-number">Figure 47: </span>ASD of the non-repeatable motion part for scans spaced by several minutes and by several hours</p>
</div>
<p>
The errors related to large spatial periods are shown in Figure <a href="#org2333682">48</a>.
Two errors can be observed:
</p>
<ul class="org-ul">
<li>1mm error period with good repeatability. This repeatability degrades with time / number of scans.
Still well after several days.</li>
<li>0.37mm error period.
Well repeatable for the first scan after 2 minutes.
Degrades quickly.</li>
</ul>
<div id="org2333682" class="figure">
<p><img src="figs/non_repeatable_part_large_periods_min_hour.png" alt="non_repeatable_part_large_periods_min_hour.png" />
</p>
<p><span class="figure-number">Figure 48: </span>(Spatial) Spectral Density of the non-repeatability with large spatial periods</p>
</div>
<div class="important" id="orgf4c3574">
<p>
The repeatability is very good for the \(5\,\mu m\) and \(20\,\mu m\) period errors (Figure <a href="#org64f10db">47</a>), a little bit less for the \(10\,\mu m\) error period (Figure <a href="#org64f10db">47</a>, right).
What can be the physical cause of that?
</p>
<p>
The non-repeatability with large spatial periods are degrading over time (Figure <a href="#org2333682">48</a>).
They are however more easily compensated with the feedback control (mode C).
</p>
<p>
The cause of the error with a period of 0.37mm is still unknown.
</p>
</div>
</div>
</div>
<div id="outline-container-org9131f0a" class="outline-3">
<h3 id="org9131f0a"><span class="section-number-3">4.4.</span> Estimation of the errors in mode B</h3>
<div class="outline-text-3" id="text-4-4">
<p>
<a id="org80f67bd"></a>
</p>
<p>
In this section, the expected errors in mode B are estimated.
</p>
<p>
In order to do so the LUT for the initial scan is computed and then applied to the following scans.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Filenames for the measurements</span>
data_files_min = {
<span class="org-string">"lut_const_fj_vel_14012022_1517.dat"</span>,
<span class="org-string">"lut_const_fj_vel_14012022_1519.dat"</span>,
<span class="org-string">"lut_const_fj_vel_14012022_1521.dat"</span>,
<span class="org-string">"lut_const_fj_vel_14012022_1523.dat"</span>,
<span class="org-string">"lut_const_fj_vel_14012022_1525.dat"</span>,
<span class="org-string">"lut_const_fj_vel_14012022_1527.dat"</span>,
<span class="org-string">"lut_const_fj_vel_14012022_1528.dat"</span>,
<span class="org-string">"lut_const_fj_vel_14012022_1530.dat"</span>,
<span class="org-string">"lut_const_fj_vel_14012022_1532.dat"</span>,
<span class="org-string">"lut_const_fj_vel_14012022_1534.dat"</span>
};
</pre>
</div>
<p>
Let&rsquo;s first do this analysis for the first two scans and for the <code>fjur</code> fast jack.
</p>
<p>
The measured motion errors are shown in Figure <a href="#org279a1c3">49</a> (left) and the difference between the measured motion in Figure <a href="#org279a1c3">49</a> (right).
</p>
<div id="org279a1c3" class="figure">
<p><img src="figs/repeat_measured_fjur_motion_error.png" alt="repeat_measured_fjur_motion_error.png" />
</p>
<p><span class="figure-number">Figure 49: </span>Measured motion error for <code>fjur</code> during both scans (left) and difference in the measured motion (right)</p>
</div>
<p>
Let&rsquo;s now compare the LUT that are computed from both scans (Figure <a href="#orge2a4084">50</a>).
The two LUT corrections are differing by about 50 nm RMS.
</p>
<div id="orge2a4084" class="figure">
<p><img src="figs/repeat_comp_lut_correction_fjur.png" alt="repeat_comp_lut_correction_fjur.png" />
</p>
<p><span class="figure-number">Figure 50: </span>Generated <code>fjur</code> LUT for both scans (left) and differences between the LUT (right)</p>
</div>
<p>
Let&rsquo;s now estimate the motion error in mode B is the LUT computed with the first scan were used.
</p>
<div id="orga407c7b" class="figure">
<p><img src="figs/repeat_comp_lut_fjur_error.png" alt="repeat_comp_lut_fjur_error.png" />
</p>
<p><span class="figure-number">Figure 51: </span>Estimated error on <code>fjur</code> using LUT made based on the first scan</p>
</div>
<p>
The RMS value of the remaining error in mode B for <code>fjur</code> are computed and summarized in Table <a href="#org688bb5e">3</a>.
The error is increasing over first half hour and seems to stabilize after several hours.
</p>
<table id="org688bb5e" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<caption class="t-above"><span class="table-number">Table 3:</span> RMS value of the estimated errors in mode B for <code>fjur</code> as a function of the time between the creation of the LUT and the scan</caption>
<colgroup>
<col class="org-right" />
<col class="org-right" />
</colgroup>
<thead>
<tr>
<th scope="col" class="org-right">Elapse Time [h]</th>
<th scope="col" class="org-right"><code>fjur</code> [nm RMS]</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-right">0.0</td>
<td class="org-right">48.1</td>
</tr>
<tr>
<td class="org-right">0.1</td>
<td class="org-right">62.9</td>
</tr>
<tr>
<td class="org-right">0.1</td>
<td class="org-right">75.1</td>
</tr>
<tr>
<td class="org-right">0.1</td>
<td class="org-right">86.1</td>
</tr>
<tr>
<td class="org-right">0.2</td>
<td class="org-right">95.4</td>
</tr>
<tr>
<td class="org-right">0.2</td>
<td class="org-right">105.0</td>
</tr>
<tr>
<td class="org-right">0.2</td>
<td class="org-right">115.7</td>
</tr>
<tr>
<td class="org-right">0.2</td>
<td class="org-right">126.8</td>
</tr>
<tr>
<td class="org-right">0.3</td>
<td class="org-right">138.3</td>
</tr>
<tr>
<td class="org-right">8.2</td>
<td class="org-right">247.4</td>
</tr>
<tr>
<td class="org-right">16.3</td>
<td class="org-right">240.9</td>
</tr>
<tr>
<td class="org-right">24.5</td>
<td class="org-right">234.2</td>
</tr>
<tr>
<td class="org-right">32.6</td>
<td class="org-right">232.9</td>
</tr>
<tr>
<td class="org-right">40.8</td>
<td class="org-right">249.0</td>
</tr>
<tr>
<td class="org-right">48.9</td>
<td class="org-right">270.7</td>
</tr>
</tbody>
</table>
<p>
The (spatial) spectral density of the estimated errors in mode B are computed and shown in Figure <a href="#orgdb4dfd9">52</a> for short spatial periods and in Figure <a href="#org9032cf3">53</a> for large spatial errors.
</p>
<div id="orgdb4dfd9" class="figure">
<p><img src="figs/asd_estimated_errors_fjur_mode_B.png" alt="asd_estimated_errors_fjur_mode_B.png" />
</p>
<p><span class="figure-number">Figure 52: </span>Estimated spectral density of the <code>fjur</code> errors in mode B for several scans. Focus on short spatial periods.</p>
</div>
<div id="org9032cf3" class="figure">
<p><img src="figs/asd_estimated_errors_fjur_mode_B_large_spatial_errors.png" alt="asd_estimated_errors_fjur_mode_B_large_spatial_errors.png" />
</p>
<p><span class="figure-number">Figure 53: </span>Estimated spectral density of the <code>fjur</code> errors in mode B for several scans. Focus on large spatial periods.</p>
</div>
<div class="important" id="org73b1c8e">
<p>
Using the LUT, most of the errors can be compensated.
This includes the errors of the stepper motor (with periods of \(5\,\mu m\), \(10\,\mu m\) and \(20\,\mu m\)) and the errors of the ball-screw mechanism (periods of \(1\,mm\)).
</p>
<p>
The &ldquo;quality&rdquo; of the LUT is degrading over time, especially for periods of \(10\,\mu m\) and \(1\,mm\).
While the errors with a period of \(1\,mm\) are not an issue as they will be easily compensated using feedback control, errors with a period of \(10\,\mu m\) could be more problematic.
</p>
</div>
</div>
</div>
<div id="outline-container-orge3c38c5" class="outline-3">
<h3 id="orge3c38c5"><span class="section-number-3">4.5.</span> Conclusion</h3>
<div class="outline-text-3" id="text-4-5">
<div class="important" id="org45f8a30">
<p>
Repeatability of the Fast Jack motion has been studied.
</p>
<p>
Even though the repeatability degrades over time, the main errors with a period of \(5\,\mu m\) are well repeatable over many scans and time spans of several days.
The degradation of the repeatability is mostly problematic of the errors with a period of \(10\,\mu m\).
</p>
<p>
It was shown that the use of a Lookup Table can eliminate most of the repeatable errors.
The remaining motion error on each fast jack is expected to be in the order of \(100\,nm \text{RMS}\) (see Figure <a href="#orga407c7b">51</a>).
</p>
</div>
</div>
</div>
</div>
<div id="outline-container-orge4327b1" class="outline-2">
<h2 id="orge4327b1"><span class="section-number-2">5.</span> LUT Software Implementation</h2>
<div class="outline-text-2" id="text-5">
<p>
<a id="orgef2f072"></a>
</p>
</div>
<div id="outline-container-orge7d7451" class="outline-3">
<h3 id="orge7d7451"><span class="section-number-3">5.1.</span> Matlab implementation</h3>
<div class="outline-text-3" id="text-5-1">
<p>
<a id="org6e7ce18"></a>
</p>
<p>
In this section, the computation of the LUT is implemented using Matlab and tested experimentally.
</p>
</div>
<div id="outline-container-org0847718" class="outline-4">
<h4 id="org0847718"><span class="section-number-4">5.1.1.</span> LUT Creation</h4>
<div class="outline-text-4" id="text-5-1-1">
<p>
A scan in mode A is performed using the <code>thtraj</code> motor.
The scan is performed from 10 to 70 degrees.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Extract measurement Data make from BLISS</span>
data_A = extractDatData(sprintf(<span class="org-string">"%s/21Nov/blc13420/id21/LUT_Matlab/lut_matlab_22122021_1610.dat"</span>, data_directory), <span class="org-comment-delimiter">.</span><span class="org-comment">..</span>
{<span class="org-string">"bragg"</span>, <span class="org-string">"dz"</span>, <span class="org-string">"dry"</span>, <span class="org-string">"drx"</span>, <span class="org-string">"fjur"</span>, <span class="org-string">"fjuh"</span>, <span class="org-string">"fjd"</span>}, <span class="org-comment-delimiter">.</span><span class="org-comment">..</span>
[<span class="org-matlab-math">pi</span><span class="org-builtin">/</span>180, 1e<span class="org-builtin">-</span>9, 1e<span class="org-builtin">-</span>9, 1e<span class="org-builtin">-</span>9, 1e<span class="org-builtin">-</span>8, 1e<span class="org-builtin">-</span>8, 1e<span class="org-builtin">-</span>8]);
</pre>
</div>
<p>
A LUT is generated from this Data.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Generate LUT</span>
data_lut = createLUT(data_A, <span class="org-string">"./matlab/lut/lut_matlab_22122021_1610_10_70_table.dat"</span>);
</pre>
</div>
<p>
The generated LUT is shown in Figure <a href="#org2fd2739">54</a>.
</p>
<div id="org2fd2739" class="figure">
<p><img src="figs/generated_matlab_lut_10_70.png" alt="generated_matlab_lut_10_70.png" />
</p>
<p><span class="figure-number">Figure 54: </span>Generated LUT</p>
</div>
</div>
</div>
<div id="outline-container-org346d396" class="outline-4">
<h4 id="org346d396"><span class="section-number-4">5.1.2.</span> Compare Mode A and Mode B</h4>
<div class="outline-text-4" id="text-5-1-2">
<p>
The LUT is loaded into the IcePAP and a new scan in mode B is performed over the same stroke.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Load mode B scan data</span>
data_B = extractDatData(sprintf(<span class="org-string">"%s/21Nov/blc13420/id21/LUT_Matlab/lut_matlab_result_22122021_1616.dat"</span>, data_directory), <span class="org-comment-delimiter">.</span><span class="org-comment">..</span>
{<span class="org-string">"bragg"</span>, <span class="org-string">"dz"</span>, <span class="org-string">"dry"</span>, <span class="org-string">"drx"</span>, <span class="org-string">"fjur"</span>, <span class="org-string">"fjuh"</span>, <span class="org-string">"fjd"</span>}, <span class="org-comment-delimiter">.</span><span class="org-comment">..</span>
[<span class="org-matlab-math">pi</span><span class="org-builtin">/</span>180, 1e<span class="org-builtin">-</span>9, 1e<span class="org-builtin">-</span>9, 1e<span class="org-builtin">-</span>9, 1e<span class="org-builtin">-</span>8, 1e<span class="org-builtin">-</span>8, 1e<span class="org-builtin">-</span>8]);
</pre>
</div>
<p>
The raw (unfiltered, 10kHz) measured motion for <code>fjur</code>, <code>fjuh</code> and <code>fjd</code> are displayed in Figure <a href="#org06d2222">55</a>.
</p>
<div id="org06d2222" class="figure">
<p><img src="figs/matlab_lut_comp_fj_raw.png" alt="matlab_lut_comp_fj_raw.png" />
</p>
<p><span class="figure-number">Figure 55: </span>Comparison of the Raw measurement of fast jack motion errors for mode A and mode B</p>
</div>
<p>
As the raw measured data is quite noisy and affected by disturbances, the data is filtered to obtain the motion errors of the fast jack.
The filtered measured errors are shown in Figure <a href="#org54152e3">56</a>.
</p>
<div id="org54152e3" class="figure">
<p><img src="figs/matlab_lut_comp_fj_filt.png" alt="matlab_lut_comp_fj_filt.png" />
</p>
<p><span class="figure-number">Figure 56: </span>Comparison of the Raw measurement of fast jack motion errors for mode A and mode B</p>
</div>
</div>
</div>
<div id="outline-container-org692b5f7" class="outline-4">
<h4 id="org692b5f7"><span class="section-number-4">5.1.3.</span> Analysis of the remaining errors</h4>
<div class="outline-text-4" id="text-5-1-3">
<p>
Let&rsquo;s now analyze the remaining errors.
</p>
<p>
The spectral content of the errors are shown in Figure <a href="#org429c041">57</a>.
The following can be observed:
</p>
<ul class="org-ul">
<li>errors with periods of \(5\,\mu m\), \(10\,\mu m\) and \(20\,\mu m\) are reduced</li>
<li>errors with period of 0.37mm and 1mm are almost totally reduced</li>
<li>additional motion are added in mode B with periods from \(15\,\mu m\) to \(25\,\mu m\)</li>
</ul>
<div id="org429c041" class="figure">
<p><img src="figs/matlab_lut_mode_B_errors_spectral.png" alt="matlab_lut_mode_B_errors_spectral.png" />
</p>
<p><span class="figure-number">Figure 57: </span>Spectral density of the <code>fjur</code> measured errors in mode A and mode B</p>
</div>
<div class="important" id="org1dd31fe">
<p>
Even though the errors in mode B are well reduced as compared to mode A, the LUT is not working as well as expected from Section <a href="#org80f67bd">4.4</a>.
</p>
<p>
This can be due to several factors:
</p>
<ul class="org-ul">
<li>limited number of points taken in the LUT (original 1 point every \(\mu m\)) which leads to errors when interpolating the LUT</li>
<li>limited number of points taken in the mode B trajectory leading to interpolation errors</li>
</ul>
<p>
Further tests will be performed with in more ideal conditions:
</p>
<ul class="org-ul">
<li>better trajectory used to build the LUT</li>
<li>more points in the LUT as well as in the trajectory</li>
</ul>
</div>
</div>
</div>
</div>
<div id="outline-container-org18efe32" class="outline-3">
<h3 id="org18efe32"><span class="section-number-3">5.2.</span> Python implementation</h3>
<div class="outline-text-3" id="text-5-2">
<p>
<a id="orgb708adf"></a>
</p>
<p>
In this section, the LUT is computed using Python.
</p>
</div>
<div id="outline-container-orgd31fecc" class="outline-4">
<h4 id="orgd31fecc"><span class="section-number-4">5.2.1.</span> Load Data</h4>
<div class="outline-text-4" id="text-5-2-1">
<p>
A scan in mode A is performed and loaded.
</p>
<div class="org-src-container">
<pre class="src src-jupyter-python"><span class="org-variable-name">data</span> = np.loadtxt(<span class="org-string">"/home/thomas/mnt/data_id21/21Nov/blc13420/id21/LUT_constant_fj_vel/lut_const_fj_vel_17012022_1749.dat"</span>)
</pre>
</div>
<p>
Useful data are extracted and converted to SI units.
</p>
<div class="org-src-container">
<pre class="src src-jupyter-python"><span class="org-variable-name">bragg</span> = np.pi/<span class="org-highlight-numbers-number">180</span>*data[:,<span class="org-highlight-numbers-number">0</span>] <span class="org-comment-delimiter"># </span><span class="org-comment">Bragg Angle [rad]</span>
<span class="org-variable-name">dz</span> = 1e-<span class="org-highlight-numbers-number">9</span>*data[:,<span class="org-highlight-numbers-number">1</span>] <span class="org-comment-delimiter"># </span><span class="org-comment">Distance between crystals [m]</span>
<span class="org-variable-name">dry</span> = 1e-<span class="org-highlight-numbers-number">9</span>*data[:,<span class="org-highlight-numbers-number">2</span>] <span class="org-comment-delimiter"># </span><span class="org-comment">dry [rad]</span>
<span class="org-variable-name">drx</span> = 1e-<span class="org-highlight-numbers-number">9</span>*data[:,<span class="org-highlight-numbers-number">3</span>] <span class="org-comment-delimiter"># </span><span class="org-comment">drx [rad]</span>
<span class="org-variable-name">fjur</span> = 1e-<span class="org-highlight-numbers-number">8</span>*data[:,<span class="org-highlight-numbers-number">4</span>] <span class="org-comment-delimiter"># </span><span class="org-comment">ur Fast Jack Step in [m]</span>
<span class="org-variable-name">fjuh</span> = 1e-<span class="org-highlight-numbers-number">8</span>*data[:,<span class="org-highlight-numbers-number">5</span>] <span class="org-comment-delimiter"># </span><span class="org-comment">uh Fast Jack Step in [m]</span>
<span class="org-variable-name">fjd</span> = 1e-<span class="org-highlight-numbers-number">8</span>*data[:,<span class="org-highlight-numbers-number">6</span>] <span class="org-comment-delimiter"># </span><span class="org-comment">d Fast Jack Step in [m]</span>
<span class="org-variable-name">time</span> = 1e-<span class="org-highlight-numbers-number">4</span>*np.arange(<span class="org-highlight-numbers-number">0</span>, np.size(bragg), <span class="org-highlight-numbers-number">1</span>) <span class="org-comment-delimiter"># </span><span class="org-comment">Time vector [s]</span>
<span class="org-variable-name">ddz</span> = <span class="org-highlight-numbers-number">10</span>.5e-<span class="org-highlight-numbers-number">3</span>/(<span class="org-highlight-numbers-number">2</span>*np.cos(bragg)) - dz; <span class="org-comment-delimiter"># </span><span class="org-comment">Z error between the two crystals [m]</span>
</pre>
</div>
<p>
The Bragg angle as a function of time is shown in Figure <a href="#orge909ab3">58</a> and the fast jack displacements are shown in Figure <a href="#org846448a">59</a>.
</p>
<div id="orge909ab3" class="figure">
<p><img src="figs/python_bragg.png" alt="python_bragg.png" />
</p>
<p><span class="figure-number">Figure 58: </span>Bragg angle during the mode A scan</p>
</div>
<div id="org846448a" class="figure">
<p><img src="figs/python_fj_motion.png" alt="python_fj_motion.png" />
</p>
<p><span class="figure-number">Figure 59: </span>Fast Jack motion during the mode A scan</p>
</div>
</div>
</div>
<div id="outline-container-orgf8d52c6" class="outline-4">
<h4 id="orgf8d52c6"><span class="section-number-4">5.2.2.</span> Convert Data in the frame of the fast jack</h4>
<div class="outline-text-4" id="text-5-2-2">
<p>
The measured motion of the crystals using the interferometers are converted to the motion of the three jacks using the Jacobian matrix.
</p>
<div class="org-src-container">
<pre class="src src-jupyter-python"><span class="org-comment-delimiter"># </span><span class="org-comment">Actuator Jacobian</span>
<span class="org-variable-name">J_a_111</span> = np.array([[<span class="org-highlight-numbers-number">1</span>, <span class="org-highlight-numbers-number">0.14</span>, -<span class="org-highlight-numbers-number">0.0675</span>], [<span class="org-highlight-numbers-number">1</span>, <span class="org-highlight-numbers-number">0.14</span>, <span class="org-highlight-numbers-number">0.1525</span>], [<span class="org-highlight-numbers-number">1</span>, -<span class="org-highlight-numbers-number">0.14</span>, <span class="org-highlight-numbers-number">0.0425</span>]])
<span class="org-comment-delimiter"># </span><span class="org-comment">Computation of the position of the FJ as measured by the interferometers</span>
<span class="org-variable-name">error</span> = J_a_111 @ [ddz, dry, drx]
<span class="org-variable-name">fjur_e</span> = error[<span class="org-highlight-numbers-number">0</span>,:] <span class="org-comment-delimiter"># </span><span class="org-comment">[m]</span>
<span class="org-variable-name">fjuh_e</span> = error[<span class="org-highlight-numbers-number">1</span>,:] <span class="org-comment-delimiter"># </span><span class="org-comment">[m]</span>
<span class="org-variable-name">fjd_e</span> = error[<span class="org-highlight-numbers-number">2</span>,:] <span class="org-comment-delimiter"># </span><span class="org-comment">[m]</span>
</pre>
</div>
<p>
The obtained motion error of the fast jack as a function of time are shown in Figure <a href="#orgb63f175">60</a>.
</p>
<div id="orgb63f175" class="figure">
<p><img src="figs/python_fj_errors.png" alt="python_fj_errors.png" />
</p>
<p><span class="figure-number">Figure 60: </span>Measured fast jack motion errors as a function of time</p>
</div>
</div>
</div>
<div id="outline-container-org7fb5cd2" class="outline-4">
<h4 id="org7fb5cd2"><span class="section-number-4">5.2.3.</span> Filter Data</h4>
<div class="outline-text-4" id="text-5-2-3">
<p>
In order to get rid of external disturbances and noise, the measured fast jack displacement errors are low pass filtered.
</p>
<p>
The filter parameters are defined below.
</p>
<div class="org-src-container">
<pre class="src src-jupyter-python"><span class="org-comment-delimiter"># </span><span class="org-comment">Generate Low pass FIR Filter</span>
<span class="org-variable-name">sample_rate</span> = <span class="org-highlight-numbers-number">10000.0</span> <span class="org-comment-delimiter"># </span><span class="org-comment">Sample Rate [Hz]</span>
<span class="org-variable-name">nyq_rate</span> = sample_rate / <span class="org-highlight-numbers-number">2.0</span> <span class="org-comment-delimiter"># </span><span class="org-comment">Nyquist Rate [Hz]</span>
<span class="org-variable-name">cutoff_hz</span> = <span class="org-highlight-numbers-number">27</span> <span class="org-comment-delimiter"># </span><span class="org-comment">The cutoff frequency of the filter [Hz]</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Window with specific ripple [dB] and width [Nyquist Fraction]</span>
<span class="org-variable-name">N</span>, <span class="org-variable-name">beta</span> = kaiserord(<span class="org-highlight-numbers-number">60</span>, <span class="org-highlight-numbers-number">4</span>/nyq_rate)
<span class="org-comment-delimiter"># </span><span class="org-comment">Delay expressed in number of sample</span>
<span class="org-variable-name">N_delay</span> = <span class="org-builtin">int</span>((N-<span class="org-highlight-numbers-number">1</span>)/<span class="org-highlight-numbers-number">2</span>)
<span class="org-comment-delimiter"># </span><span class="org-comment">Delay expressed in seconds</span>
<span class="org-variable-name">delay</span> = N_delay / sample_rate
</pre>
</div>
<p>
The filter is generated using the following command:
</p>
<div class="org-src-container">
<pre class="src src-jupyter-python"><span class="org-comment-delimiter"># </span><span class="org-comment">Fitler generation</span>
<span class="org-variable-name">taps</span> = firwin(N, cutoff_hz/nyq_rate, window=(<span class="org-string">'kaiser'</span>, beta))
</pre>
</div>
<p>
This filter will introduce a constant delay that is a function of its length:
</p>
<div class="org-src-container">
<pre class="src src-jupyter-python"><span class="org-builtin">print</span>(<span class="org-string">"Length of the filter is %i\nDelay is %i samples (i.e. %.3f seconds)"</span> % (N, N_delay, delay))
</pre>
</div>
<pre class="example">
Length of the filter is 9065
Delay is 4532 samples (i.e. 0.453 seconds)
</pre>
<p>
The measured data is then filtered using the <code>lfilter</code> command.
The obtained raw and filtered data are displayed in Figure <a href="#orga617ba7">61</a>.
</p>
<div class="org-src-container">
<pre class="src src-jupyter-python"><span class="org-comment-delimiter"># </span><span class="org-comment">Filtering of data, compensation of the delay introduced by the FIR filter</span>
<span class="org-variable-name">fjur_e_filt</span> = lfilter(taps, <span class="org-highlight-numbers-number">1.0</span>, fjur_e)[<span class="org-variable-name">N</span>:]
fjuh_e_filt = lfilter(taps, <span class="org-highlight-numbers-number">1.0</span>, fjuh_e)[<span class="org-variable-name">N</span>:]
fjd_e_filt = lfilter(taps, <span class="org-highlight-numbers-number">1.0</span>, fjd_e)[<span class="org-variable-name">N</span>:]
time_filt = time[N_delay+<span class="org-highlight-numbers-number">1</span>:-N_delay]
</pre>
</div>
<div id="orga617ba7" class="figure">
<p><img src="figs/python_fj_errors_filt.png" alt="python_fj_errors_filt.png" />
</p>
<p><span class="figure-number">Figure 61: </span>Raw and filtered measured errors of the fast jack motion</p>
</div>
<p>
The measured fast jack motion (filtered) as a function of the IcePAP steps (desired position) is shown in Figure <a href="#org51c70a5">62</a> for the three fast jacks.
</p>
<div id="org51c70a5" class="figure">
<p><img src="figs/python_pos_error_scan.png" alt="python_pos_error_scan.png" />
</p>
<p><span class="figure-number">Figure 62: </span>Measured fast jack motion as a function of the IcePAP step</p>
</div>
</div>
</div>
<div id="outline-container-orga41902a" class="outline-4">
<h4 id="orga41902a"><span class="section-number-4">5.2.4.</span> Get Only Interesting Data</h4>
<div class="outline-text-4" id="text-5-2-4">
<p>
Now the data corresponding to the acceleration phase are removed.
</p>
<div class="org-src-container">
<pre class="src src-jupyter-python"><span class="org-comment-delimiter"># </span><span class="org-comment">Remove the extreme part of the data corresponding to the acceleration phase</span>
<span class="org-variable-name">filt_array</span> = np.where(np.logical_or(fjd[N_delay+<span class="org-highlight-numbers-number">1</span>:-N_delay] &gt; fjd[<span class="org-highlight-numbers-number">0</span>] - <span class="org-highlight-numbers-number">0</span>.05e-<span class="org-highlight-numbers-number">3</span>, fjd[N_delay+<span class="org-highlight-numbers-number">1</span>:-N_delay] &lt; fjd[-<span class="org-highlight-numbers-number">1</span>] + <span class="org-highlight-numbers-number">0</span>.05e-<span class="org-highlight-numbers-number">3</span>))
<span class="org-variable-name">fjur_e_filt</span> = np.delete(fjur_e_filt, filt_array)
<span class="org-variable-name">fjuh_e_filt</span> = np.delete(fjuh_e_filt, filt_array)
<span class="org-variable-name">fjd_e_filt</span> = np.delete(fjd_e_filt, filt_array)
<span class="org-variable-name">time_filt</span> = np.delete(time_filt, filt_array)
<span class="org-variable-name">fjur_filt</span> = np.delete(fjur[N_delay+<span class="org-highlight-numbers-number">1</span>:-N_delay], filt_array)
<span class="org-variable-name">fjuh_filt</span> = np.delete(fjuh[N_delay+<span class="org-highlight-numbers-number">1</span>:-N_delay], filt_array)
<span class="org-variable-name">fjd_filt</span> = np.delete(fjd[ N_delay+<span class="org-highlight-numbers-number">1</span>:-N_delay], filt_array)
</pre>
</div>
</div>
</div>
<div id="outline-container-org2e651bd" class="outline-4">
<h4 id="org2e651bd"><span class="section-number-4">5.2.5.</span> LUT creation</h4>
<div class="outline-text-4" id="text-5-2-5">
<p>
Now the LUT is initialized and computed.
</p>
<div class="org-src-container">
<pre class="src src-jupyter-python"><span class="org-comment-delimiter"># </span><span class="org-comment">Distance bewteen LUT points in [m]</span>
<span class="org-variable-name">lut_inc</span> = 100e-<span class="org-highlight-numbers-number">9</span>
</pre>
</div>
<div class="org-src-container">
<pre class="src src-jupyter-python"><span class="org-comment-delimiter"># </span><span class="org-comment">Lut Initialization - First column is pos in [m]</span>
<span class="org-variable-name">lut_start</span> = lut_inc*np.floor(np.<span class="org-builtin">min</span>([[fjur_filt + fjur_e_filt], [fjuh_filt + fjuh_e_filt], [fjd_filt + fjd_e_filt]])/lut_inc)
<span class="org-variable-name">lut_end</span> = lut_inc*np.ceil(np.<span class="org-builtin">max</span>([[fjur_filt + fjur_e_filt], [fjuh_filt + fjuh_e_filt], [fjd_filt + fjd_e_filt]])/lut_inc)
<span class="org-variable-name">lut</span> = np.arange(lut_start,lut_end,lut_inc)[:, np.newaxis] @ np.ones((<span class="org-highlight-numbers-number">1</span>,<span class="org-highlight-numbers-number">4</span>))
</pre>
</div>
<div class="org-src-container">
<pre class="src src-jupyter-python"><span class="org-comment-delimiter"># </span><span class="org-comment">Build the LUT</span>
<span class="org-keyword">for</span> i <span class="org-keyword">in</span> <span class="org-builtin">range</span>(<span class="org-highlight-numbers-number">0</span>, lut.shape[<span class="org-highlight-numbers-number">0</span>]):
<span class="org-variable-name">idx</span> = (np.<span class="org-builtin">abs</span>(fjur_filt + fjur_e_filt - lut[i,<span class="org-highlight-numbers-number">0</span>])).argmin()
<span class="org-keyword">if</span> idx &gt; <span class="org-highlight-numbers-number">3</span> <span class="org-keyword">and</span> idx &lt; np.size(fjur_filt) - <span class="org-highlight-numbers-number">3</span>:
<span class="org-variable-name">lut</span>[i,<span class="org-highlight-numbers-number">1</span>] = fjur_filt[idx];
<span class="org-variable-name">idx</span> = (np.<span class="org-builtin">abs</span>(fjuh_filt + fjuh_e_filt - lut[i,<span class="org-highlight-numbers-number">0</span>])).argmin()
<span class="org-keyword">if</span> idx &gt; <span class="org-highlight-numbers-number">3</span> <span class="org-keyword">and</span> idx &lt; np.size(fjuh_filt) - <span class="org-highlight-numbers-number">3</span>:
<span class="org-variable-name">lut</span>[i,<span class="org-highlight-numbers-number">2</span>] = fjuh_filt[idx];
<span class="org-variable-name">idx</span> = (np.<span class="org-builtin">abs</span>(fjd_filt + fjd_e_filt - lut[i,<span class="org-highlight-numbers-number">0</span>])).argmin()
<span class="org-keyword">if</span> idx &gt; <span class="org-highlight-numbers-number">3</span> <span class="org-keyword">and</span> idx &lt; np.size(fjd_filt) - <span class="org-highlight-numbers-number">3</span>:
<span class="org-variable-name">lut</span>[i,<span class="org-highlight-numbers-number">3</span>] = fjd_filt[idx];
</pre>
</div>
<div class="org-src-container">
<pre class="src src-jupyter-python"><span class="org-comment-delimiter"># </span><span class="org-comment">Add points at both extremities of the LUT to make sure larger scans can be performed</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">lut = np.append(lut, np.arange(lut_end+5e-6, lut_end+50e-6, 5e-6)[:, np.newaxis] @ np.ones((1,4)), axis=0)</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">lut = np.insert(lut, 0, np.arange(lut_start-50e-6, lut_start-1e-6, 5e-6)[:, np.newaxis] @ np.ones((1,4)), axis=0)</span>
<span class="org-variable-name">lut</span> = np.append(lut, np.arange(lut_end+1e-<span class="org-highlight-numbers-number">3</span>, 30e-<span class="org-highlight-numbers-number">3</span>, 1e-<span class="org-highlight-numbers-number">3</span>)[:, np.newaxis] @ np.ones((<span class="org-highlight-numbers-number">1</span>,<span class="org-highlight-numbers-number">4</span>)), axis=<span class="org-highlight-numbers-number">0</span>)
lut = np.insert(lut, <span class="org-highlight-numbers-number">0</span>, np.arange(4e-<span class="org-highlight-numbers-number">3</span>, lut_start, 1e-<span class="org-highlight-numbers-number">3</span>)[:, np.newaxis] @ np.ones((<span class="org-highlight-numbers-number">1</span>,<span class="org-highlight-numbers-number">4</span>)), axis=<span class="org-highlight-numbers-number">0</span>)
</pre>
</div>
<p>
The computed LUT is shown in Figure <a href="#org0f4f681">63</a>.
</p>
<p>
There is a &ldquo;step&rdquo; at the extremities that will slow down the scans is the steps are within the trajectories.
</p>
<div id="org0f4f681" class="figure">
<p><img src="figs/python_lut_before_normalize_ends.png" alt="python_lut_before_normalize_ends.png" />
</p>
<p><span class="figure-number">Figure 63: </span>LUT before &ldquo;normalization&rdquo; of ends</p>
</div>
<p>
In order to deal with this issue, both ends of the LUT are shifted in order to compensate this step.
</p>
<div class="org-src-container">
<pre class="src src-jupyter-python"><span class="org-comment-delimiter"># </span><span class="org-comment">Step compensation of the start of the LUT</span>
<span class="org-variable-name">i</span> = np.argmax(np.<span class="org-builtin">abs</span>(lut[:,<span class="org-highlight-numbers-number">1</span>] - lut[:,<span class="org-highlight-numbers-number">0</span>]) &gt; 100e-<span class="org-highlight-numbers-number">9</span>)
<span class="org-variable-name">ur_offset</span> = lut[i,<span class="org-highlight-numbers-number">1</span>] - lut[i,<span class="org-highlight-numbers-number">0</span>]
<span class="org-variable-name">lut</span>[<span class="org-highlight-numbers-number">0</span>:i,<span class="org-highlight-numbers-number">1</span>] = lut[<span class="org-highlight-numbers-number">0</span>:i,<span class="org-highlight-numbers-number">1</span>] + ur_offset
<span class="org-variable-name">i</span> = np.argmax(np.<span class="org-builtin">abs</span>(lut[:,<span class="org-highlight-numbers-number">2</span>] - lut[:,<span class="org-highlight-numbers-number">0</span>]) &gt; 100e-<span class="org-highlight-numbers-number">9</span>)
<span class="org-variable-name">uh_offset</span> = lut[i,<span class="org-highlight-numbers-number">2</span>] - lut[i,<span class="org-highlight-numbers-number">0</span>]
<span class="org-variable-name">lut</span>[<span class="org-highlight-numbers-number">0</span>:i,<span class="org-highlight-numbers-number">2</span>] = lut[<span class="org-highlight-numbers-number">0</span>:i,<span class="org-highlight-numbers-number">2</span>] + uh_offset
<span class="org-variable-name">i</span> = np.argmax(np.<span class="org-builtin">abs</span>(lut[:,<span class="org-highlight-numbers-number">3</span>] - lut[:,<span class="org-highlight-numbers-number">0</span>]) &gt; 100e-<span class="org-highlight-numbers-number">9</span>)
<span class="org-variable-name">d_offset</span> = lut[i,<span class="org-highlight-numbers-number">3</span>] - lut[i,<span class="org-highlight-numbers-number">0</span>]
<span class="org-variable-name">lut</span>[<span class="org-highlight-numbers-number">0</span>:i,<span class="org-highlight-numbers-number">3</span>] = lut[<span class="org-highlight-numbers-number">0</span>:i,<span class="org-highlight-numbers-number">3</span>] + d_offset
<span class="org-comment-delimiter"># </span><span class="org-comment">Step compensation of the end of the LUT</span>
<span class="org-variable-name">i</span> = np.argmax(np.<span class="org-builtin">abs</span>(lut[::-<span class="org-highlight-numbers-number">1</span>,<span class="org-highlight-numbers-number">1</span>] - lut[::-<span class="org-highlight-numbers-number">1</span>,<span class="org-highlight-numbers-number">0</span>]) &gt; 100e-<span class="org-highlight-numbers-number">9</span>)
<span class="org-variable-name">ur_offset</span> = lut[-i-<span class="org-highlight-numbers-number">1</span>,<span class="org-highlight-numbers-number">1</span>] - lut[-i-<span class="org-highlight-numbers-number">1</span>,<span class="org-highlight-numbers-number">0</span>]
<span class="org-variable-name">lut</span>[-i:,<span class="org-highlight-numbers-number">1</span>] = lut[-i:,<span class="org-highlight-numbers-number">1</span>] + ur_offset
<span class="org-variable-name">i</span> = np.argmax(np.<span class="org-builtin">abs</span>(lut[::-<span class="org-highlight-numbers-number">1</span>,<span class="org-highlight-numbers-number">2</span>] - lut[::-<span class="org-highlight-numbers-number">1</span>,<span class="org-highlight-numbers-number">0</span>]) &gt; 100e-<span class="org-highlight-numbers-number">9</span>)
<span class="org-variable-name">uh_offset</span> = lut[-i-<span class="org-highlight-numbers-number">1</span>,<span class="org-highlight-numbers-number">2</span>] - lut[-i-<span class="org-highlight-numbers-number">1</span>,<span class="org-highlight-numbers-number">0</span>]
<span class="org-variable-name">lut</span>[-i:,<span class="org-highlight-numbers-number">2</span>] = lut[-i:,<span class="org-highlight-numbers-number">2</span>] + uh_offset
<span class="org-variable-name">i</span> = np.argmax(np.<span class="org-builtin">abs</span>(lut[::-<span class="org-highlight-numbers-number">1</span>,<span class="org-highlight-numbers-number">3</span>] - lut[::-<span class="org-highlight-numbers-number">1</span>,<span class="org-highlight-numbers-number">0</span>]) &gt; 100e-<span class="org-highlight-numbers-number">9</span>)
<span class="org-variable-name">d_offset</span> = lut[-i-<span class="org-highlight-numbers-number">1</span>,<span class="org-highlight-numbers-number">3</span>] - lut[-i-<span class="org-highlight-numbers-number">1</span>,<span class="org-highlight-numbers-number">0</span>]
<span class="org-variable-name">lut</span>[-i:,<span class="org-highlight-numbers-number">3</span>] = lut[-i:,<span class="org-highlight-numbers-number">3</span>] + d_offset
</pre>
</div>
<p>
The final LUT is displayed in Figure <a href="#org7f4f0b6">64</a>.
The LUT is now smooth and trajectories larger than the LUT will be possible.
</p>
<div id="org7f4f0b6" class="figure">
<p><img src="figs/python_lut_verif.png" alt="python_lut_verif.png" />
</p>
<p><span class="figure-number">Figure 64: </span>Figure caption</p>
</div>
<div class="org-src-container">
<pre class="src src-jupyter-python"><span class="org-comment-delimiter"># </span><span class="org-comment">Convert from [m] to [mm]</span>
<span class="org-variable-name">lut</span> = 1e3*lut;
</pre>
</div>
<p>
The LUT is saved as a <code>.dat</code> file that will be loaded into BLISS.
</p>
<div class="org-src-container">
<pre class="src src-jupyter-python"><span class="org-variable-name">filename</span> = <span class="org-string">"test_lut_python.dat"</span>
<span class="org-builtin">print</span>(f<span class="org-string">"Save LUT Table in </span>{filename}<span class="org-string">"</span>)
np.savetxt(filename, lut)
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org6f54d35" class="outline-3">
<h3 id="org6f54d35"><span class="section-number-3">5.3.</span> New Method (Python)</h3>
<div class="outline-text-3" id="text-5-3">
<p>
In this section, the LUT is computed using Python.
</p>
</div>
<div id="outline-container-orga6a9fd2" class="outline-4">
<h4 id="orga6a9fd2"><span class="section-number-4">5.3.1.</span> Load Data</h4>
<div class="outline-text-4" id="text-5-3-1">
<p>
A scan in mode A is performed and loaded.
</p>
<div class="org-src-container">
<pre class="src src-jupyter-python"><span class="org-variable-name">data</span> = np.loadtxt(<span class="org-string">"/home/thomas/mnt/data_id21/21Nov/blc13420/id21/LUT_constant_fj_vel/lut_const_fj_vel_17012022_1749.dat"</span>)
</pre>
</div>
<p>
Useful data are extracted and converted to SI units.
</p>
<div class="org-src-container">
<pre class="src src-jupyter-python"><span class="org-variable-name">bragg</span> = np.pi/<span class="org-highlight-numbers-number">180</span>*data[:,<span class="org-highlight-numbers-number">0</span>] <span class="org-comment-delimiter"># </span><span class="org-comment">Bragg Angle [rad]</span>
<span class="org-variable-name">dz</span> = 1e-<span class="org-highlight-numbers-number">9</span>*data[:,<span class="org-highlight-numbers-number">1</span>] <span class="org-comment-delimiter"># </span><span class="org-comment">Distance between crystals [m]</span>
<span class="org-variable-name">dry</span> = 1e-<span class="org-highlight-numbers-number">9</span>*data[:,<span class="org-highlight-numbers-number">2</span>] <span class="org-comment-delimiter"># </span><span class="org-comment">dry [rad]</span>
<span class="org-variable-name">drx</span> = 1e-<span class="org-highlight-numbers-number">9</span>*data[:,<span class="org-highlight-numbers-number">3</span>] <span class="org-comment-delimiter"># </span><span class="org-comment">drx [rad]</span>
<span class="org-variable-name">fjur</span> = 1e-<span class="org-highlight-numbers-number">8</span>*data[:,<span class="org-highlight-numbers-number">4</span>] <span class="org-comment-delimiter"># </span><span class="org-comment">ur Fast Jack Step in [m]</span>
<span class="org-variable-name">fjuh</span> = 1e-<span class="org-highlight-numbers-number">8</span>*data[:,<span class="org-highlight-numbers-number">5</span>] <span class="org-comment-delimiter"># </span><span class="org-comment">uh Fast Jack Step in [m]</span>
<span class="org-variable-name">fjd</span> = 1e-<span class="org-highlight-numbers-number">8</span>*data[:,<span class="org-highlight-numbers-number">6</span>] <span class="org-comment-delimiter"># </span><span class="org-comment">d Fast Jack Step in [m]</span>
<span class="org-variable-name">time</span> = 1e-<span class="org-highlight-numbers-number">4</span>*np.arange(<span class="org-highlight-numbers-number">0</span>, np.size(bragg), <span class="org-highlight-numbers-number">1</span>) <span class="org-comment-delimiter"># </span><span class="org-comment">Time vector [s]</span>
<span class="org-variable-name">ddz</span> = <span class="org-highlight-numbers-number">10</span>.5e-<span class="org-highlight-numbers-number">3</span>/(<span class="org-highlight-numbers-number">2</span>*np.cos(bragg)) - dz; <span class="org-comment-delimiter"># </span><span class="org-comment">Z error between the two crystals [m]</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org4ddd4af" class="outline-4">
<h4 id="org4ddd4af"><span class="section-number-4">5.3.2.</span> Convert Data in the frame of the fast jack</h4>
<div class="outline-text-4" id="text-5-3-2">
<p>
The measured motion of the crystals using the interferometers are converted to the motion of the three jacks using the Jacobian matrix.
</p>
<div class="org-src-container">
<pre class="src src-jupyter-python"><span class="org-comment-delimiter"># </span><span class="org-comment">Actuator Jacobian</span>
<span class="org-variable-name">J_a_111</span> = np.array([[<span class="org-highlight-numbers-number">1</span>, <span class="org-highlight-numbers-number">0.14</span>, -<span class="org-highlight-numbers-number">0.0675</span>], [<span class="org-highlight-numbers-number">1</span>, <span class="org-highlight-numbers-number">0.14</span>, <span class="org-highlight-numbers-number">0.1525</span>], [<span class="org-highlight-numbers-number">1</span>, -<span class="org-highlight-numbers-number">0.14</span>, <span class="org-highlight-numbers-number">0.0425</span>]])
<span class="org-comment-delimiter"># </span><span class="org-comment">Computation of the position of the FJ as measured by the interferometers</span>
<span class="org-variable-name">error</span> = J_a_111 @ [ddz, dry, drx]
<span class="org-variable-name">fjur_e</span> = error[<span class="org-highlight-numbers-number">0</span>,:] <span class="org-comment-delimiter"># </span><span class="org-comment">[m]</span>
<span class="org-variable-name">fjuh_e</span> = error[<span class="org-highlight-numbers-number">1</span>,:] <span class="org-comment-delimiter"># </span><span class="org-comment">[m]</span>
<span class="org-variable-name">fjd_e</span> = error[<span class="org-highlight-numbers-number">2</span>,:] <span class="org-comment-delimiter"># </span><span class="org-comment">[m]</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org10034dc" class="outline-4">
<h4 id="org10034dc"><span class="section-number-4">5.3.3.</span> Filter Data</h4>
<div class="outline-text-4" id="text-5-3-3">
<p>
In order to get rid of external disturbances and noise, the measured fast jack displacement errors are low pass filtered.
</p>
<p>
The filter parameters are defined below.
</p>
<div class="org-src-container">
<pre class="src src-jupyter-python"><span class="org-comment-delimiter"># </span><span class="org-comment">Generate Low pass FIR Filter</span>
<span class="org-variable-name">sample_rate</span> = <span class="org-highlight-numbers-number">10000.0</span> <span class="org-comment-delimiter"># </span><span class="org-comment">Sample Rate [Hz]</span>
<span class="org-variable-name">nyq_rate</span> = sample_rate / <span class="org-highlight-numbers-number">2.0</span> <span class="org-comment-delimiter"># </span><span class="org-comment">Nyquist Rate [Hz]</span>
<span class="org-variable-name">cutoff_hz</span> = <span class="org-highlight-numbers-number">27</span> <span class="org-comment-delimiter"># </span><span class="org-comment">The cutoff frequency of the filter [Hz]</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Window with specific ripple [dB] and width [Nyquist Fraction]</span>
<span class="org-variable-name">N</span>, <span class="org-variable-name">beta</span> = kaiserord(<span class="org-highlight-numbers-number">60</span>, <span class="org-highlight-numbers-number">4</span>/nyq_rate)
<span class="org-comment-delimiter"># </span><span class="org-comment">Delay expressed in number of sample</span>
<span class="org-variable-name">N_delay</span> = <span class="org-builtin">int</span>((N-<span class="org-highlight-numbers-number">1</span>)/<span class="org-highlight-numbers-number">2</span>)
<span class="org-comment-delimiter"># </span><span class="org-comment">Delay expressed in seconds</span>
<span class="org-variable-name">delay</span> = N_delay / sample_rate
</pre>
</div>
<p>
The filter is generated using the following command:
</p>
<div class="org-src-container">
<pre class="src src-jupyter-python"><span class="org-comment-delimiter"># </span><span class="org-comment">Fitler generation</span>
<span class="org-variable-name">taps</span> = firwin(N, cutoff_hz/nyq_rate, window=(<span class="org-string">'kaiser'</span>, beta))
</pre>
</div>
<p>
This filter will introduce a constant delay that is a function of its length:
</p>
<div class="org-src-container">
<pre class="src src-jupyter-python"><span class="org-builtin">print</span>(<span class="org-string">"Length of the filter is %i\nDelay is %i samples (i.e. %.3f seconds)"</span> % (N, N_delay, delay))
</pre>
</div>
<pre class="example">
Length of the filter is 9065
Delay is 4532 samples (i.e. 0.453 seconds)
</pre>
<p>
The measured data is then filtered using the <code>lfilter</code> command.
The obtained raw and filtered data are displayed in Figure <a href="#orga617ba7">61</a>.
</p>
<div class="org-src-container">
<pre class="src src-jupyter-python"><span class="org-comment-delimiter"># </span><span class="org-comment">Filtering of data, compensation of the delay introduced by the FIR filter</span>
<span class="org-variable-name">fjur_e_filt</span> = lfilter(taps, <span class="org-highlight-numbers-number">1.0</span>, fjur_e)[<span class="org-variable-name">N</span>:]
fjuh_e_filt = lfilter(taps, <span class="org-highlight-numbers-number">1.0</span>, fjuh_e)[<span class="org-variable-name">N</span>:]
fjd_e_filt = lfilter(taps, <span class="org-highlight-numbers-number">1.0</span>, fjd_e)[<span class="org-variable-name">N</span>:]
time_filt = time[N_delay+<span class="org-highlight-numbers-number">1</span>:-N_delay]
</pre>
</div>
<p>
The measured fast jack motion (filtered) as a function of the IcePAP steps (desired position) is shown in Figure <a href="#org51c70a5">62</a> for the three fast jacks.
</p>
<div id="org0f15f5a" class="figure">
<p><img src="figs/python_pos_error_scan.png" alt="python_pos_error_scan.png" />
</p>
<p><span class="figure-number">Figure 65: </span>Measured fast jack motion as a function of the IcePAP step</p>
</div>
</div>
</div>
<div id="outline-container-org7dbe041" class="outline-4">
<h4 id="org7dbe041"><span class="section-number-4">5.3.4.</span> Get Only Interesting Data</h4>
<div class="outline-text-4" id="text-5-3-4">
<p>
Now the data corresponding to the acceleration phase are removed.
</p>
<div class="org-src-container">
<pre class="src src-jupyter-python"><span class="org-comment-delimiter"># </span><span class="org-comment">Remove the extreme part of the data corresponding to the acceleration phase</span>
<span class="org-variable-name">filt_array</span> = np.where(np.logical_or(fjd[N_delay+<span class="org-highlight-numbers-number">1</span>:-N_delay] &gt; fjd[<span class="org-highlight-numbers-number">0</span>] - <span class="org-highlight-numbers-number">0</span>.05e-<span class="org-highlight-numbers-number">3</span>, fjd[N_delay+<span class="org-highlight-numbers-number">1</span>:-N_delay] &lt; fjd[-<span class="org-highlight-numbers-number">1</span>] + <span class="org-highlight-numbers-number">0</span>.05e-<span class="org-highlight-numbers-number">3</span>))
<span class="org-variable-name">fjur_e_filt</span> = np.delete(fjur_e_filt, filt_array)
<span class="org-variable-name">fjuh_e_filt</span> = np.delete(fjuh_e_filt, filt_array)
<span class="org-variable-name">fjd_e_filt</span> = np.delete(fjd_e_filt, filt_array)
<span class="org-variable-name">time_filt</span> = np.delete(time_filt, filt_array)
<span class="org-variable-name">fjur_filt</span> = np.delete(fjur[N_delay+<span class="org-highlight-numbers-number">1</span>:-N_delay], filt_array)
<span class="org-variable-name">fjuh_filt</span> = np.delete(fjuh[N_delay+<span class="org-highlight-numbers-number">1</span>:-N_delay], filt_array)
<span class="org-variable-name">fjd_filt</span> = np.delete(fjd[ N_delay+<span class="org-highlight-numbers-number">1</span>:-N_delay], filt_array)
</pre>
</div>
</div>
</div>
<div id="outline-container-org55dad3f" class="outline-4">
<h4 id="org55dad3f"><span class="section-number-4">5.3.5.</span> New LUT creation</h4>
<div class="outline-text-4" id="text-5-3-5">
<div class="org-src-container">
<pre class="src src-jupyter-python"><span class="org-variable-name">u</span>, <span class="org-variable-name">c</span> = np.unique(fjur_filt, return_index=<span class="org-constant">True</span>)
lut_ur = np.stack((u + fjur_e_filt[c], u))
u, c = np.unique(fjuh_filt, return_index=<span class="org-constant">True</span>)
lut_uh = np.transpose(np.stack((u + fjuh_e_filt[c], u)))
u, c = np.unique(fjd_filt, return_index=<span class="org-constant">True</span>)
lut_d = np.transpose(np.stack((u + fjd_e_filt[c], u)))
</pre>
</div>
<div class="org-src-container">
<pre class="src src-jupyter-python"><span class="org-comment-delimiter"># </span><span class="org-comment">Figure - Correction made by the new LUT</span>
plt.figure(figsize=(<span class="org-highlight-numbers-number">1200</span>/<span class="org-highlight-numbers-number">150</span>, <span class="org-highlight-numbers-number">800</span>/<span class="org-highlight-numbers-number">150</span>), dpi=<span class="org-highlight-numbers-number">150</span>)
plt.clf
plt.plot(1e3*lut_ur[:,<span class="org-highlight-numbers-number">0</span>], 1e6*(lut_ur[:,<span class="org-highlight-numbers-number">1</span>] - lut_ur[:,<span class="org-highlight-numbers-number">0</span>]), <span class="org-string">'.'</span>, label=<span class="org-string">'fjur'</span>)
plt.plot(1e3*lut_uh[:,<span class="org-highlight-numbers-number">0</span>], 1e6*(lut_uh[:,<span class="org-highlight-numbers-number">1</span>] - lut_uh[:,<span class="org-highlight-numbers-number">0</span>]), <span class="org-string">'.'</span>, label=<span class="org-string">'fjuh'</span>)
plt.plot(1e3*lut_d[:,<span class="org-highlight-numbers-number">0</span>], 1e6*(lut_d[:,<span class="org-highlight-numbers-number">1</span>] - lut_d[:,<span class="org-highlight-numbers-number">0</span>]), <span class="org-string">'.'</span>, label=<span class="org-string">'fjd'</span>)
plt.xlabel(<span class="org-string">'IcePAP Step [mm]'</span>)
plt.ylabel(<span class="org-string">'Output Step [um]'</span>)
plt.legend(frameon=<span class="org-constant">True</span>)
plt.xlim([<span class="org-highlight-numbers-number">24.5</span>, <span class="org-highlight-numbers-number">24.9</span>])
plt.savefig(<span class="org-string">'figs/python_new_lut.pdf'</span>, transparent=<span class="org-constant">True</span>, bbox_inches=<span class="org-string">'tight'</span>, pad_inches=<span class="org-highlight-numbers-number">0</span>)
</pre>
</div>
<div id="org26c580b" class="figure">
<p><img src="figs/python_new_lut.png" alt="python_new_lut.png" />
</p>
<p><span class="figure-number">Figure 66: </span>Correction made by the new LUT</p>
</div>
<div class="org-src-container">
<pre class="src src-jupyter-python"><span class="org-comment-delimiter"># </span><span class="org-comment">Figure - Correction made by the new LUT</span>
plt.figure(figsize=(<span class="org-highlight-numbers-number">1200</span>/<span class="org-highlight-numbers-number">150</span>, <span class="org-highlight-numbers-number">800</span>/<span class="org-highlight-numbers-number">150</span>), dpi=<span class="org-highlight-numbers-number">150</span>)
plt.clf
plt.plot(1e3*lut_ur[:,<span class="org-highlight-numbers-number">0</span>], 1e6*(lut_ur[:,<span class="org-highlight-numbers-number">1</span>] - lut_ur[:,<span class="org-highlight-numbers-number">0</span>]), <span class="org-string">'.'</span>, label=<span class="org-string">'fjur'</span>)
plt.plot(1e3*lut[:,<span class="org-highlight-numbers-number">0</span>], 1e6*(lut[:,<span class="org-highlight-numbers-number">1</span>] - lut[:,<span class="org-highlight-numbers-number">0</span>]), <span class="org-string">'.'</span>, label=<span class="org-string">'fjur'</span>)
plt.xlabel(<span class="org-string">'IcePAP Step [mm]'</span>)
plt.ylabel(<span class="org-string">'Output Step [um]'</span>)
plt.legend(frameon=<span class="org-constant">True</span>)
plt.xlim([<span class="org-highlight-numbers-number">24.7</span>, <span class="org-highlight-numbers-number">24.71</span>])
plt.ylim([-<span class="org-highlight-numbers-number">1.4</span>, -<span class="org-highlight-numbers-number">0.8</span>])
plt.savefig(<span class="org-string">'figs/python_new_lut.pdf'</span>, transparent=<span class="org-constant">True</span>, bbox_inches=<span class="org-string">'tight'</span>, pad_inches=<span class="org-highlight-numbers-number">0</span>)
</pre>
</div>
</div>
</div>
<div id="outline-container-org1905da4" class="outline-4">
<h4 id="org1905da4"><span class="section-number-4">5.3.6.</span> LUT creation</h4>
<div class="outline-text-4" id="text-5-3-6">
<p>
Now the LUT is initialized and computed.
</p>
<div class="org-src-container">
<pre class="src src-jupyter-python"><span class="org-comment-delimiter"># </span><span class="org-comment">Distance bewteen LUT points in [m]</span>
<span class="org-variable-name">lut_inc</span> = 100e-<span class="org-highlight-numbers-number">9</span>
</pre>
</div>
<div class="org-src-container">
<pre class="src src-jupyter-python"><span class="org-comment-delimiter"># </span><span class="org-comment">Lut Initialization - First column is pos in [m]</span>
<span class="org-variable-name">lut_start</span> = lut_inc*np.floor(np.<span class="org-builtin">min</span>([[fjur_filt + fjur_e_filt], [fjuh_filt + fjuh_e_filt], [fjd_filt + fjd_e_filt]])/lut_inc)
<span class="org-variable-name">lut_end</span> = lut_inc*np.ceil(np.<span class="org-builtin">max</span>([[fjur_filt + fjur_e_filt], [fjuh_filt + fjuh_e_filt], [fjd_filt + fjd_e_filt]])/lut_inc)
<span class="org-variable-name">lut</span> = np.arange(lut_start,lut_end,lut_inc)[:, np.newaxis] @ np.ones((<span class="org-highlight-numbers-number">1</span>,<span class="org-highlight-numbers-number">4</span>))
</pre>
</div>
<div class="org-src-container">
<pre class="src src-jupyter-python"><span class="org-comment-delimiter"># </span><span class="org-comment">Build the LUT</span>
<span class="org-keyword">for</span> i <span class="org-keyword">in</span> <span class="org-builtin">range</span>(<span class="org-highlight-numbers-number">0</span>, lut.shape[<span class="org-highlight-numbers-number">0</span>]):
<span class="org-variable-name">idx</span> = (np.<span class="org-builtin">abs</span>(fjur_filt + fjur_e_filt - lut[i,<span class="org-highlight-numbers-number">0</span>])).argmin()
<span class="org-keyword">if</span> idx &gt; <span class="org-highlight-numbers-number">3</span> <span class="org-keyword">and</span> idx &lt; np.size(fjur_filt) - <span class="org-highlight-numbers-number">3</span>:
<span class="org-variable-name">lut</span>[i,<span class="org-highlight-numbers-number">1</span>] = fjur_filt[idx];
<span class="org-variable-name">idx</span> = (np.<span class="org-builtin">abs</span>(fjuh_filt + fjuh_e_filt - lut[i,<span class="org-highlight-numbers-number">0</span>])).argmin()
<span class="org-keyword">if</span> idx &gt; <span class="org-highlight-numbers-number">3</span> <span class="org-keyword">and</span> idx &lt; np.size(fjuh_filt) - <span class="org-highlight-numbers-number">3</span>:
<span class="org-variable-name">lut</span>[i,<span class="org-highlight-numbers-number">2</span>] = fjuh_filt[idx];
<span class="org-variable-name">idx</span> = (np.<span class="org-builtin">abs</span>(fjd_filt + fjd_e_filt - lut[i,<span class="org-highlight-numbers-number">0</span>])).argmin()
<span class="org-keyword">if</span> idx &gt; <span class="org-highlight-numbers-number">3</span> <span class="org-keyword">and</span> idx &lt; np.size(fjd_filt) - <span class="org-highlight-numbers-number">3</span>:
<span class="org-variable-name">lut</span>[i,<span class="org-highlight-numbers-number">3</span>] = fjd_filt[idx];
</pre>
</div>
<div class="org-src-container">
<pre class="src src-jupyter-python"><span class="org-comment-delimiter"># </span><span class="org-comment">Add points at both extremities of the LUT to make sure larger scans can be performed</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">lut = np.append(lut, np.arange(lut_end+5e-6, lut_end+50e-6, 5e-6)[:, np.newaxis] @ np.ones((1,4)), axis=0)</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">lut = np.insert(lut, 0, np.arange(lut_start-50e-6, lut_start-1e-6, 5e-6)[:, np.newaxis] @ np.ones((1,4)), axis=0)</span>
<span class="org-variable-name">lut</span> = np.append(lut, np.arange(lut_end+1e-<span class="org-highlight-numbers-number">3</span>, 30e-<span class="org-highlight-numbers-number">3</span>, 1e-<span class="org-highlight-numbers-number">3</span>)[:, np.newaxis] @ np.ones((<span class="org-highlight-numbers-number">1</span>,<span class="org-highlight-numbers-number">4</span>)), axis=<span class="org-highlight-numbers-number">0</span>)
lut = np.insert(lut, <span class="org-highlight-numbers-number">0</span>, np.arange(4e-<span class="org-highlight-numbers-number">3</span>, lut_start, 1e-<span class="org-highlight-numbers-number">3</span>)[:, np.newaxis] @ np.ones((<span class="org-highlight-numbers-number">1</span>,<span class="org-highlight-numbers-number">4</span>)), axis=<span class="org-highlight-numbers-number">0</span>)
</pre>
</div>
<p>
The computed LUT is shown in Figure <a href="#org0f4f681">63</a>.
</p>
<p>
There is a &ldquo;step&rdquo; at the extremities that will slow down the scans is the steps are within the trajectories.
</p>
<div id="org1244e81" class="figure">
<p><img src="figs/python_lut_before_normalize_ends.png" alt="python_lut_before_normalize_ends.png" />
</p>
<p><span class="figure-number">Figure 67: </span>LUT before &ldquo;normalization&rdquo; of ends</p>
</div>
<p>
In order to deal with this issue, both ends of the LUT are shifted in order to compensate this step.
</p>
<div class="org-src-container">
<pre class="src src-jupyter-python"><span class="org-comment-delimiter"># </span><span class="org-comment">Step compensation of the start of the LUT</span>
<span class="org-variable-name">i</span> = np.argmax(np.<span class="org-builtin">abs</span>(lut[:,<span class="org-highlight-numbers-number">1</span>] - lut[:,<span class="org-highlight-numbers-number">0</span>]) &gt; 100e-<span class="org-highlight-numbers-number">9</span>)
<span class="org-variable-name">ur_offset</span> = lut[i,<span class="org-highlight-numbers-number">1</span>] - lut[i,<span class="org-highlight-numbers-number">0</span>]
<span class="org-variable-name">lut</span>[<span class="org-highlight-numbers-number">0</span>:i,<span class="org-highlight-numbers-number">1</span>] = lut[<span class="org-highlight-numbers-number">0</span>:i,<span class="org-highlight-numbers-number">1</span>] + ur_offset
<span class="org-variable-name">i</span> = np.argmax(np.<span class="org-builtin">abs</span>(lut[:,<span class="org-highlight-numbers-number">2</span>] - lut[:,<span class="org-highlight-numbers-number">0</span>]) &gt; 100e-<span class="org-highlight-numbers-number">9</span>)
<span class="org-variable-name">uh_offset</span> = lut[i,<span class="org-highlight-numbers-number">2</span>] - lut[i,<span class="org-highlight-numbers-number">0</span>]
<span class="org-variable-name">lut</span>[<span class="org-highlight-numbers-number">0</span>:i,<span class="org-highlight-numbers-number">2</span>] = lut[<span class="org-highlight-numbers-number">0</span>:i,<span class="org-highlight-numbers-number">2</span>] + uh_offset
<span class="org-variable-name">i</span> = np.argmax(np.<span class="org-builtin">abs</span>(lut[:,<span class="org-highlight-numbers-number">3</span>] - lut[:,<span class="org-highlight-numbers-number">0</span>]) &gt; 100e-<span class="org-highlight-numbers-number">9</span>)
<span class="org-variable-name">d_offset</span> = lut[i,<span class="org-highlight-numbers-number">3</span>] - lut[i,<span class="org-highlight-numbers-number">0</span>]
<span class="org-variable-name">lut</span>[<span class="org-highlight-numbers-number">0</span>:i,<span class="org-highlight-numbers-number">3</span>] = lut[<span class="org-highlight-numbers-number">0</span>:i,<span class="org-highlight-numbers-number">3</span>] + d_offset
<span class="org-comment-delimiter"># </span><span class="org-comment">Step compensation of the end of the LUT</span>
<span class="org-variable-name">i</span> = np.argmax(np.<span class="org-builtin">abs</span>(lut[::-<span class="org-highlight-numbers-number">1</span>,<span class="org-highlight-numbers-number">1</span>] - lut[::-<span class="org-highlight-numbers-number">1</span>,<span class="org-highlight-numbers-number">0</span>]) &gt; 100e-<span class="org-highlight-numbers-number">9</span>)
<span class="org-variable-name">ur_offset</span> = lut[-i-<span class="org-highlight-numbers-number">1</span>,<span class="org-highlight-numbers-number">1</span>] - lut[-i-<span class="org-highlight-numbers-number">1</span>,<span class="org-highlight-numbers-number">0</span>]
<span class="org-variable-name">lut</span>[-i:,<span class="org-highlight-numbers-number">1</span>] = lut[-i:,<span class="org-highlight-numbers-number">1</span>] + ur_offset
<span class="org-variable-name">i</span> = np.argmax(np.<span class="org-builtin">abs</span>(lut[::-<span class="org-highlight-numbers-number">1</span>,<span class="org-highlight-numbers-number">2</span>] - lut[::-<span class="org-highlight-numbers-number">1</span>,<span class="org-highlight-numbers-number">0</span>]) &gt; 100e-<span class="org-highlight-numbers-number">9</span>)
<span class="org-variable-name">uh_offset</span> = lut[-i-<span class="org-highlight-numbers-number">1</span>,<span class="org-highlight-numbers-number">2</span>] - lut[-i-<span class="org-highlight-numbers-number">1</span>,<span class="org-highlight-numbers-number">0</span>]
<span class="org-variable-name">lut</span>[-i:,<span class="org-highlight-numbers-number">2</span>] = lut[-i:,<span class="org-highlight-numbers-number">2</span>] + uh_offset
<span class="org-variable-name">i</span> = np.argmax(np.<span class="org-builtin">abs</span>(lut[::-<span class="org-highlight-numbers-number">1</span>,<span class="org-highlight-numbers-number">3</span>] - lut[::-<span class="org-highlight-numbers-number">1</span>,<span class="org-highlight-numbers-number">0</span>]) &gt; 100e-<span class="org-highlight-numbers-number">9</span>)
<span class="org-variable-name">d_offset</span> = lut[-i-<span class="org-highlight-numbers-number">1</span>,<span class="org-highlight-numbers-number">3</span>] - lut[-i-<span class="org-highlight-numbers-number">1</span>,<span class="org-highlight-numbers-number">0</span>]
<span class="org-variable-name">lut</span>[-i:,<span class="org-highlight-numbers-number">3</span>] = lut[-i:,<span class="org-highlight-numbers-number">3</span>] + d_offset
</pre>
</div>
<p>
The final LUT is displayed in Figure <a href="#org7f4f0b6">64</a>.
The LUT is now smooth and trajectories larger than the LUT will be possible.
</p>
<div id="org91036a2" class="figure">
<p><img src="figs/python_lut_verif.png" alt="python_lut_verif.png" />
</p>
<p><span class="figure-number">Figure 68: </span>Figure caption</p>
</div>
<div class="org-src-container">
<pre class="src src-jupyter-python"><span class="org-comment-delimiter"># </span><span class="org-comment">Convert from [m] to [mm]</span>
<span class="org-variable-name">lut</span> = 1e3*lut;
</pre>
</div>
<p>
The LUT is saved as a <code>.dat</code> file that will be loaded into BLISS.
</p>
<div class="org-src-container">
<pre class="src src-jupyter-python"><span class="org-variable-name">filename</span> = <span class="org-string">"test_lut_python.dat"</span>
<span class="org-builtin">print</span>(f<span class="org-string">"Save LUT Table in </span>{filename}<span class="org-string">"</span>)
np.savetxt(filename, lut)
</pre>
</div>
</div>
</div>
<div id="outline-container-orgf855193" class="outline-4">
<h4 id="orgf855193"><span class="section-number-4">5.3.7.</span> Merge LUT</h4>
<div class="outline-text-4" id="text-5-3-7">
<div class="org-src-container">
<pre class="src src-jupyter-python"><span class="org-variable-name">lut_ur</span> = np.transpose(np.loadtxt(<span class="org-string">"/home/thomas/mnt/data_id21/tmp/LUT_full_new_ur.dat"</span>))
<span class="org-variable-name">lut_uh</span> = np.transpose(np.loadtxt(<span class="org-string">"/home/thomas/mnt/data_id21/tmp/LUT_full_new_uh.dat"</span>))
<span class="org-variable-name">lut_d</span> = np.transpose(np.loadtxt(<span class="org-string">"/home/thomas/mnt/data_id21/tmp/LUT_full_new_d.dat"</span>))
</pre>
</div>
<div class="org-src-container">
<pre class="src src-jupyter-python"><span class="org-variable-name">merge_1</span> = (lut_1_ur[<span class="org-highlight-numbers-number">0</span>,-<span class="org-highlight-numbers-number">1</span>]+lut_2_ur[<span class="org-highlight-numbers-number">0</span>,<span class="org-highlight-numbers-number">0</span>])/<span class="org-highlight-numbers-number">2</span>
<span class="org-variable-name">merge_2</span> = (lut_2_ur[<span class="org-highlight-numbers-number">0</span>,-<span class="org-highlight-numbers-number">1</span>]+lut_3_ur[<span class="org-highlight-numbers-number">0</span>,<span class="org-highlight-numbers-number">0</span>])/<span class="org-highlight-numbers-number">2</span>
</pre>
</div>
<div class="org-src-container">
<pre class="src src-jupyter-python"><span class="org-variable-name">lut_ur</span> = np.concatenate((
lut_1_ur[:, lut_1_ur[<span class="org-highlight-numbers-number">0</span>,:] &lt; merge_1],
lut_2_ur[:, np.logical_and(lut_2_ur[<span class="org-highlight-numbers-number">0</span>,:] &gt; merge_1, lut_2_ur[<span class="org-highlight-numbers-number">0</span>,:] &lt; merge_2)],
lut_3_ur[:, lut_3_ur[<span class="org-highlight-numbers-number">0</span>,:] &gt; merge_2]
), axis=<span class="org-highlight-numbers-number">1</span>)
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="outline-container-orgcd970e0" class="outline-2">
<h2 id="orgcd970e0"><span class="section-number-2">6.</span> Optimal Trajectory</h2>
<div class="outline-text-2" id="text-6">
<p>
<a id="orgb3f5ef4"></a>
</p>
<p>
In this section, the problem of generating an adequate trajectory to make the LUT is studied.
</p>
<p>
The problematic is the following:
</p>
<ol class="org-ol">
<li>the positioning errors of the fast jack should be measured</li>
<li>all external disturbances and measurement noise should be filtered out.</li>
</ol>
<p>
The main difficulty is that the frequency of both the positioning errors errors and the disturbances are a function of the scanning velocity.
</p>
<p>
First, the frequency of the disturbances as well as the errors to be measured are described and a filter is designed to optimally separate disturbances from positioning errors (Section <a href="#orgb3f5ef4">6</a>).
The relation between the Bragg angular velocity and fast jack velocity is studied in Section <a href="#org514c16b">6.2</a>.
Next, a trajectory with constant fast jack velocity (Section <a href="#org6655d7a">6.3</a>) and with constant Bragg angular velocity (Section <a href="#org2fadd70">6.4</a>) are simulated to understand their limitations.
Finally, it is proposed to perform a scan in two parts (one part with constant fast jack velocity and the other part with constant bragg angle velocity) in Section <a href="#orgd14bbb8">6.5</a>.
</p>
</div>
<div id="outline-container-org9d94c86" class="outline-3">
<h3 id="org9d94c86"><span class="section-number-3">6.1.</span> Filtering Disturbances and Noise</h3>
<div class="outline-text-3" id="text-6-1">
<p>
<a id="org6a12ba3"></a>
</p>
<p>
Based on measurements made in mode A (without LUT or feedback control), several disturbances could be identified:
</p>
<ul class="org-ul">
<li>vibrations coming from from the <code>mcoil</code> motor</li>
<li>vibrations with constant frequencies at 29Hz (pump), 34Hz (air conditioning) and 45Hz (un-identified)</li>
</ul>
<p>
These disturbances as well as the noise of the interferometers should be filtered out, and only the fast jack motion errors should be left untouched.
</p>
<p>
Therefore, the goal is to make a scan such that during all the scan, the frequencies of the errors induced by the fast jack have are smaller than the frequencies of all other disturbances.
Then, it is easy to use a filter to separate the disturbances and noise from the positioning errors of the fast jack.
</p>
</div>
<div id="outline-container-org9308e02" class="outline-5">
<h5 id="org9308e02"><span class="section-number-5">6.1.0.1.</span> Errors induced by the Fast Jack</h5>
<div class="outline-text-5" id="text-6-1-0-1">
<p>
The Fast Jack is composed of one stepper motor, and a planetary roller screw with a pitch of 1mm/turn.
The stepper motor as 50 pairs of magnetic poles, and therefore positioning errors are to be expected every 1/50th of turn (and its harmonics: 1/100th of turn, 1/200th of turn, etc.).
</p>
<p>
One pair of magnetic pole corresponds to an axial motion of \(20\,\mu m\).
Therefore, errors are to be expected with a period of \(20\,\mu m\) and harmonics at \(10\,\mu m\), \(5\,\mu m\), \(2.5\,\mu m\), etc.
</p>
<p>
As the LUT has one point every \(1\,\mu m\), we wish to only measure errors with a period of \(20\,\mu m\), \(10\,\mu m\) and \(5\,\mu m\).
Indeed, errors with smaller periods are small in amplitude (i.e. not worth to compensate) and are difficult to model with the limited number of points in the LUT.
</p>
<p>
The frequency corresponding to errors with a period of \(5\,\mu m\) at 1mm/s is:
</p>
<pre class="example">
Frequency or errors with period of 5um/s at 1mm/s is: 200.0 [Hz]
</pre>
<p>
We wish that the frequency of the error corresponding to a period of \(5\,\mu m\) to be smaller than the smallest disturbance to be filtered.
</p>
<p>
As the main disturbances are at 34Hz and 45Hz, we constrain the the maximum axial velocity of the Fast Jack such that the positioning error has a frequency bellow 25Hz:
</p>
<div class="org-src-container">
<pre class="src src-matlab">max_fj_vel = 25<span class="org-builtin">*</span>1e<span class="org-builtin">-</span>3<span class="org-builtin">/</span>(1e<span class="org-builtin">-</span>3<span class="org-builtin">/</span>5e<span class="org-builtin">-</span>6); <span class="org-comment-delimiter">% </span><span class="org-comment">[m/s]</span>
</pre>
</div>
<pre class="example">
Maximum Fast Jack velocity: 0.125 [mm/s]
</pre>
<div class="important" id="org0c9d500">
<p>
Therefore, the Fast Jack scans should be scanned at rather low velocity for the positioning errors to be at sufficiently low frequency.
</p>
</div>
</div>
</div>
<div id="outline-container-org8fbb27a" class="outline-5">
<h5 id="org8fbb27a"><span class="section-number-5">6.1.0.2.</span> Vibrations induced by <code>mcoil</code></h5>
<div class="outline-text-5" id="text-6-1-0-2">
<p>
The <code>mcoil</code> system is composed of one stepper motor and a reducer such that one stepper motor turns makes the <code>mcoil</code> axis to rotate 0.2768 degrees.
When scanning the <code>mcoil</code> motor, periodic vibrations can be measured by the interferometers.
</p>
<p>
It has been identified that the period of these vibrations are corresponding to the period of the magnetic poles (50 per turn as for the Fast Jack stepper motors).
</p>
<p>
Therefore, the frequency of these periodic errors are a function of the angular velocity.
With an angular velocity of 1deg/s, the frequency of the vibrations are expected to be at:
</p>
<pre class="example">
Fundamental frequency at 1deg/s: 180.6 [Hz]
</pre>
<p>
We wish the frequency of these errors to be at minimum 34Hz (smallest frequency of other disturbances).
The corresponding minimum <code>mcoil</code> velocity is:
</p>
<div class="org-src-container">
<pre class="src src-matlab">min_bragg_vel = 34<span class="org-builtin">/</span>(50<span class="org-builtin">/</span>0.2768); <span class="org-comment-delimiter">% </span><span class="org-comment">[deg/s]</span>
</pre>
</div>
<pre class="example">
Min mcoil velocity is 0.19 [deg/s]
</pre>
<div class="important" id="org2da4267">
<p>
Regarding the <code>mcoil</code> motor, the problematic is to not scan too slowly.
It should however be checked whether the amplitude of the induced vibrations is significant of not.
</p>
</div>
<p>
Note that the maximum bragg angular velocity is:
</p>
<div class="org-src-container">
<pre class="src src-matlab">max_bragg_vel = 1; <span class="org-comment-delimiter">% </span><span class="org-comment">[deg/s]</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-orgd503603" class="outline-5">
<h5 id="orgd503603"><span class="section-number-5">6.1.0.3.</span> Measurement noise of the interferometers</h5>
<div class="outline-text-5" id="text-6-1-0-3">
<p>
The motion of the fast jacks are measured by interferometers which have some measurement noise.
It is wanted to filter this noise to acceptable values to have a clean measured position.
</p>
<p>
As the interferometer noise has a rather flat spectral density, it is easy to estimate its RMS value as a function of the cut-off frequency of the filter.
</p>
<p>
The RMS value of the filtered interferometer signal as a function of the cutoff frequency of the low pass filter is computed and shown in Figure <a href="#orgf90e6e7">69</a>.
</p>
<div id="orgf90e6e7" class="figure">
<p><img src="figs/interferometer_noise_cutoff_freq.png" alt="interferometer_noise_cutoff_freq.png" />
</p>
<p><span class="figure-number">Figure 69: </span>Filtered noise RMS value as a function of the low pass filter cut-off frequency</p>
</div>
<div class="important" id="orgf593bb1">
<p>
As the filter will have a cut-off frequency between 25Hz (maximum frequency of the positioning errors) and 34Hz (minimum frequency of disturbances), a filtered measurement noise of 0.1nm RMS is to be expected.
</p>
</div>
<div class="note" id="orga2505dc">
<p>
Figure <a href="#orgf90e6e7">69</a> is a rough estimate.
Precise estimation can be done by measuring the spectral density of the interferometer noise experimentally.
</p>
</div>
</div>
</div>
<div id="outline-container-org3089049" class="outline-5">
<h5 id="org3089049"><span class="section-number-5">6.1.0.4.</span> Interferometer - Periodic non-linearity</h5>
<div class="outline-text-5" id="text-6-1-0-4">
<p>
Interferometers can also show periodic non-linearity with a (fundamental) period equal to half the wavelength of its light (i.e. 765nm for Attocube) and with unacceptable amplitudes (up to tens of nanometers).
</p>
<p>
The minimum frequency associated with these errors is therefore a function of the fast jack velocity.
With a velocity of 1mm/s, the frequency is:
</p>
<pre class="example">
Fundamental frequency at 1mm/s: 1307.2 [Hz]
</pre>
<p>
We wish these errors to be at minimum 34Hz (smallest frequency of other disturbances).
The corresponding minimum velocity of the Fast Jack is:
</p>
<div class="org-src-container">
<pre class="src src-matlab">min_fj_vel = 34<span class="org-builtin">*</span>1e<span class="org-builtin">-</span>3<span class="org-builtin">/</span>(1e<span class="org-builtin">-</span>3<span class="org-builtin">/</span>765e<span class="org-builtin">-</span>9); <span class="org-comment-delimiter">% </span><span class="org-comment">[m/s]</span>
</pre>
</div>
<pre class="example">
Minimum Fast Jack velocity is 0.026 [mm/s]
</pre>
<div class="important" id="orgf4f008f">
<p>
The Fast Jack Velocity should not be too low or the frequency of the periodic non-linearity of the interferometer would be too small to be filtered out (i.e. in the pass-band of the filter).
</p>
</div>
</div>
</div>
<div id="outline-container-orgea613b6" class="outline-5">
<h5 id="orgea613b6"><span class="section-number-5">6.1.0.5.</span> Implemented Filter</h5>
<div class="outline-text-5" id="text-6-1-0-5">
<p>
Let&rsquo;s now verify that it is possible to implement a filter that keep everything untouched below 25Hz and filters everything above 34Hz.
</p>
<p>
To do so, a FIR linear phase filter is designed:
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% FIR with Linear Phase</span>
Fs = 1e4; <span class="org-comment-delimiter">% </span><span class="org-comment">Sampling Frequency [Hz]</span>
B_fir = firls(5000, <span class="org-comment-delimiter">.</span><span class="org-comment">.. % Filter's order</span>
[0 25<span class="org-builtin">/</span>(Fs<span class="org-builtin">/</span>2) 34<span class="org-builtin">/</span>(Fs<span class="org-builtin">/</span>2) 1], <span class="org-comment-delimiter">.</span><span class="org-comment">.. % Frequencies [Hz]</span>
[1 1 0 0]); <span class="org-comment-delimiter">% </span><span class="org-comment">Wanted Magnitudes</span>
</pre>
</div>
<p>
Its amplitude response is shown in Figure <a href="#orgebb9d68">70</a>.
It is confirmed that the errors to be measured (below 25Hz) are left untouched while the disturbances above 34Hz are reduced by at least a factor \(10^4\).
</p>
<div id="orgebb9d68" class="figure">
<p><img src="figs/fir_filter_response_freq_ranges.png" alt="fir_filter_response_freq_ranges.png" />
</p>
<p><span class="figure-number">Figure 70: </span>FIR filter&rsquo;s response</p>
</div>
<p>
To have such a steep change in gain, the order of the filter is rather large.
This has the negative effect of inducing large time delays:
</p>
<pre class="example">
Induced time delay is 0.25 [s]
</pre>
<p>
This time delay is only requiring us to start the acquisition 0.25 seconds before the important part of the scan is performed (i.e. the first 0.25 seconds of data cannot be filtered).
</p>
</div>
</div>
</div>
<div id="outline-container-org3c7a43c" class="outline-3">
<h3 id="org3c7a43c"><span class="section-number-3">6.2.</span> First Estimation of the optimal trajectory</h3>
<div class="outline-text-3" id="text-6-2">
<p>
<a id="org514c16b"></a>
Based on previous analysis (Section <a href="#org6a12ba3">6.1</a>), minimum and maximum fast jack velocities and bragg angular velocities could be determined.
These values are summarized in Table <a href="#org0d9b59e">4</a>.
Therefore, if during the scan the velocities are within the defined bounds, it will be very easy to filter the data and extract only the relevant information (positioning error of the fast jack).
</p>
<table id="org0d9b59e" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<caption class="t-above"><span class="table-number">Table 4:</span> Minimum and Maximum estimated velocities</caption>
<colgroup>
<col class="org-left" />
<col class="org-right" />
<col class="org-right" />
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">&#xa0;</th>
<th scope="col" class="org-right">Min</th>
<th scope="col" class="org-right">Max</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left">Bragg Angular Velocity [deg/s]</td>
<td class="org-right">0.188</td>
<td class="org-right">1.0</td>
</tr>
<tr>
<td class="org-left">Fast Jack Velocity [mm/s]</td>
<td class="org-right">0.026</td>
<td class="org-right">0.125</td>
</tr>
</tbody>
</table>
<p>
We now wish to see if it is possible to perform a scan from 5deg to 75deg of bragg angle while keeping the velocities within the bounds in Table <a href="#org0d9b59e">4</a>.
</p>
<p>
To study that, we can compute the relation between the Bragg angular velocity and the Fast Jack velocity as a function of the Bragg angle.
</p>
<p>
To do so, we first look at the relation between the Bragg angle \(\theta_b\) and the Fast Jack position \(d_{\text{FJ}}\):
</p>
\begin{equation}
d_{FJ}(t) = d_0 - \frac{10.5 \cdot 10^{-3}}{2 \cos \theta_b(t)}
\end{equation}
<p>
with \(d_0 \approx 0.030427\,m\).
</p>
<p>
Then, by taking the time derivative, we obtain the relation between the Fast Jack velocity \(\dot{d}_{\text{FJ}}\) and the Bragg angular velocity \(\dot{\theta}_b\) as a function of the bragg angle \(\theta_b\):
</p>
\begin{equation} \label{eq:bragg_angle_formula}
\boxed{\dot{d}_{FJ}(t) = - \dot{\theta_b}(t) \cdot \frac{10.5 \cdot 10^{-3}}{2} \cdot \frac{\tan \theta_b(t)}{\cos \theta_b(t)}}
\end{equation}
<p>
The relation between the Bragg angular velocity and the Fast Jack velocity is computed for several angles starting from 5degrees up to 75 degrees and this is shown in Figure <a href="#org9a8664f">71</a>.
</p>
<div id="org9a8664f" class="figure">
<p><img src="figs/bragg_vel_fct_fj_vel.png" alt="bragg_vel_fct_fj_vel.png" />
</p>
<p><span class="figure-number">Figure 71: </span>Bragg angular velocity as a function of the fast jack velocity for several bragg angles (indicated by the colorful lines in degrees). Black dashed lines indicated minimum/maximum bragg angular velocities as well as minimum/maximum fast jack velocities</p>
</div>
<div class="important" id="org7eef720">
<p>
From Figure <a href="#org9a8664f">71</a>, it is clear that only Bragg angles from apprimately 15 to 70 degrees can be scanned by staying in the &ldquo;perfect&rdquo; zone (defined by the dashed black lines).
</p>
<p>
To scan smaller bragg angles, either the maximum bragg angular velocity should be increased or the minimum fast jack velocity decreased (accepting some periodic non-linearity to be measured).
</p>
<p>
To scan higher bragg angle, either the maximum fast jack velocity should be increased or the minimum bragg angular velocity decreased (taking the risk to have some disturbances from the <code>mcoil</code> motion in the signal).
</p>
</div>
<p>
For Bragg angles between 15 degrees and 70 degrees, several strategies can be chosen:
</p>
<ul class="org-ul">
<li>Constant Fast Jack velocity (Figure <a href="#org5e2ef5d">72</a> - Left):
<ol class="org-ol">
<li>Go from 15 degrees to 44 degrees at minimum fast jack velocity</li>
<li>Go from 44 degrees to 70 degrees at maximum fast jack velocity</li>
</ol></li>
<li>Constant Bragg angular velocity (Figure <a href="#org5e2ef5d">72</a> - Right):
<ol class="org-ol">
<li>Go from 15 degrees to 44 degrees at maximum angular velocity</li>
<li>Go from 44 to 70 degrees at minimum angular velocity</li>
</ol></li>
<li>A mixed of constant bragg angular velocity and constant fast jack velocity (Figure <a href="#org9a8664f">71</a> - Red line)
<ol class="org-ol">
<li>from 15 to 44 degrees with maximum Bragg angular velocity</li>
<li>from 44 to 70 degrees with maximum Bragg angular velocity</li>
</ol></li>
</ul>
<p>
The third option is studied in Section <a href="#org2fadd70">6.4</a>
</p>
<div id="org5e2ef5d" class="figure">
<p><img src="figs/bragg_vel_fct_fj_vel_example_traj.png" alt="bragg_vel_fct_fj_vel_example_traj.png" />
</p>
<p><span class="figure-number">Figure 72: </span>Angular velocity and fast jack velocity during two scans from 5 to 75 degrees. On the left for a scan with constant fast jack velocity. On the right for a scan with constant Bragg angular velocity.</p>
</div>
</div>
</div>
<div id="outline-container-org663fdc6" class="outline-3">
<h3 id="org663fdc6"><span class="section-number-3">6.3.</span> Constant Fast Jack Velocity</h3>
<div class="outline-text-3" id="text-6-3">
<p>
<a id="org6655d7a"></a>
</p>
<p>
In this section, a scan with constant fast jack velocity is studied.
</p>
<p>
It was shown in Section <a href="#orgb3f5ef4">6</a> that the maximum Fast Jack velocity should be 0.125mm/s in order for the frequency corresponding to the period of \(5\,\mu m\) to be smaller than 25Hz.
</p>
<p>
Let&rsquo;s generate a trajectory between 5deg and 75deg Bragg angle with constant Fast Jack velocity at 0.125mm/s.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Compute extreme fast jack position</span>
fj_max = 0.030427 <span class="org-builtin">-</span> 10.5e<span class="org-builtin">-</span>3<span class="org-builtin">/</span>(2<span class="org-builtin">*</span>cos(<span class="org-matlab-math">pi</span><span class="org-builtin">/</span>180<span class="org-builtin">*</span>5)); <span class="org-comment-delimiter">% </span><span class="org-comment">Smallest FJ position [m]</span>
fj_min = 0.030427 <span class="org-builtin">-</span> 10.5e<span class="org-builtin">-</span>3<span class="org-builtin">/</span>(2<span class="org-builtin">*</span>cos(<span class="org-matlab-math">pi</span><span class="org-builtin">/</span>180<span class="org-builtin">*</span>75)); <span class="org-comment-delimiter">% </span><span class="org-comment">Largest FJ position [m]</span>
<span class="org-matlab-cellbreak">%% Compute Fast Jack Trajectory</span>
t = 0<span class="org-builtin">:</span>0.1<span class="org-builtin">:</span>(fj_max <span class="org-builtin">-</span> fj_min)<span class="org-builtin">/</span>max_fj_vel; <span class="org-comment-delimiter">% </span><span class="org-comment">Time vector [s]</span>
fj_pos = fj_max <span class="org-builtin">-</span> t<span class="org-builtin">*</span>max_fj_vel; <span class="org-comment-delimiter">% </span><span class="org-comment">Fast Jack Position [m]</span>
<span class="org-matlab-cellbreak">%% Compute corresponding Bragg trajectory</span>
bragg_pos = acos(10.5e<span class="org-builtin">-</span>3<span class="org-builtin">./</span>(2<span class="org-builtin">*</span>(0.030427 <span class="org-builtin">-</span> fj_pos))); <span class="org-comment-delimiter">% </span><span class="org-comment">[rad]</span>
</pre>
</div>
<p>
The Fast Jack position as well as the Bragg angle are shown as a function of time in Figure <a href="#org2e2dc2b">73</a>.
</p>
<div id="org2e2dc2b" class="figure">
<p><img src="figs/trajectory_constant_fj_velocity.png" alt="trajectory_constant_fj_velocity.png" />
</p>
<p><span class="figure-number">Figure 73: </span>Trajectory with constant Fast Jack Velocity</p>
</div>
<p>
Let&rsquo;s now compute the Bragg angular velocity for this scan (Figure <a href="#orgdaf5881">74</a>).
It is shown that for large Fast Jack positions / small bragg angles, the bragg angular velocity is too large.
</p>
<div id="orgdaf5881" class="figure">
<p><img src="figs/trajectory_constant_fj_velocity_bragg_velocity.png" alt="trajectory_constant_fj_velocity_bragg_velocity.png" />
</p>
<p><span class="figure-number">Figure 74: </span>Bragg Velocity as a function of the bragg angle or fast jack position</p>
</div>
<div class="important" id="org2e23992">
<p>
Between 45 and 70 degrees, the scan can be performed with <b>constant Fast Jack velocity</b> equal to 0.125 mm/s.
</p>
</div>
</div>
</div>
<div id="outline-container-orgad7eae4" class="outline-3">
<h3 id="orgad7eae4"><span class="section-number-3">6.4.</span> Constant Bragg Angular Velocity</h3>
<div class="outline-text-3" id="text-6-4">
<p>
<a id="org2fadd70"></a>
</p>
<p>
Let&rsquo;s now study a scan with a constant Bragg angular velocity of 1deg/s.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Time vector for the Scan with constant angular velocity</span>
t = 0<span class="org-builtin">:</span>0.1<span class="org-builtin">:</span>(75 <span class="org-builtin">-</span> 5)<span class="org-builtin">/</span>max_bragg_vel; <span class="org-comment-delimiter">% </span><span class="org-comment">Time vector [s]</span>
<span class="org-matlab-cellbreak">%% Bragg angle during the scan</span>
bragg_pos = 5 <span class="org-builtin">+</span> t<span class="org-builtin">*</span>max_bragg_vel; <span class="org-comment-delimiter">% </span><span class="org-comment">Bragg Angle [deg]</span>
<span class="org-matlab-cellbreak">%% Computation of the Fast Jack Position</span>
fj_pos = 0.030427 <span class="org-builtin">-</span> 10.5e<span class="org-builtin">-</span>3<span class="org-builtin">./</span>(2<span class="org-builtin">*</span>cos(<span class="org-matlab-math">pi</span><span class="org-builtin">/</span>180<span class="org-builtin">*</span>bragg_pos)); <span class="org-comment-delimiter">% </span><span class="org-comment">FJ position [m]</span>
</pre>
</div>
<div id="org3ce97f6" class="figure">
<p><img src="figs/trajectory_constant_bragg_velocity.png" alt="trajectory_constant_bragg_velocity.png" />
</p>
<p><span class="figure-number">Figure 75: </span>Trajectory with constant Bragg angular velocity</p>
</div>
<div id="org44961a5" class="figure">
<p><img src="figs/trajectory_constant_bragg_velocity_fj_velocity.png" alt="trajectory_constant_bragg_velocity_fj_velocity.png" />
</p>
<p><span class="figure-number">Figure 76: </span>Fast Jack Velocity with a constant bragg angular velocity</p>
</div>
<div class="important" id="orgf66d316">
<p>
Between 15 and 45 degrees, the scan can be performed with a <b>constant Bragg angular velocity</b> equal to 1 deg/s.
</p>
</div>
</div>
</div>
<div id="outline-container-org05b1343" class="outline-3">
<h3 id="org05b1343"><span class="section-number-3">6.5.</span> Mixed Trajectory</h3>
<div class="outline-text-3" id="text-6-5">
<p>
<a id="orgd14bbb8"></a>
</p>
<p>
Let&rsquo;s combine a scan with constant Bragg angular velocity for small bragg angles (&lt; 44.3 deg) with a scan with constant Fast Jack velocity for large Bragg angle (&gt; 44.3 deg).
The scan is performed from 5 degrees to 75 degrees.
</p>
<p>
Parameters for the scan are defined below:
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Bragg Positions</span>
bragg_start = 5; <span class="org-comment-delimiter">% </span><span class="org-comment">Start Bragg angle [deg]</span>
bragg_mid = 44.3; <span class="org-comment-delimiter">% </span><span class="org-comment">Transition between constant FJ vel and constant Bragg vel [deg]</span>
bragg_end = 75; <span class="org-comment-delimiter">% </span><span class="org-comment">End Bragg angle [deg]</span>
<span class="org-matlab-cellbreak">%% Fast Jack Positions</span>
fj_start = 0.030427 <span class="org-builtin">-</span> 10.5e<span class="org-builtin">-</span>3<span class="org-builtin">/</span>(2<span class="org-builtin">*</span>cos(<span class="org-matlab-math">pi</span><span class="org-builtin">/</span>180<span class="org-builtin">*</span>bragg_start)); <span class="org-comment-delimiter">% </span><span class="org-comment">Start FJ position [m]</span>
fj_mid = 0.030427 <span class="org-builtin">-</span> 10.5e<span class="org-builtin">-</span>3<span class="org-builtin">/</span>(2<span class="org-builtin">*</span>cos(<span class="org-matlab-math">pi</span><span class="org-builtin">/</span>180<span class="org-builtin">*</span>bragg_mid)); <span class="org-comment-delimiter">% </span><span class="org-comment">Mid FJ position [m]</span>
fj_end = 0.030427 <span class="org-builtin">-</span> 10.5e<span class="org-builtin">-</span>3<span class="org-builtin">/</span>(2<span class="org-builtin">*</span>cos(<span class="org-matlab-math">pi</span><span class="org-builtin">/</span>180<span class="org-builtin">*</span>bragg_end)); <span class="org-comment-delimiter">% </span><span class="org-comment">End FJ position [m]</span>
<span class="org-matlab-cellbreak">%% Time vectors</span>
Ts = 0.1; <span class="org-comment-delimiter">% </span><span class="org-comment">Sampling Time [s]</span>
t_c_bragg = 0<span class="org-builtin">:</span>Ts<span class="org-builtin">:</span>(bragg_mid<span class="org-builtin">-</span>bragg_start)<span class="org-builtin">/</span>max_bragg_vel; <span class="org-comment-delimiter">% </span><span class="org-comment">Time Vector for constant bragg velocity [s]</span>
t_c_fj = Ts<span class="org-builtin">+</span>[0<span class="org-builtin">:</span>Ts<span class="org-builtin">:</span>(fj_mid<span class="org-builtin">-</span>fj_end)<span class="org-builtin">/</span>max_fj_vel]; <span class="org-comment-delimiter">% </span><span class="org-comment">Time Vector for constant Fast Jack velocity [s]</span>
</pre>
</div>
<p>
Positions for the first part of the scan at constant Bragg angular velocity are computed:
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Constant Bragg Angular Velocity</span>
bragg_c_bragg = bragg_start <span class="org-builtin">+</span> t_c_bragg<span class="org-builtin">*</span>max_bragg_vel; <span class="org-comment-delimiter">% </span><span class="org-comment">[deg]</span>
fj_c_bragg = 0.030427 <span class="org-builtin">-</span> 10.5e<span class="org-builtin">-</span>3<span class="org-builtin">./</span>(2<span class="org-builtin">*</span>cos(<span class="org-matlab-math">pi</span><span class="org-builtin">/</span>180<span class="org-builtin">*</span>bragg_c_bragg)); <span class="org-comment-delimiter">% </span><span class="org-comment">FJ position [m]</span>
</pre>
</div>
<p>
And positions for the part of the scan with constant Fast Jack Velocity are computed:
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Constant Bragg Angular Velocity</span>
fj_c_fj = fj_mid <span class="org-builtin">-</span> t_c_fj<span class="org-builtin">*</span>max_fj_vel; <span class="org-comment-delimiter">% </span><span class="org-comment">FJ position [m]</span>
bragg_c_fj = 180<span class="org-builtin">/</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>acos(10.5e<span class="org-builtin">-</span>3<span class="org-builtin">./</span>(2<span class="org-builtin">*</span>(0.030427 <span class="org-builtin">-</span> fj_c_fj))); <span class="org-comment-delimiter">% </span><span class="org-comment">[deg]</span>
</pre>
</div>
<p>
Fast Jack position as well as Bragg angle are displayed as a function of time in Figure <a href="#orgdf9eca0">77</a>.
</p>
<div id="orgdf9eca0" class="figure">
<p><img src="figs/combined_scan_trajectories.png" alt="combined_scan_trajectories.png" />
</p>
<p><span class="figure-number">Figure 77: </span>Fast jack trajectories and Bragg angular velocity during the scan</p>
</div>
<p>
The Fast Jack velocity as well as the Bragg angular velocity are shown as a function of the Bragg angle in Figure <a href="#orgb4655ba">78</a>.
</p>
<div id="orgb4655ba" class="figure">
<p><img src="figs/combined_scan_velocities.png" alt="combined_scan_velocities.png" />
</p>
<p><span class="figure-number">Figure 78: </span>Fast jack velocity and Bragg angular velocity during the scan</p>
</div>
<div class="important" id="org89eceab">
<p>
From Figure <a href="#orgb4655ba">78</a>, it is shown that the fast jack velocity as well as the bragg angular velocity are within the bounds except:
</p>
<ul class="org-ul">
<li>Below 15 degrees where the fast jack velocity is too small.
The frequency of the non-linear periodic errors of the interferometers would be at too low frequency (in the pass-band of the filter, see Figure <a href="#org9e7630b">79</a>).
One easy option is to use an interferometer without periodic non-linearity.
Another option is to increase the maximum Bragg angular velocity to 3 deg/s.</li>
<li>Above 70 degrees where the Bragg angular velocity is too small.
This may introduce low frequency disturbances induced by the <code>mcoil</code> motor that would be in the pass-band of the filter (see Figure <a href="#org9e7630b">79</a>).
It should be verified if this is indeed problematic of not.
An other way would be to scan without the <code>mcoil</code> motor at very high bragg angle.</li>
</ul>
</div>
<p>
In order to better visualize the filtering problem, the frequency of all the signals are shown as a function of the Bragg angle during the scan in Figure <a href="#org9e7630b">79</a>.
</p>
<div id="org9e7630b" class="figure">
<p><img src="figs/optimal_lut_trajectory_frequencies.png" alt="optimal_lut_trajectory_frequencies.png" />
</p>
<p><span class="figure-number">Figure 79: </span>Frequency of signals as a function of the Bragg angle and Fast Jack position</p>
</div>
</div>
</div>
</div>
<div id="outline-container-orgd3f82f7" class="outline-2">
<h2 id="orgd3f82f7"><span class="section-number-2">7.</span> Constant Fast Jack velocity</h2>
<div class="outline-text-2" id="text-7">
<p>
<a id="org6767318"></a>
</p>
<p>
A new trajectory motor <code>fjstraj</code> has been created to be able to perform scans with constant Fast Jack velocity.
</p>
<p>
As explained in Section <a href="#orgb3f5ef4">6</a>, this can help with the filtering of the data as positioning errors with periods of \(5\,\mu m\), \(10\,\mu m\) and \(20\,\mu m\) will be seen with a constant frequency in the time domain.
The frequency of these errors can be tuned by properly choosing the fast jack velocity.
</p>
</div>
<div id="outline-container-orgfba3d3d" class="outline-3">
<h3 id="orgfba3d3d"><span class="section-number-3">7.1.</span> Analysis of measured motion</h3>
<div class="outline-text-3" id="text-7-1">
<p>
In this section, a scan with constant fast jack velocity is performed and the measurements are analyzed.
</p>
<p>
The measurements data are loaded and converted to SI units (mostly meters and radians).
Bragg and Fast Jack velocity are computed and shown in Figure <a href="#org9bf7abc">80</a>.
We can see that during the scan, the fast jack velocity is constant and equal to \(0.125\,mm/s\) while the bragg velocity is increasing.
</p>
<div id="org9bf7abc" class="figure">
<p><img src="figs/constant_fj_vel_bragg_fj_vel.png" alt="constant_fj_vel_bragg_fj_vel.png" />
</p>
<p><span class="figure-number">Figure 80: </span>Bragg and Fast Jack velocity</p>
</div>
<p>
The frequency of the measured motion errors on <code>fjur</code> are computed as a function a time (spectrogram) and shown in Figure <a href="#org7700e71">81</a>.
The vibrations linked to the motion of the bragg angle (more precisely due to <code>mcoil</code> motor) are clearly observed (purple lines).
The motion errors of the fast jacks have a constant frequency.
The frequency corresponding to the error period of \(5\,\mu m\) is indicated by the dashed black line.
</p>
<div id="org7700e71" class="figure">
<p><img src="figs/constant_fj_vel_spectrogram.png" alt="constant_fj_vel_spectrogram.png" />
</p>
<p><span class="figure-number">Figure 81: </span>Spectrogram of <code>fjsuh</code> during the constant Fast Jack velocity scan. Bragg (<code>mcoil</code> motor) disturbances can clearly by seen above 150Hz and they not seems to be a problem at low Bragg velocity.</p>
</div>
<p>
The (raw) measured positions of each fast jack are displayed as a function of the wanted position (i.e. IcePAP steps) in Figure <a href="#org190e1ad">82</a>.
It is clear that there are some high frequency vibrations/disturbances that are making the relation between the measured position and the wanted position not bijective.
</p>
<div id="org190e1ad" class="figure">
<p><img src="figs/constant_fj_vel_pos_errors.png" alt="constant_fj_vel_pos_errors.png" />
</p>
<p><span class="figure-number">Figure 82: </span>IcePAP steps and measured position during the scan with constant Fast Jack velocity</p>
</div>
<p>
The data is then filtered with a sharp low pass filter that filters everything above 30Hz such that the motion errors of the fast jacks are left untouched and all other disturbances are well attenuated.
The results are shown in Figure <a href="#org2d0a460">83</a> where it is clear that the relation between the measured motion and the wanted motion is now a bijective function.
</p>
<div id="org2d0a460" class="figure">
<p><img src="figs/constant_fj_vel_pos_errors_filtered_comp_raw.png" alt="constant_fj_vel_pos_errors_filtered_comp_raw.png" />
</p>
<p><span class="figure-number">Figure 83: </span>IcePAP steps and measured position during the scan with constant Fast Jack velocity. Comparison of the raw and filtered data.</p>
</div>
<p>
If we only look at the measured position error of the fast jack (i.e. measured position minus the wanted position/IcePAP steps), we obtain the data of Figure <a href="#org6e4382f">84</a>.
</p>
<p>
The errors with a period of \(5\,\mu m\) can be clearly observed.
</p>
<div id="org6e4382f" class="figure">
<p><img src="figs/constant_fj_vel_pos_errors_filtered.png" alt="constant_fj_vel_pos_errors_filtered.png" />
</p>
<p><span class="figure-number">Figure 84: </span>Raw and filtered measured position errors during the scan with constant Fast Jack velocity</p>
</div>
</div>
</div>
<div id="outline-container-orga35bfe1" class="outline-3">
<h3 id="orga35bfe1"><span class="section-number-3">7.2.</span> LUT Creation</h3>
<div class="outline-text-3" id="text-7-2">
<p>
A Lookup Table is now computed from the filtered data with a point every \(100\,nm\) of fast jack motion.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Generate LUT</span>
createLUT(data_A, <span class="org-string">"lut/lut_const_fj_vel_12012022_1139.dat"</span>, <span class="org-string">"lut_inc"</span>, 100e<span class="org-builtin">-</span>9);
</pre>
</div>
<p>
The obtained lookup table is displayed in Figure <a href="#org9a8c544">85</a>.
</p>
<div id="org9a8c544" class="figure">
<p><img src="figs/constant_fj_vel_obtain_lut.png" alt="constant_fj_vel_obtain_lut.png" />
</p>
<p><span class="figure-number">Figure 85: </span>Obtained Lookup Table data</p>
</div>
</div>
</div>
<div id="outline-container-org36adeca" class="outline-3">
<h3 id="org36adeca"><span class="section-number-3">7.3.</span> Comparison of errors in mode A and mode B</h3>
<div class="outline-text-3" id="text-7-3">
<p>
The Lookup Table is loaded in the IcePAP and a new scan is performed.
</p>
<p>
The measured position errors of the fast jacks are compared for the scan in mode A and in mode B in Figure <a href="#org05c3c51">86</a>.
</p>
<div id="org05c3c51" class="figure">
<p><img src="figs/fj_constant_vel_comp_mode_A_B.png" alt="fj_constant_vel_comp_mode_A_B.png" />
</p>
<p><span class="figure-number">Figure 86: </span>Comparison of the measured fast jack position errors in mode A and mode B</p>
</div>
</div>
</div>
<div id="outline-container-org71c2a4c" class="outline-3">
<h3 id="org71c2a4c"><span class="section-number-3">7.4.</span> Test LUT just after making it</h3>
<div class="outline-text-3" id="text-7-4">
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Generate LUT</span>
createLUT(data_A, <span class="org-string">"matlab/lut/lut_data_const_fj_vel_14012022_1720.dat"</span>, <span class="org-string">"lut_inc"</span>, 100e<span class="org-builtin">-</span>9);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-bash">scp matlab/lut/lut_data_const_fj_vel_14012022_1720.dat opid21@lid21nano:/users/blissadm/local/beamline_configuration/DCM/CALIB/LUT/
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Load the generated LUT</span>
data_lut = importdata(<span class="org-string">"lut_data_const_fj_vel_14012022_1720.dat"</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">data_files = {
<span class="org-string">"lut_const_fj_vel_14012022_1725.dat"</span>,
<span class="org-string">"lut_const_fj_vel_14012022_1726.dat"</span>,
<span class="org-string">"lut_const_fj_vel_14012022_1727.dat"</span>,
<span class="org-string">"lut_const_fj_vel_14012022_1728.dat"</span>,
<span class="org-string">"lut_const_fj_vel_14012022_1730.dat"</span>
};
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">data_400nm = {};
<span class="org-keyword">for</span> <span class="org-variable-name"><span class="org-matlab-math">i</span></span> = <span class="org-constant">1:length(data_files)</span>
data_400nm{<span class="org-matlab-math">i</span>} = extractDatData(sprintf(<span class="org-string">"%s/21Nov/blc13420/id21/LUT_constant_fj_vel/%s"</span>, data_directory, data_files{<span class="org-matlab-math">i</span>}), <span class="org-comment-delimiter">.</span><span class="org-comment">..</span>
{<span class="org-string">"bragg"</span>, <span class="org-string">"dz"</span>, <span class="org-string">"dry"</span>, <span class="org-string">"drx"</span>, <span class="org-string">"fjur"</span>, <span class="org-string">"fjuh"</span>, <span class="org-string">"fjd"</span>}, <span class="org-comment-delimiter">.</span><span class="org-comment">..</span>
[<span class="org-matlab-math">pi</span><span class="org-builtin">/</span>180, 1e<span class="org-builtin">-</span>9, 1e<span class="org-builtin">-</span>9, 1e<span class="org-builtin">-</span>9, 1e<span class="org-builtin">-</span>8, 1e<span class="org-builtin">-</span>8, 1e<span class="org-builtin">-</span>8]);
data_400nm{<span class="org-matlab-math">i</span>}.ddz = 10.5e<span class="org-builtin">-</span>3<span class="org-builtin">./</span>(2<span class="org-builtin">*</span>cos(data_400nm{<span class="org-matlab-math">i</span>}.bragg)) <span class="org-builtin">-</span> data_400nm{<span class="org-matlab-math">i</span>}.dz;
data_400nm{<span class="org-matlab-math">i</span>}.time = 1e<span class="org-builtin">-</span>4<span class="org-builtin">*</span>[1<span class="org-builtin">:</span>1<span class="org-builtin">:</span>length(data_400nm{<span class="org-matlab-math">i</span>}.bragg)];
<span class="org-matlab-cellbreak">%% Computation of the position of the FJ as measured by the interferometers</span>
error = J_a_111 <span class="org-builtin">*</span> [data_400nm{<span class="org-matlab-math">i</span>}.ddz, data_400nm{<span class="org-matlab-math">i</span>}.dry, data_400nm{<span class="org-matlab-math">i</span>}.drx]<span class="org-builtin">'</span>;
data_400nm{<span class="org-matlab-math">i</span>}.fjur_e = error(1,<span class="org-builtin">:</span>)<span class="org-builtin">'</span>; <span class="org-comment-delimiter">% </span><span class="org-comment">[m]</span>
data_400nm{<span class="org-matlab-math">i</span>}.fjuh_e = error(2,<span class="org-builtin">:</span>)<span class="org-builtin">'</span>; <span class="org-comment-delimiter">% </span><span class="org-comment">[m]</span>
data_400nm{<span class="org-matlab-math">i</span>}.fjd_e = error(3,<span class="org-builtin">:</span>)<span class="org-builtin">'</span>; <span class="org-comment-delimiter">% </span><span class="org-comment">[m]</span>
<span class="org-matlab-cellbreak">%% Filtering all measured Fast Jack Position using the FIR filter</span>
data_400nm{<span class="org-matlab-math">i</span>}.fjur_e_filt = filter(B_fir, 1, data_400nm{<span class="org-matlab-math">i</span>}.fjur_e);
data_400nm{<span class="org-matlab-math">i</span>}.fjuh_e_filt = filter(B_fir, 1, data_400nm{<span class="org-matlab-math">i</span>}.fjuh_e);
data_400nm{<span class="org-matlab-math">i</span>}.fjd_e_filt = filter(B_fir, 1, data_400nm{<span class="org-matlab-math">i</span>}.fjd_e);
<span class="org-matlab-cellbreak">%% Compensation of the delay introduced by the FIR filter</span>
data_400nm{<span class="org-matlab-math">i</span>}.fjur_e_filt(1<span class="org-builtin">:</span>end<span class="org-builtin">-</span>delay) = data_400nm{<span class="org-matlab-math">i</span>}.fjur_e_filt(delay<span class="org-builtin">+</span>1<span class="org-builtin">:</span>end);
data_400nm{<span class="org-matlab-math">i</span>}.fjuh_e_filt(1<span class="org-builtin">:</span>end<span class="org-builtin">-</span>delay) = data_400nm{<span class="org-matlab-math">i</span>}.fjuh_e_filt(delay<span class="org-builtin">+</span>1<span class="org-builtin">:</span>end);
data_400nm{<span class="org-matlab-math">i</span>}.fjd_e_filt( 1<span class="org-builtin">:</span>end<span class="org-builtin">-</span>delay) = data_400nm{<span class="org-matlab-math">i</span>}.fjd_e_filt( delay<span class="org-builtin">+</span>1<span class="org-builtin">:</span>end);
<span class="org-keyword">end</span>
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Re-sample data to have same data points in FJUR</span>
<span class="org-keyword">for</span> <span class="org-variable-name"><span class="org-matlab-math">i</span></span> = <span class="org-constant">1:length(data_files)</span>
[data_400nm{<span class="org-matlab-math">i</span>}.fjur_e_resampl, data_400nm{<span class="org-matlab-math">i</span>}.fjur_resampl] = resample(data_400nm{<span class="org-matlab-math">i</span>}.fjur_e_filt, data_400nm{<span class="org-matlab-math">i</span>}.fjur, 1<span class="org-builtin">/</span>100e<span class="org-builtin">-</span>9);
[data_400nm{<span class="org-matlab-math">i</span>}.fjuh_e_resampl, data_400nm{<span class="org-matlab-math">i</span>}.fjuh_resampl] = resample(data_400nm{<span class="org-matlab-math">i</span>}.fjuh_e_filt, data_400nm{<span class="org-matlab-math">i</span>}.fjuh, 1<span class="org-builtin">/</span>100e<span class="org-builtin">-</span>9);
[data_400nm{<span class="org-matlab-math">i</span>}.fjd_e_resampl, data_400nm{<span class="org-matlab-math">i</span>}.fjd_resampl] = resample(data_400nm{<span class="org-matlab-math">i</span>}.fjd_e_filt, data_400nm{<span class="org-matlab-math">i</span>}.fjd, 1<span class="org-builtin">/</span>100e<span class="org-builtin">-</span>9);
<span class="org-keyword">end</span>
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Mean Motion</span>
fjur_400nm_e_mean = mean(cell2mat(cellfun(<span class="org-builtin">@</span>(x) x.fjur_e_resampl, data_400nm, <span class="org-string">"UniformOutput"</span>, <span class="org-matlab-math">false</span>)), 2);
fjuh_400nm_e_mean = mean(cell2mat(cellfun(<span class="org-builtin">@</span>(x) x.fjuh_e_resampl, data_400nm, <span class="org-string">"UniformOutput"</span>, <span class="org-matlab-math">false</span>)), 2);
fjd_400nm_e_mean = mean(cell2mat(cellfun(<span class="org-builtin">@</span>(x) x.fjd_e_resampl, data_400nm, <span class="org-string">"UniformOutput"</span>, <span class="org-matlab-math">false</span>)), 2);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Compute RMS error in mode B with LUT every 400nmm</span>
fjur_400nm_rms = 1e9<span class="org-builtin">*</span>mean(cellfun(<span class="org-builtin">@</span>(x) rms(detrend(x.fjur_e_resampl <span class="org-builtin">-</span> fjur_e_mean, 0)), data_400nm))
</pre>
</div>
<pre class="example">
FJUR = 76.2 [nm, RMS] in mode B after several minutes (1 um LUT increment)
</pre>
<p>
Repeatable Part:
</p>
<div class="org-src-container">
<pre class="src src-matlab">
</pre>
</div>
</div>
</div>
<div id="outline-container-org50e7208" class="outline-3">
<h3 id="org50e7208"><span class="section-number-3">7.5.</span> Make a LUT based on mode B</h3>
<div class="outline-text-3" id="text-7-5">
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Generate LUT</span>
createLUT(data_A, <span class="org-string">"matlab/lut/lut_data_bis_const_fj_vel_14012022_1720.dat"</span>, <span class="org-string">"lut_inc"</span>, 100e<span class="org-builtin">-</span>9);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">data_lut_1 = importdata(<span class="org-string">"lut_data_const_fj_vel_14012022_1720.dat"</span>);
data_lut_2 = importdata(<span class="org-string">"lut_data_bis_const_fj_vel_14012022_1720.dat"</span>);
</pre>
</div>
<p>
Update the LUT:
</p>
<div class="org-src-container">
<pre class="src src-matlab">fj_start = max([data_lut_1(1,1), data_lut_2(1,1)]);
fj_end = min([data_lut_1(end,1), data_lut_2(end,1)]);
fj_i_1 = data_lut_1(<span class="org-builtin">:</span>,1) <span class="org-builtin">&gt;=</span> fj_start <span class="org-builtin">&amp;</span> data_lut_1(<span class="org-builtin">:</span>,1) <span class="org-builtin">&lt;=</span> fj_end;
fj_i_2 = data_lut_2(<span class="org-builtin">:</span>,1) <span class="org-builtin">&gt;=</span> fj_start <span class="org-builtin">&amp;</span> data_lut_2(<span class="org-builtin">:</span>,1) <span class="org-builtin">&lt;=</span> fj_end;
sum(fj_i_1) <span class="org-builtin">==</span> sum(fj_i_2)
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">data_lut_merge = data_lut_1(fj_i_1, <span class="org-builtin">:</span>);
data_lut_merge(<span class="org-builtin">:</span>, 2) = data_lut_merge(<span class="org-builtin">:</span>, 2) <span class="org-builtin">+</span> (data_lut_2(fj_i_2, 2) <span class="org-builtin">-</span> data_lut_2(fj_i_2, 1));
data_lut_merge(<span class="org-builtin">:</span>, 3) = data_lut_merge(<span class="org-builtin">:</span>, 3) <span class="org-builtin">+</span> (data_lut_2(fj_i_2, 3) <span class="org-builtin">-</span> data_lut_2(fj_i_2, 1));
data_lut_merge(<span class="org-builtin">:</span>, 4) = data_lut_merge(<span class="org-builtin">:</span>, 4) <span class="org-builtin">+</span> (data_lut_2(fj_i_2, 4) <span class="org-builtin">-</span> data_lut_2(fj_i_2, 1));
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Save lut as a .dat file</span>
formatSpec = <span class="org-string">'%.18e %.18e %.18e %.18e\n'</span>;
fileID = fopen(<span class="org-string">"matlab/lut/lut_data_merge_const_fj_vel_14012022_1720.dat"</span>, <span class="org-string">'w'</span>);
fprintf(fileID, formatSpec, data_lut_merge<span class="org-builtin">'</span>);
fclose(fileID);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">data_lut_merge = importdata(<span class="org-string">"lut_data_merge_const_fj_vel_14012022_1720.dat"</span>);
</pre>
</div>
<p>
Verify if it makes things better
</p>
<div class="org-src-container">
<pre class="src src-matlab">data_files = {
<span class="org-string">"lut_const_fj_vel_14012022_1816.dat"</span>
};
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">data_it = {};
<span class="org-keyword">for</span> <span class="org-variable-name"><span class="org-matlab-math">i</span></span> = <span class="org-constant">1:length(data_files)</span>
data_it{<span class="org-matlab-math">i</span>} = extractDatData(sprintf(<span class="org-string">"%s/21Nov/blc13420/id21/LUT_constant_fj_vel/%s"</span>, data_directory, data_files{<span class="org-matlab-math">i</span>}), <span class="org-comment-delimiter">.</span><span class="org-comment">..</span>
{<span class="org-string">"bragg"</span>, <span class="org-string">"dz"</span>, <span class="org-string">"dry"</span>, <span class="org-string">"drx"</span>, <span class="org-string">"fjur"</span>, <span class="org-string">"fjuh"</span>, <span class="org-string">"fjd"</span>}, <span class="org-comment-delimiter">.</span><span class="org-comment">..</span>
[<span class="org-matlab-math">pi</span><span class="org-builtin">/</span>180, 1e<span class="org-builtin">-</span>9, 1e<span class="org-builtin">-</span>9, 1e<span class="org-builtin">-</span>9, 1e<span class="org-builtin">-</span>8, 1e<span class="org-builtin">-</span>8, 1e<span class="org-builtin">-</span>8]);
data_it{<span class="org-matlab-math">i</span>}.ddz = 10.5e<span class="org-builtin">-</span>3<span class="org-builtin">./</span>(2<span class="org-builtin">*</span>cos(data_it{<span class="org-matlab-math">i</span>}.bragg)) <span class="org-builtin">-</span> data_it{<span class="org-matlab-math">i</span>}.dz;
data_it{<span class="org-matlab-math">i</span>}.time = 1e<span class="org-builtin">-</span>4<span class="org-builtin">*</span>[1<span class="org-builtin">:</span>1<span class="org-builtin">:</span>length(data_it{<span class="org-matlab-math">i</span>}.bragg)];
<span class="org-matlab-cellbreak">%% Computation of the position of the FJ as measured by the interferometers</span>
error = J_a_111 <span class="org-builtin">*</span> [data_it{<span class="org-matlab-math">i</span>}.ddz, data_it{<span class="org-matlab-math">i</span>}.dry, data_it{<span class="org-matlab-math">i</span>}.drx]<span class="org-builtin">'</span>;
data_it{<span class="org-matlab-math">i</span>}.fjur_e = error(1,<span class="org-builtin">:</span>)<span class="org-builtin">'</span>; <span class="org-comment-delimiter">% </span><span class="org-comment">[m]</span>
data_it{<span class="org-matlab-math">i</span>}.fjuh_e = error(2,<span class="org-builtin">:</span>)<span class="org-builtin">'</span>; <span class="org-comment-delimiter">% </span><span class="org-comment">[m]</span>
data_it{<span class="org-matlab-math">i</span>}.fjd_e = error(3,<span class="org-builtin">:</span>)<span class="org-builtin">'</span>; <span class="org-comment-delimiter">% </span><span class="org-comment">[m]</span>
<span class="org-matlab-cellbreak">%% Filtering all measured Fast Jack Position using the FIR filter</span>
data_it{<span class="org-matlab-math">i</span>}.fjur_e_filt = filter(B_fir, 1, data_it{<span class="org-matlab-math">i</span>}.fjur_e);
data_it{<span class="org-matlab-math">i</span>}.fjuh_e_filt = filter(B_fir, 1, data_it{<span class="org-matlab-math">i</span>}.fjuh_e);
data_it{<span class="org-matlab-math">i</span>}.fjd_e_filt = filter(B_fir, 1, data_it{<span class="org-matlab-math">i</span>}.fjd_e);
<span class="org-matlab-cellbreak">%% Compensation of the delay introduced by the FIR filter</span>
data_it{<span class="org-matlab-math">i</span>}.fjur_e_filt(1<span class="org-builtin">:</span>end<span class="org-builtin">-</span>delay) = data_it{<span class="org-matlab-math">i</span>}.fjur_e_filt(delay<span class="org-builtin">+</span>1<span class="org-builtin">:</span>end);
data_it{<span class="org-matlab-math">i</span>}.fjuh_e_filt(1<span class="org-builtin">:</span>end<span class="org-builtin">-</span>delay) = data_it{<span class="org-matlab-math">i</span>}.fjuh_e_filt(delay<span class="org-builtin">+</span>1<span class="org-builtin">:</span>end);
data_it{<span class="org-matlab-math">i</span>}.fjd_e_filt( 1<span class="org-builtin">:</span>end<span class="org-builtin">-</span>delay) = data_it{<span class="org-matlab-math">i</span>}.fjd_e_filt( delay<span class="org-builtin">+</span>1<span class="org-builtin">:</span>end);
<span class="org-keyword">end</span>
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Re-sample data to have same data points in FJUR</span>
<span class="org-keyword">for</span> <span class="org-variable-name"><span class="org-matlab-math">i</span></span> = <span class="org-constant">1:length(data_files)</span>
[data_it{<span class="org-matlab-math">i</span>}.fjur_e_resampl, data_it{<span class="org-matlab-math">i</span>}.fjur_resampl] = resample(data_it{<span class="org-matlab-math">i</span>}.fjur_e_filt, data_it{<span class="org-matlab-math">i</span>}.fjur, 1<span class="org-builtin">/</span>100e<span class="org-builtin">-</span>9);
[data_it{<span class="org-matlab-math">i</span>}.fjuh_e_resampl, data_it{<span class="org-matlab-math">i</span>}.fjuh_resampl] = resample(data_it{<span class="org-matlab-math">i</span>}.fjuh_e_filt, data_it{<span class="org-matlab-math">i</span>}.fjuh, 1<span class="org-builtin">/</span>100e<span class="org-builtin">-</span>9);
[data_it{<span class="org-matlab-math">i</span>}.fjd_e_resampl, data_it{<span class="org-matlab-math">i</span>}.fjd_resampl] = resample(data_it{<span class="org-matlab-math">i</span>}.fjd_e_filt, data_it{<span class="org-matlab-math">i</span>}.fjd, 1<span class="org-builtin">/</span>100e<span class="org-builtin">-</span>9);
<span class="org-keyword">end</span>
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Mean Motion</span>
fjur_it_e_mean = mean(cell2mat(cellfun(<span class="org-builtin">@</span>(x) x.fjur_e_resampl, data_it, <span class="org-string">"UniformOutput"</span>, <span class="org-matlab-math">false</span>)), 2);
fjuh_it_e_mean = mean(cell2mat(cellfun(<span class="org-builtin">@</span>(x) x.fjuh_e_resampl, data_it, <span class="org-string">"UniformOutput"</span>, <span class="org-matlab-math">false</span>)), 2);
fjd_it_e_mean = mean(cell2mat(cellfun(<span class="org-builtin">@</span>(x) x.fjd_e_resampl, data_it, <span class="org-string">"UniformOutput"</span>, <span class="org-matlab-math">false</span>)), 2);
</pre>
</div>
</div>
</div>
<div id="outline-container-org1d65b2e" class="outline-3">
<h3 id="org1d65b2e"><span class="section-number-3">7.6.</span> Repeatability of stepper errors</h3>
<div class="outline-text-3" id="text-7-6">
<div class="org-src-container">
<pre class="src src-matlab">
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Computation of filters' responses</span>
[h_fir, f] = freqz(B_fir, 1, 10000, Fs);
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-orgaebc0bd" class="outline-2">
<h2 id="orgaebc0bd"><span class="section-number-2">8.</span> Effect of the number of points in the trajectory in mode B</h2>
<div class="outline-text-2" id="text-8">
<p>
<a id="org14c7f5c"></a>
</p>
<p>
The goal here is to see if the taken distance between points of the trajectory can affect the positioning accuracy of mode B.
</p>
<p>
To do so, a LUT is computed, and then several scans are performed with different distances between trajectory points.
</p>
</div>
<div id="outline-container-orgf9bc8cd" class="outline-3">
<h3 id="orgf9bc8cd"><span class="section-number-3">8.1.</span> LUT</h3>
<div class="outline-text-3" id="text-8-1">
<p>
A first trajectory is performed to compute the Lookup Table.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Generate LUT</span>
createLUT(data_A, <span class="org-string">"lut/lut_const_fj_vel_14012022_1645.dat"</span>, <span class="org-string">"lut_inc"</span>, 250e<span class="org-builtin">-</span>9);
</pre>
</div>
<p>
The obtained lookup table is displayed in Figure <a href="#org037926a">87</a>.
</p>
<div id="org037926a" class="figure">
<p><img src="figs/lut_comp_nb_points_trajectory.png" alt="lut_comp_nb_points_trajectory.png" />
</p>
<p><span class="figure-number">Figure 87: </span>Computed LUT that will be used for further tests about the effect of the number of points taken in the trajectory</p>
</div>
</div>
</div>
<div id="outline-container-orgdd5f20e" class="outline-3">
<h3 id="orgdd5f20e"><span class="section-number-3">8.2.</span> Trajectory with increment of \(1\,\mu m\)</h3>
<div class="outline-text-3" id="text-8-2">
<p>
A trajectory is loaded with 1000 points every millimeter of fast jack motion:
</p>
<div class="org-src-container">
<pre class="src src-python">tdh.lut_constant_fj_vel(<span class="org-highlight-numbers-number">15.5</span>, <span class="org-highlight-numbers-number">21.5</span>, pts_per_mm=<span class="org-highlight-numbers-number">1000</span>, use_lut=<span class="org-constant">True</span>)
</pre>
</div>
<p>
Several scans in mode B are performed and the results are shown in Figure
</p>
<div id="orgb7b0ca9" class="figure">
<p><img src="figs/fj_errors_mode_B_traj_inc_1u.png" alt="fj_errors_mode_B_traj_inc_1u.png" />
</p>
<p><span class="figure-number">Figure 88: </span>Measured position errors of the fast jacks</p>
</div>
</div>
</div>
<div id="outline-container-org83f340c" class="outline-3">
<h3 id="org83f340c"><span class="section-number-3">8.3.</span> Trajectory with increment of \(0.4\,\mu m\)</h3>
<div class="outline-text-3" id="text-8-3">
<p>
A trajectory is loaded with 2500 points every millimeter of fast jack motion:
</p>
<div class="org-src-container">
<pre class="src src-python">tdh.lut_constant_fj_vel(<span class="org-highlight-numbers-number">15.5</span>, <span class="org-highlight-numbers-number">21.5</span>, pts_per_mm=<span class="org-highlight-numbers-number">2500</span>, use_lut=<span class="org-constant">True</span>)
</pre>
</div>
<p>
The obtained errors on <code>fjur</code> are shown in Figure <a href="#orgc27af5a">89</a>.
</p>
<div id="orgc27af5a" class="figure">
<p><img src="figs/fj_errors_mode_B_traj_inc_400nm.png" alt="fj_errors_mode_B_traj_inc_400nm.png" />
</p>
<p><span class="figure-number">Figure 89: </span>Measured position errors of the fast jacks</p>
</div>
</div>
</div>
<div id="outline-container-org8a16601" class="outline-3">
<h3 id="org8a16601"><span class="section-number-3">8.4.</span> Spatial Errors - Comparison</h3>
<div class="outline-text-3" id="text-8-4">
<p>
The spatial periods of errors for the two trajectories are compared in Figure <a href="#orgfc814ee">90</a>.
Even though the trajectory with an increment of \(0.4\,\mu m\) was done after the trajectory with an increment of \(1\,\mu m\) (and therefore the errors in mode B should be higher), the errors for a period of \(5\,\mu m\) are reduced.
</p>
<p>
It should be further investigated whether using small increments for the trajectory could help reducing the \(5\,\mu m\) period errors.
</p>
<div id="orgfc814ee" class="figure">
<p><img src="figs/spatial_errors_comp_trajectory_points.png" alt="spatial_errors_comp_trajectory_points.png" />
</p>
<p><span class="figure-number">Figure 90: </span>Spectral density of the <code>fjur</code> measured position errors for both trajectories. For the errors with a spatial periods of \(5\,\mu m\), taking smaller steps in the trajectory helps reducing the errors.</p>
</div>
</div>
</div>
</div>
<div id="outline-container-org639e647" class="outline-2">
<h2 id="org639e647"><span class="section-number-2">9.</span> LUT for energy scans (XANES)</h2>
<div class="outline-text-2" id="text-9">
<p>
<a id="org1cee83a"></a>
</p>
<p>
In this section,
</p>
</div>
<div id="outline-container-orga40ac29" class="outline-3">
<h3 id="orga40ac29"><span class="section-number-3">9.1.</span> Velocities</h3>
<div class="outline-text-3" id="text-9-1">
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Scan parameters</span>
scan_name = {<span class="org-string">'P'</span>, <span class="org-string">'S'</span>, <span class="org-string">'Cl'</span>, <span class="org-string">'Cd'</span>, <span class="org-string">'Ca'</span>, <span class="org-string">'Ti'</span>, <span class="org-string">'V'</span>, <span class="org-string">'Cr'</span>, <span class="org-string">'Mn'</span>, <span class="org-string">'Fe'</span>, <span class="org-string">'Cu'</span>}; <span class="org-comment-delimiter">% </span><span class="org-comment">Element Name</span>
start_ene = 1e3<span class="org-builtin">*</span>[2.14, 2.45, 2.895, 3.52, 3.95, 4.94, 5.45, 5.98, 6.52, 7.1 , 8.98]; <span class="org-comment-delimiter">% </span><span class="org-comment">[ev]</span>
end_ene = 1e3<span class="org-builtin">*</span>[2.19, 2.55, 2.995, 3.65, 4.15, 5.1 , 5.57, 6.14, 6.75, 7.25, 9.12]; <span class="org-comment-delimiter">% </span><span class="org-comment">[ev]</span>
step_ene = [0.25, 0.25, 0.3, 0.3, 0.4, 0.4, 0.5, 0.5, 0.5, 0.5, 0.5]; <span class="org-comment-delimiter">% </span><span class="org-comment">Scan Steps [ev]</span>
dwell_time_min = 0.01; <span class="org-comment-delimiter">% </span><span class="org-comment">corresponds to max velocity [s]</span>
dwell_time_max = 0.1; <span class="org-comment-delimiter">% </span><span class="org-comment">corresponds to min velocity [s]</span>
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">dspacing = 3.13501196169967; <span class="org-comment-delimiter">% </span><span class="org-comment">[Angstrom]</span>
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Scan objects</span>
scans = {};
<span class="org-keyword">for</span> <span class="org-variable-name"><span class="org-matlab-math">i</span></span> = <span class="org-constant">1:length(start_ene)</span>
scans{<span class="org-matlab-math">i</span>}.name = scan_name{<span class="org-matlab-math">i</span>};
scans{<span class="org-matlab-math">i</span>}.traj_ene = start_ene(<span class="org-matlab-math">i</span>)<span class="org-builtin">:</span>step_ene(<span class="org-matlab-math">i</span>)<span class="org-builtin">:</span>end_ene(<span class="org-matlab-math">i</span>); <span class="org-comment-delimiter">% </span><span class="org-comment">[eV]</span>
scans{<span class="org-matlab-math">i</span>}.traj_bragg = asin(12398.4<span class="org-builtin">./</span>scans{<span class="org-matlab-math">i</span>}.traj_ene<span class="org-builtin">/</span>2<span class="org-builtin">/</span>dspacing); <span class="org-comment-delimiter">% </span><span class="org-comment">[rad]</span>
scans{<span class="org-matlab-math">i</span>}.traj_fjs = 0.030427 <span class="org-builtin">-</span> (10.5e<span class="org-builtin">-</span>3)<span class="org-builtin">./</span>(2<span class="org-builtin">*</span>cos(scans{<span class="org-matlab-math">i</span>}.traj_bragg)); <span class="org-comment-delimiter">% </span><span class="org-comment">[m]</span>
scans{<span class="org-matlab-math">i</span>}.time_slow = dwell_time_max<span class="org-builtin">*</span>0<span class="org-builtin">:</span>1<span class="org-builtin">:</span>length(scans{<span class="org-matlab-math">i</span>}.traj_ene)<span class="org-builtin">-</span>1; <span class="org-comment-delimiter">% </span><span class="org-comment">[s]</span>
scans{<span class="org-matlab-math">i</span>}.time_fast = dwell_time_min<span class="org-builtin">*</span>0<span class="org-builtin">:</span>1<span class="org-builtin">:</span>length(scans{<span class="org-matlab-math">i</span>}.traj_ene)<span class="org-builtin">-</span>1; <span class="org-comment-delimiter">% </span><span class="org-comment">[s]</span>
scans{<span class="org-matlab-math">i</span>}.vel_fast_bragg = abs([scans{<span class="org-matlab-math">i</span>}.traj_bragg(2<span class="org-builtin">:</span>end) <span class="org-builtin">-</span> scans{<span class="org-matlab-math">i</span>}.traj_bragg(1<span class="org-builtin">:</span>end<span class="org-builtin">-</span>1), 0]<span class="org-builtin">/</span>dwell_time_min); <span class="org-comment-delimiter">% </span><span class="org-comment">[rad/s]</span>
scans{<span class="org-matlab-math">i</span>}.vel_fast_fjs = abs([scans{<span class="org-matlab-math">i</span>}.traj_fjs(2<span class="org-builtin">:</span>end) <span class="org-builtin">-</span> scans{<span class="org-matlab-math">i</span>}.traj_fjs(1<span class="org-builtin">:</span>end<span class="org-builtin">-</span>1), 0]<span class="org-builtin">/</span>dwell_time_min); <span class="org-comment-delimiter">% </span><span class="org-comment">[m/s]</span>
<span class="org-keyword">end</span>
</pre>
</div>
<table id="org83847ad" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<caption class="t-above"><span class="table-number">Table 5:</span> Fast Jack Stroke and Velocity for typical experiments</caption>
<colgroup>
<col class="org-left" />
<col class="org-right" />
<col class="org-right" />
<col class="org-right" />
<col class="org-right" />
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">Scan Name</th>
<th scope="col" class="org-right">FJ min [mm]</th>
<th scope="col" class="org-right">FJ max [mm]</th>
<th scope="col" class="org-right">FJ stroke [mm]</th>
<th scope="col" class="org-right">Max FJ vel [mm/s]</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left">P</td>
<td class="org-right">16.696</td>
<td class="org-right">18.212</td>
<td class="org-right">1.516</td>
<td class="org-right">0.936</td>
</tr>
<tr>
<td class="org-left">S</td>
<td class="org-right">21.535</td>
<td class="org-right">22.112</td>
<td class="org-right">0.577</td>
<td class="org-right">0.169</td>
</tr>
<tr>
<td class="org-left">Cl</td>
<td class="org-right">23.239</td>
<td class="org-right">23.437</td>
<td class="org-right">0.198</td>
<td class="org-right">0.065</td>
</tr>
<tr>
<td class="org-left">Cd</td>
<td class="org-right">24.081</td>
<td class="org-right">24.181</td>
<td class="org-right">0.1</td>
<td class="org-right">0.025</td>
</tr>
<tr>
<td class="org-left">Ca</td>
<td class="org-right">24.362</td>
<td class="org-right">24.456</td>
<td class="org-right">0.093</td>
<td class="org-right">0.021</td>
</tr>
<tr>
<td class="org-left">Ti</td>
<td class="org-right">24.698</td>
<td class="org-right">24.731</td>
<td class="org-right">0.033</td>
<td class="org-right">0.009</td>
</tr>
<tr>
<td class="org-left">V</td>
<td class="org-right">24.793</td>
<td class="org-right">24.811</td>
<td class="org-right">0.018</td>
<td class="org-right">0.008</td>
</tr>
<tr>
<td class="org-left">Cr</td>
<td class="org-right">24.864</td>
<td class="org-right">24.882</td>
<td class="org-right">0.017</td>
<td class="org-right">0.006</td>
</tr>
<tr>
<td class="org-left">Mn</td>
<td class="org-right">24.918</td>
<td class="org-right">24.936</td>
<td class="org-right">0.019</td>
<td class="org-right">0.004</td>
</tr>
<tr>
<td class="org-left">Fe</td>
<td class="org-right">24.961</td>
<td class="org-right">24.97</td>
<td class="org-right">0.009</td>
<td class="org-right">0.003</td>
</tr>
<tr>
<td class="org-left">Cu</td>
<td class="org-right">25.045</td>
<td class="org-right">25.049</td>
<td class="org-right">0.004</td>
<td class="org-right">0.002</td>
</tr>
</tbody>
</table>
<table id="org9ff806b" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<caption class="t-above"><span class="table-number">Table 6:</span> Bragg Stroke and Velocity for typical experiments</caption>
<colgroup>
<col class="org-left" />
<col class="org-right" />
<col class="org-right" />
<col class="org-right" />
<col class="org-right" />
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">Scan Name</th>
<th scope="col" class="org-right">Bragg min [deg]</th>
<th scope="col" class="org-right">Bragg max [deg]</th>
<th scope="col" class="org-right">Bragg stroke [deg]</th>
<th scope="col" class="org-right">Max bragg vel [deg/s]</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left">P</td>
<td class="org-right">64.545</td>
<td class="org-right">67.521</td>
<td class="org-right">2.976</td>
<td class="org-right">0.719</td>
</tr>
<tr>
<td class="org-left">S</td>
<td class="org-right">50.846</td>
<td class="org-right">53.814</td>
<td class="org-right">2.968</td>
<td class="org-right">0.355</td>
</tr>
<tr>
<td class="org-left">Cl</td>
<td class="org-right">41.32</td>
<td class="org-right">43.082</td>
<td class="org-right">1.762</td>
<td class="org-right">0.247</td>
</tr>
<tr>
<td class="org-left">Cd</td>
<td class="org-right">32.804</td>
<td class="org-right">34.178</td>
<td class="org-right">1.374</td>
<td class="org-right">0.147</td>
</tr>
<tr>
<td class="org-left">Ca</td>
<td class="org-right">28.456</td>
<td class="org-right">30.04</td>
<td class="org-right">1.584</td>
<td class="org-right">0.149</td>
</tr>
<tr>
<td class="org-left">Ti</td>
<td class="org-right">22.813</td>
<td class="org-right">23.596</td>
<td class="org-right">0.783</td>
<td class="org-right">0.09</td>
</tr>
<tr>
<td class="org-left">V</td>
<td class="org-right">20.794</td>
<td class="org-right">21.274</td>
<td class="org-right">0.48</td>
<td class="org-right">0.091</td>
</tr>
<tr>
<td class="org-left">Cr</td>
<td class="org-right">18.787</td>
<td class="org-right">19.309</td>
<td class="org-right">0.522</td>
<td class="org-right">0.075</td>
</tr>
<tr>
<td class="org-left">Mn</td>
<td class="org-right">17.035</td>
<td class="org-right">17.655</td>
<td class="org-right">0.62</td>
<td class="org-right">0.062</td>
</tr>
<tr>
<td class="org-left">Fe</td>
<td class="org-right">15.828</td>
<td class="org-right">16.171</td>
<td class="org-right">0.343</td>
<td class="org-right">0.052</td>
</tr>
<tr>
<td class="org-left">Cu</td>
<td class="org-right">12.522</td>
<td class="org-right">12.721</td>
<td class="org-right">0.198</td>
<td class="org-right">0.032</td>
</tr>
</tbody>
</table>
<p>
Based on Table <a href="#org9ff806b">6</a>.
</p>
<ul class="org-ul">
<li>To work without <code>mcoil</code>, the maximum bragg stroke should be 16 degrees.
Therefore, all the scans can be performed without <code>mcoil</code>.</li>
</ul>
<p>
Frequency of \(5\mu m\) errors:
</p>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-right" />
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">Scan Name</th>
<th scope="col" class="org-right">Max freq. [Hz]</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left">P</td>
<td class="org-right">187.2</td>
</tr>
<tr>
<td class="org-left">S</td>
<td class="org-right">33.9</td>
</tr>
<tr>
<td class="org-left">Cl</td>
<td class="org-right">13.0</td>
</tr>
<tr>
<td class="org-left">Cd</td>
<td class="org-right">5.0</td>
</tr>
<tr>
<td class="org-left">Ca</td>
<td class="org-right">4.1</td>
</tr>
<tr>
<td class="org-left">Ti</td>
<td class="org-right">1.8</td>
</tr>
<tr>
<td class="org-left">V</td>
<td class="org-right">1.6</td>
</tr>
<tr>
<td class="org-left">Cr</td>
<td class="org-right">1.1</td>
</tr>
<tr>
<td class="org-left">Mn</td>
<td class="org-right">0.9</td>
</tr>
<tr>
<td class="org-left">Fe</td>
<td class="org-right">0.6</td>
</tr>
<tr>
<td class="org-left">Cu</td>
<td class="org-right">0.3</td>
</tr>
</tbody>
</table>
<p>
Estimation of maximum velocity such that the \(5\mu m\) errors are reduced by a factor 50 (i.e. the frequency of this \(5\mu m\) should be below 2Hz, see sensitivity function).
</p>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-right" />
<col class="org-right" />
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">Scan Name</th>
<th scope="col" class="org-right">Min time [s] - 2Hz</th>
<th scope="col" class="org-right">Min time [s] - 10Hz</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left">P</td>
<td class="org-right">0.9358</td>
<td class="org-right">0.1872</td>
</tr>
<tr>
<td class="org-left">S</td>
<td class="org-right">0.1695</td>
<td class="org-right">0.0339</td>
</tr>
<tr>
<td class="org-left">Cl</td>
<td class="org-right">0.0651</td>
<td class="org-right">0.013</td>
</tr>
<tr>
<td class="org-left">Cd</td>
<td class="org-right">0.0249</td>
<td class="org-right">0.005</td>
</tr>
<tr>
<td class="org-left">Ca</td>
<td class="org-right">0.0205</td>
<td class="org-right">0.0041</td>
</tr>
<tr>
<td class="org-left">Ti</td>
<td class="org-right">0.0088</td>
<td class="org-right">0.0018</td>
</tr>
<tr>
<td class="org-left">V</td>
<td class="org-right">0.0078</td>
<td class="org-right">0.0016</td>
</tr>
<tr>
<td class="org-left">Cr</td>
<td class="org-right">0.0057</td>
<td class="org-right">0.0011</td>
</tr>
<tr>
<td class="org-left">Mn</td>
<td class="org-right">0.0043</td>
<td class="org-right">0.0009</td>
</tr>
<tr>
<td class="org-left">Fe</td>
<td class="org-right">0.0032</td>
<td class="org-right">0.0006</td>
</tr>
<tr>
<td class="org-left">Cu</td>
<td class="org-right">0.0015</td>
<td class="org-right">0.0003</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="outline-container-org45aab76" class="outline-3">
<h3 id="org45aab76"><span class="section-number-3">9.2.</span> test</h3>
<div class="outline-text-3" id="text-9-2">
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Scan parameters</span>
start_ene = 1e3<span class="org-builtin">*</span>2.21; <span class="org-comment-delimiter">% </span><span class="org-comment">[ev]</span>
end_ene = 1e3<span class="org-builtin">*</span>2.23; <span class="org-comment-delimiter">% </span><span class="org-comment">[ev]</span>
step_ene = 0.2;
dwell_time_min = 0.01; <span class="org-comment-delimiter">% </span><span class="org-comment">corresponds to max velocity [s]</span>
dwell_time_max = 0.1; <span class="org-comment-delimiter">% </span><span class="org-comment">corresponds to min velocity [s]</span>
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">dspacing = 3.13501196169967; <span class="org-comment-delimiter">% </span><span class="org-comment">[Angstrom]</span>
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Scan objects</span>
traj_ene = start_ene<span class="org-builtin">:</span>step_ene<span class="org-builtin">:</span>end_ene; <span class="org-comment-delimiter">% </span><span class="org-comment">[eV]</span>
traj_bragg = asin(12398.4<span class="org-builtin">./</span>traj_ene<span class="org-builtin">/</span>2<span class="org-builtin">/</span>dspacing); <span class="org-comment-delimiter">% </span><span class="org-comment">[rad]</span>
traj_fjs = 0.030427 <span class="org-builtin">-</span> (10.5e<span class="org-builtin">-</span>3)<span class="org-builtin">./</span>(2<span class="org-builtin">*</span>cos(traj_bragg)); <span class="org-comment-delimiter">% </span><span class="org-comment">[m]</span>
time_slow = dwell_time_max<span class="org-builtin">*</span>0<span class="org-builtin">:</span>1<span class="org-builtin">:</span>length(traj_ene)<span class="org-builtin">-</span>1; <span class="org-comment-delimiter">% </span><span class="org-comment">[s]</span>
time_fast = dwell_time_min<span class="org-builtin">*</span>0<span class="org-builtin">:</span>1<span class="org-builtin">:</span>length(traj_ene)<span class="org-builtin">-</span>1; <span class="org-comment-delimiter">% </span><span class="org-comment">[s]</span>
vel_fast_bragg = abs([traj_bragg(2<span class="org-builtin">:</span>end) <span class="org-builtin">-</span> traj_bragg(1<span class="org-builtin">:</span>end<span class="org-builtin">-</span>1), 0]<span class="org-builtin">/</span>dwell_time_min); <span class="org-comment-delimiter">% </span><span class="org-comment">[rad/s]</span>
vel_fast_fjs = abs([traj_fjs(2<span class="org-builtin">:</span>end) <span class="org-builtin">-</span> traj_fjs(1<span class="org-builtin">:</span>end<span class="org-builtin">-</span>1), 0]<span class="org-builtin">/</span>dwell_time_min); <span class="org-comment-delimiter">% </span><span class="org-comment">[m/s]</span>
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-builtin">figure</span>; <span class="org-builtin">plot</span>(time_fast, 1e3<span class="org-builtin">*</span>vel_fast_fjs)
</pre>
</div>
<table id="org4fb1f1c" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<caption class="t-above"><span class="table-number">Table 7:</span> Fast Jack Stroke and Velocity for typical experiments</caption>
<colgroup>
<col class="org-left" />
<col class="org-right" />
<col class="org-right" />
<col class="org-right" />
<col class="org-right" />
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">Scan Name</th>
<th scope="col" class="org-right">FJ min [mm]</th>
<th scope="col" class="org-right">FJ max [mm]</th>
<th scope="col" class="org-right">FJ stroke [mm]</th>
<th scope="col" class="org-right">Max FJ vel [mm/s]</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left">P</td>
<td class="org-right">16.696</td>
<td class="org-right">18.212</td>
<td class="org-right">1.516</td>
<td class="org-right">0.936</td>
</tr>
<tr>
<td class="org-left">S</td>
<td class="org-right">21.535</td>
<td class="org-right">22.112</td>
<td class="org-right">0.577</td>
<td class="org-right">0.169</td>
</tr>
<tr>
<td class="org-left">Cl</td>
<td class="org-right">23.239</td>
<td class="org-right">23.437</td>
<td class="org-right">0.198</td>
<td class="org-right">0.065</td>
</tr>
<tr>
<td class="org-left">Cd</td>
<td class="org-right">24.081</td>
<td class="org-right">24.181</td>
<td class="org-right">0.1</td>
<td class="org-right">0.025</td>
</tr>
<tr>
<td class="org-left">Ca</td>
<td class="org-right">24.362</td>
<td class="org-right">24.456</td>
<td class="org-right">0.093</td>
<td class="org-right">0.021</td>
</tr>
<tr>
<td class="org-left">Ti</td>
<td class="org-right">24.698</td>
<td class="org-right">24.731</td>
<td class="org-right">0.033</td>
<td class="org-right">0.009</td>
</tr>
<tr>
<td class="org-left">V</td>
<td class="org-right">24.793</td>
<td class="org-right">24.811</td>
<td class="org-right">0.018</td>
<td class="org-right">0.008</td>
</tr>
<tr>
<td class="org-left">Cr</td>
<td class="org-right">24.864</td>
<td class="org-right">24.882</td>
<td class="org-right">0.017</td>
<td class="org-right">0.006</td>
</tr>
<tr>
<td class="org-left">Mn</td>
<td class="org-right">24.918</td>
<td class="org-right">24.936</td>
<td class="org-right">0.019</td>
<td class="org-right">0.004</td>
</tr>
<tr>
<td class="org-left">Fe</td>
<td class="org-right">24.961</td>
<td class="org-right">24.97</td>
<td class="org-right">0.009</td>
<td class="org-right">0.003</td>
</tr>
<tr>
<td class="org-left">Cu</td>
<td class="org-right">25.045</td>
<td class="org-right">25.049</td>
<td class="org-right">0.004</td>
<td class="org-right">0.002</td>
</tr>
</tbody>
</table>
<table id="org1989f60" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<caption class="t-above"><span class="table-number">Table 8:</span> Bragg Stroke and Velocity for typical experiments</caption>
<colgroup>
<col class="org-left" />
<col class="org-right" />
<col class="org-right" />
<col class="org-right" />
<col class="org-right" />
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">Scan Name</th>
<th scope="col" class="org-right">Bragg min [deg]</th>
<th scope="col" class="org-right">Bragg max [deg]</th>
<th scope="col" class="org-right">Bragg stroke [deg]</th>
<th scope="col" class="org-right">Max bragg vel [deg/s]</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left">P</td>
<td class="org-right">64.545</td>
<td class="org-right">67.521</td>
<td class="org-right">2.976</td>
<td class="org-right">0.719</td>
</tr>
<tr>
<td class="org-left">S</td>
<td class="org-right">50.846</td>
<td class="org-right">53.814</td>
<td class="org-right">2.968</td>
<td class="org-right">0.355</td>
</tr>
<tr>
<td class="org-left">Cl</td>
<td class="org-right">41.32</td>
<td class="org-right">43.082</td>
<td class="org-right">1.762</td>
<td class="org-right">0.247</td>
</tr>
<tr>
<td class="org-left">Cd</td>
<td class="org-right">32.804</td>
<td class="org-right">34.178</td>
<td class="org-right">1.374</td>
<td class="org-right">0.147</td>
</tr>
<tr>
<td class="org-left">Ca</td>
<td class="org-right">28.456</td>
<td class="org-right">30.04</td>
<td class="org-right">1.584</td>
<td class="org-right">0.149</td>
</tr>
<tr>
<td class="org-left">Ti</td>
<td class="org-right">22.813</td>
<td class="org-right">23.596</td>
<td class="org-right">0.783</td>
<td class="org-right">0.09</td>
</tr>
<tr>
<td class="org-left">V</td>
<td class="org-right">20.794</td>
<td class="org-right">21.274</td>
<td class="org-right">0.48</td>
<td class="org-right">0.091</td>
</tr>
<tr>
<td class="org-left">Cr</td>
<td class="org-right">18.787</td>
<td class="org-right">19.309</td>
<td class="org-right">0.522</td>
<td class="org-right">0.075</td>
</tr>
<tr>
<td class="org-left">Mn</td>
<td class="org-right">17.035</td>
<td class="org-right">17.655</td>
<td class="org-right">0.62</td>
<td class="org-right">0.062</td>
</tr>
<tr>
<td class="org-left">Fe</td>
<td class="org-right">15.828</td>
<td class="org-right">16.171</td>
<td class="org-right">0.343</td>
<td class="org-right">0.052</td>
</tr>
<tr>
<td class="org-left">Cu</td>
<td class="org-right">12.522</td>
<td class="org-right">12.721</td>
<td class="org-right">0.198</td>
<td class="org-right">0.032</td>
</tr>
</tbody>
</table>
<p>
Based on Table <a href="#org9ff806b">6</a>.
</p>
<ul class="org-ul">
<li>To work without <code>mcoil</code>, the maximum bragg stroke should be 16 degrees.
Therefore, all the scans can be performed without <code>mcoil</code>.</li>
</ul>
<p>
Frequency of \(5\mu m\) errors:
</p>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-right" />
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">Scan Name</th>
<th scope="col" class="org-right">Max freq. [Hz]</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left">P</td>
<td class="org-right">187.2</td>
</tr>
<tr>
<td class="org-left">S</td>
<td class="org-right">33.9</td>
</tr>
<tr>
<td class="org-left">Cl</td>
<td class="org-right">13.0</td>
</tr>
<tr>
<td class="org-left">Cd</td>
<td class="org-right">5.0</td>
</tr>
<tr>
<td class="org-left">Ca</td>
<td class="org-right">4.1</td>
</tr>
<tr>
<td class="org-left">Ti</td>
<td class="org-right">1.8</td>
</tr>
<tr>
<td class="org-left">V</td>
<td class="org-right">1.6</td>
</tr>
<tr>
<td class="org-left">Cr</td>
<td class="org-right">1.1</td>
</tr>
<tr>
<td class="org-left">Mn</td>
<td class="org-right">0.9</td>
</tr>
<tr>
<td class="org-left">Fe</td>
<td class="org-right">0.6</td>
</tr>
<tr>
<td class="org-left">Cu</td>
<td class="org-right">0.3</td>
</tr>
</tbody>
</table>
<p>
Estimation of maximum velocity such that the \(5\mu m\) errors are reduced by a factor 50 (i.e. the frequency of this \(5\mu m\) should be below 2Hz, see sensitivity function).
</p>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-right" />
<col class="org-right" />
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">Scan Name</th>
<th scope="col" class="org-right">Min time [s] - 2Hz</th>
<th scope="col" class="org-right">Min time [s] - 10Hz</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left">P</td>
<td class="org-right">0.9358</td>
<td class="org-right">0.1872</td>
</tr>
<tr>
<td class="org-left">S</td>
<td class="org-right">0.1695</td>
<td class="org-right">0.0339</td>
</tr>
<tr>
<td class="org-left">Cl</td>
<td class="org-right">0.0651</td>
<td class="org-right">0.013</td>
</tr>
<tr>
<td class="org-left">Cd</td>
<td class="org-right">0.0249</td>
<td class="org-right">0.005</td>
</tr>
<tr>
<td class="org-left">Ca</td>
<td class="org-right">0.0205</td>
<td class="org-right">0.0041</td>
</tr>
<tr>
<td class="org-left">Ti</td>
<td class="org-right">0.0088</td>
<td class="org-right">0.0018</td>
</tr>
<tr>
<td class="org-left">V</td>
<td class="org-right">0.0078</td>
<td class="org-right">0.0016</td>
</tr>
<tr>
<td class="org-left">Cr</td>
<td class="org-right">0.0057</td>
<td class="org-right">0.0011</td>
</tr>
<tr>
<td class="org-left">Mn</td>
<td class="org-right">0.0043</td>
<td class="org-right">0.0009</td>
</tr>
<tr>
<td class="org-left">Fe</td>
<td class="org-right">0.0032</td>
<td class="org-right">0.0006</td>
</tr>
<tr>
<td class="org-left">Cu</td>
<td class="org-right">0.0015</td>
<td class="org-right">0.0003</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div id="outline-container-org41393ae" class="outline-2">
<h2 id="org41393ae"><span class="section-number-2">10.</span> Merge LUT</h2>
<div class="outline-text-2" id="text-10">
</div>
<div id="outline-container-orgd63ad79" class="outline-3">
<h3 id="orgd63ad79"><span class="section-number-3">10.1.</span> Merge LUT</h3>
<div class="outline-text-3" id="text-10-1">
<div class="org-src-container">
<pre class="src src-matlab">lut_10_15 = importdata(<span class="org-string">"LUT_220202_10_to_15_1.dat"</span>);
lut_15_45 = importdata(<span class="org-string">"LUT_220202_15_to_45_1.dat"</span>);
lut_45_75 = importdata(<span class="org-string">"LUT_220202_45_to_75_1.dat"</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-comment-delimiter">% </span><span class="org-comment">[ur, uh, d]</span>
a = [25.07, 25.09, 24.92];
b = [23.06, 23.1 , 22.93];
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">cond_45_75 = lut_45_75(<span class="org-builtin">:</span>,1) <span class="org-builtin">&lt;</span> b(1);
cond_15_45 = lut_15_45(<span class="org-builtin">:</span>,1) <span class="org-builtin">&gt;</span> b(1) <span class="org-builtin">&amp;</span> lut_15_45(<span class="org-builtin">:</span>,1) <span class="org-builtin">&lt;</span> a(1);
cond_10_15 = lut_10_15(<span class="org-builtin">:</span>,1) <span class="org-builtin">&gt;</span> a(1);
cond_45_75_ur = lut_45_75(<span class="org-builtin">:</span>,1) <span class="org-builtin">&lt;</span> b(1);
cond_15_45_ur = lut_15_45(<span class="org-builtin">:</span>,1) <span class="org-builtin">&gt;</span> b(1) <span class="org-builtin">&amp;</span> lut_15_45(<span class="org-builtin">:</span>,1) <span class="org-builtin">&lt;</span> a(1);
cond_10_15_ur = lut_10_15(<span class="org-builtin">:</span>,1) <span class="org-builtin">&gt;</span> a(1);
cond_45_75_uh = lut_45_75(<span class="org-builtin">:</span>,1) <span class="org-builtin">&lt;</span> b(2);
cond_15_45_uh = lut_15_45(<span class="org-builtin">:</span>,1) <span class="org-builtin">&gt;</span> b(2) <span class="org-builtin">&amp;</span> lut_15_45(<span class="org-builtin">:</span>,1) <span class="org-builtin">&lt;</span> a(2);
cond_10_15_uh = lut_10_15(<span class="org-builtin">:</span>,1) <span class="org-builtin">&gt;</span> a(2);
cond_45_75_d = lut_45_75(<span class="org-builtin">:</span>,1) <span class="org-builtin">&lt;</span> b(3);
cond_15_45_d = lut_15_45(<span class="org-builtin">:</span>,1) <span class="org-builtin">&gt;</span> b(3) <span class="org-builtin">&amp;</span> lut_15_45(<span class="org-builtin">:</span>,1) <span class="org-builtin">&lt;</span> a(3);
cond_10_15_d = lut_10_15(<span class="org-builtin">:</span>,1) <span class="org-builtin">&gt;</span> a(3);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">lut_ind = [lut_45_75(cond_45_75, 1);
lut_15_45(cond_15_45, 1);
lut_10_15(cond_10_15, 1)];
lut_ur = [lut_45_75(cond_45_75_ur, 2);
lut_15_45(cond_15_45_ur, 2);
lut_10_15(cond_10_15_ur, 2)];
lut_uh = [lut_45_75(cond_45_75_uh, 3);
lut_15_45(cond_15_45_uh, 3);
lut_10_15(cond_10_15_uh, 3)];
lut_d = [lut_45_75(cond_45_75_d, 4);
lut_15_45(cond_15_45_d, 4);
lut_10_15(cond_10_15_d, 4)];
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">lut = [lut_ind, lut_ur, lut_uh, lut_d];
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Save lut as a .dat file</span>
formatSpec = <span class="org-string">'%.18e %.18e %.18e %.18e\n'</span>;
fileID = fopen(<span class="org-string">"LUT_220202_10_to_75_1_merged.mat"</span>, <span class="org-string">'w'</span>);
fprintf(fileID, formatSpec, lut<span class="org-builtin">'</span>);
fclose(fileID);
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: Dehaeze Thomas</p>
<p class="date">Created: 2022-02-15 mar. 14:11</p>
</div>
</body>
</html>