diff --git a/dcm-metrology.html b/dcm-metrology.html index cd27daf..92e55f1 100644 --- a/dcm-metrology.html +++ b/dcm-metrology.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + ESRF Double Crystal Monochromator - Metrology @@ -39,45 +39,51 @@

Table of Contents

@@ -87,22 +93,22 @@

In this document, the metrology system is studied. -First, in Section 1 the goal of the metrology system is stated and the proposed concept is described. +First, in Section 1 the goal of the metrology system is stated and the proposed concept is described. In order to increase the accuracy of the metrology system, two problems are to be dealt with:

-
-

1. Metrology Concept

+
+

1. Metrology Concept

- +

-The goal of the metrology system is to measure the distance and default of parallelism orientation between the first and second crystals +The goal of the metrology system is to measure the distance and default of parallelism between the first and second crystals.

@@ -114,8 +120,8 @@ Only 3 degrees of freedom are of interest:

  • \(r_x\)
  • -
    -

    1.1. Sensor Topology

    +
    +

    1.1. Sensor Topology

    In order to measure the relative pose of the two crystals, instead of performing a direct measurement which is complicated, the pose of the two crystals are measured from a metrology frame. @@ -123,7 +129,13 @@ Three interferometers are used to measured the 3dof of interest for each crystal Three additional interferometers are used to measured the relative motion of the metrology frame.

    - + +

    +In total, there are 15 interferometers represented in Figure 1. +The measurements are summarized in Table 2. +

    + +
    @@ -133,8 +145,8 @@ Three additional interferometers are used to measured the relative motion of the - - + + @@ -175,8 +187,118 @@ Three additional interferometers are used to measured the relative motion of the
    Table 1: Notations for the metrology frame
    NotationMeaningNotationMeaning
    + + -
    +
    ++ ++ ++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Table 2: List of Interferometer measurements
    NumberMeasurementDescription
    1\(z_{1r,u}\)First “Ring” Crystal, “upstream”
    2\(z_{1r,c}\)First “Ring” Crystal, “center”
    3\(z_{1r,d}\)First “Ring” Crystal, “downstream”
    4\(z_{1h,u}\)First “Hall” Crystal, “upstream”
    5\(z_{1h,c}\)First “Hall” Crystal, “center”
    6\(z_{1h,d}\)First “Hall” Crystal, “downstream”
    7\(z_{2h,u}\)Second “Hall” Crystal, “upstream”
    8\(z_{2h,c}\)Second “Hall” Crystal, “center”
    9\(z_{2h,d}\)Second “Hall” Crystal, “downstream”
    10\(z_{2r,u}\)Second “Ring” Crystal, “upstream”
    11\(z_{2r,c}\)Second “Ring” Crystal, “center”
    12\(z_{2r,d}\)Second “Ring” Crystal, “downstream”
    13\(z_{mf,u}\)Metrology Frame, “upstream”
    14\(z_{mf,dr}\)Metrology Frame, “downstream-ring”
    15\(z_{mf,dh}\)Metrology Frame, “downstream-hall”
    + + +

    metrology_schematic.png

    Figure 1: Schematic of the Metrology System

    @@ -184,326 +306,502 @@ Three additional interferometers are used to measured the relative motion of the
    -
    -

    1.2. Crystal’s motion computation

    +
    +

    1.2. Computation of the relative pose between first and second crystals

    -From the raw interferometric measurements, the pose between the first and second crystals can be computed. +To understand how the relative pose between the crystals is computed from the interferometer signals, have a look at this repository (https://gitlab.esrf.fr/dehaeze/dcm-kinematics).

    -First, Jacobian matrices can be used to convert raw interferometer measurements to axial displacement and orientation of the crystals and metrology frame. +Basically, Jacobian matrices are derived from the geometry and are used to convert the 15 interferometer signals to the relative pose of the primary and secondary crystals \([d_{h,z},\ r_{h,y},\ r_{h,x}]\) or \([d_{r,z},\ r_{r,y},\ r_{r,x}]\).

    +

    -For the 311 crystals: -

    - - - - --- -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Table 2: Table caption
    NotationDescription
    umMetrology Frame - Upstream
    dhmMetrology Frame - Downstream Hall
    drmMetrology Frame - Downstream Ring
    ur1First Crystal - Upstream Ring
    h1First Crystal - Hall
    dr1First Crystal - Downstream Ring
    ur2First Crystal - Upstream Ring
    h2First Crystal - Hall
    dr2First Crystal - Downstream Ring
    - - - - --- -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Table 3: Table caption
    NotationDescription
    dzmPositive: increase of distance
    rym 
    rxm 
    dz1Positive: decrease of distance
    ry1 
    rx1 
    dz2Positive: increase of distance
    ry2 
    rx2 
    - - -
    -

    schematic_sensor_jacobian_forward_kinematics_m.png -

    -

    Figure 2: Forward Kinematics for the Metrology frame

    -
    - - -
    -

    schematic_sensor_jacobian_forward_kinematics_1.png -

    -

    Figure 3: Forward Kinematics for the 1st crystal

    -
    - - -
    -

    schematic_sensor_jacobian_forward_kinematics_2.png -

    -

    Figure 4: Forward Kinematics for the 2nd crystal

    -
    - -

    -Then, the displacement and orientations can be combined as follows: -

    -\begin{align} - d_{z} &= + d_{z1} - d_{z2} + d_{zm} \\ - d_{r_y} &= - r_{y1} + r_{y2} - r_{ym} \\ - d_{r_x} &= - r_{x1} + r_{x2} - r_{xm} -\end{align} - -

    -Therefore: +The sign conventions for the relative crystal pose are:

      -
    • \(d_z\) represents the distance between the two crystals
    • -
    • \(d_{r_y}\) represents the rotation of the second crystal w.r.t. the first crystal around \(y\) axis
    • -
    • \(d_{r_x}\) represents the rotation of the second crystal w.r.t. the first crystal around \(x\) axis
    • +
    • An increase of \(d_{h,z}\) means the two crystals are further apart
    • +
    • An increase of \(r_{h,}\) means that the second crystals experiences a rotation around \(y\) with respect to the primary crystal
    • +
    • An increase of \(r_{h,x}\) means that the second crystals experiences a rotation around \(x\) with respect to the primary crystal
    • +
    + +
    + +

    +The relative pose can be expressed as a function of the interferometers using the Jacobian matrices for the “hall” crystals: +

    +\begin{equation} +\boxed{ +\begin{bmatrix} d_{h,z} \\ r_{h,y} \\ r_{h,x} \end{bmatrix} += +\bm{J}_{2h,s}^{-1} +\begin{bmatrix} z_{2h,u} \\ z_{2h,c} \\ z_{2h,d} \end{bmatrix} +- +\bm{J}_{1h,s}^{-1} +\begin{bmatrix} z_{1h,u} \\ z_{1h,c} \\ z_{1h,d} \end{bmatrix} +- +\bm{J}_{mf,s}^{-1} +\begin{bmatrix} z_{mf,u} \\ z_{mf,dh} \\ z_{mf,dr} \end{bmatrix} +} +\end{equation} + +

    +As well as for the “ring” crystals: +

    +\begin{equation} +\boxed{ +\begin{bmatrix} d_{r,z} \\ r_{r,y} \\ r_{r,x} \end{bmatrix} += +\bm{J}_{2r,s}^{-1} +\begin{bmatrix} z_{2r,u} \\ z_{2r,c} \\ z_{2r,d} \end{bmatrix} +- +\bm{J}_{1r,s}^{-1} +\begin{bmatrix} z_{1r,u} \\ z_{1r,c} \\ z_{1r,d} \end{bmatrix} +- +\bm{J}_{mf,s}^{-1} +\begin{bmatrix} z_{mf,u} \\ z_{mf,dr} \\ z_{mf,dr} \end{bmatrix} +} +\end{equation} + +

    +Values of the matrices can be found in the document describing the kinematics of the DCM (see https://gitlab.esrf.fr/dehaeze/dcm-kinematics). +

    +
    +
    +
    + +
    +

    2. Relation Between Crystal position and X-ray measured displacement

    +
    +

    + +

    +

    +In this section, the impact of an error in the relative pose between the first and second crystals on the output X-ray beam is studied. +

    + +

    +This is very important in order to: +

    +
      +
    • link a measurement of the x-ray beam position to a default in the crystal position
    • +
    • understand which pose default will have large impact on the output beam position/orientation
    • +
    • calibrate the deformations of the metrology frame using an external metrology measuring the x-ray beam position/orientation

    -If \(d_{r_y}\) is positive, the second crystal has a positive rotation around \(y\) w.r.t. the first crystal. -Therefore, the second crystal should be actuated such that it is making a negative rotation around \(y\) w.r.t. metrology frame. +In order to simplify the problem, the first crystal is supposed to be fixed (i.e. ideally positioned), and only the motion of the second crystal is studied.

    -The Jacobian matrices are defined as follow: +In order to easily study that, “ray tracing” techniques are used.

    -
    -
    %% Sensor Jacobian matrix for the metrology frame
    -J_m = [1,  0.102,  0
    -       1, -0.088,  0.1275
    -       1, -0.088, -0.1275];
    -
    -%% Sensor Jacobian matrix for 1st "111" crystal
    -J_s_111_1 = [-1, -0.036, -0.015
    -             -1,  0,      0.015
    -             -1,  0.036, -0.015];
    -
    -%% Sensor Jacobian matrix for 2nd "111" crystal
    -J_s_111_2 = [1,  0.07,  0.015
    -             1,  0,    -0.015
    -             1, -0.07,  0.015];
    -
    +
    +

    2.1. Definition of frame

    +
    + -

    -Therefore, the matrix that gives the relative pose of the crystal from the 9 interferometers is: -

    -
    -
    %% Compute the transformation matrix
    -G_111_t = [-inv(J_s_111_1), inv(J_s_111_2), -inv(J_m)];
    -
    -% Sign convention for the axial motion
    -G_111_t(1,:) = -G_111_t(1,:);
    -
    -
    - -
    --+-- -- -- -- -- -- -- -+ - - - - - - - - - + + - - - - - - - - - - + + + - - - - - - - - - - + + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + +
    Table 4: Transformation Matrix
     ur1 [nm]h1 [nm]dr1 [nm]ur2 [nm]h2 [nm]dr1 [nm]um [nm]dhm [nm]drm [nm]PositionOrientation
    dz [nm]-0.25-0.5-0.25-0.25-0.5-0.250.4630.2680.268input beamx1,y1,z1s1
    rx [nrad]13.8890.0-13.8897.1430.0-7.143-5.2632.6322.632primary mirrorxp,yp,zpnp
    ry [nrad]16.667-33.33316.66716.667-33.33316.6670.0-3.9223.922reflected beamx2,y2,z2s2
    secondary mirrorxs,ys,zzns
    output beamx3,y3,z3s3
    Dectectorxd,yd,zdnd
    +
      +
    • [ ] Add schematic
    • +
    +

    -From table 4, we can determine the effect of each interferometer on the estimated relative pose between the crystals. -For instance, an error on dr1 will have much greater impact on ry than an error on drm. +Notations for the pose of the output beam: d_b_y, d_b_z, r_b_y, r_b_z. +

    + +

    +\(d_{b,y}, d_{b,z}, r_{b,y}, r_{b,z}\) +

    + +

    +The xy position of the beam is taken in the \(x=0\) plane.

    + +
    +

    2.2. Effect of an error in crystal’s distance

    +
    +

    + +

    + +

    +In Figure 2 is shown the light path for three bragg angles (5, 55 and 85 degrees) when there is an error in the dz position of 1mm. +

    + +

    +Visually, it is clear that this induce a z offset of the output beam. +

    + + +
    +

    ray_tracing_error_dz_overview.png +

    +

    Figure 2: Visual Effect of an error in dz (1mm). Side view.

    -
    -

    2. Relation Between Crystal position and X-ray measured displacement

    -
    -
    -
    -

    2.1. Setup

    -
    +

    +The motion of the output beam is displayed as a function of the Bragg angle in Figure 3. +It is clear that an error in the distance dz between the crystals only induce a z offset of the output beam. +This offset decreases with the Bragg angle. +

    -
    +

    +This is indeed equal to: +

    +\begin{equation} +\boxed{d_{b,z} = 2 d_z \cos \theta} +\end{equation} + + +
    +

    motion_beam_dz_error.png +

    +

    Figure 3: Motion of the output beam with dZ error

    +
    +
    +
    + +
    +

    2.3. Effect of an error in crystal’s x parallelism

    +
    +

    + +

    + +

    +The effect of an error in rx crystal parallelism on the output beam is visually shown in Figure 4 for three bragg angles (5, 55 and 85 degrees). +The error is set to one degree, and the top view is shown. +It is clear that the output beam experiences some rotation around a vertical axis. +The amount of rotation depends on the bragg angle. +

    + + +
    +

    ray_tracing_error_drx_overview.png +

    +

    Figure 4: Visual Effect of an error in drx (1 degree). Top View.

    +
    + +

    +The effect of drx as a function of the Bragg angle on the output beam pose is computed and shown in Figure 5. +

    + +

    +It induces a rotation of the output beam in the z direction that depends on the Bragg Angle. +It is starting at zero for small bragg angles, and it increases with the bragg angle up to 2 times drx. +This is indeed equal to: +

    +\begin{equation} +\boxed{r_{b,z} = 2 r_x \cos \theta} +\end{equation} + +

    +If also induces a small \(y\) shift of the beam. +This shift is due to the fact that the rotation point (around which the second crystal is moved) is changing as a function of bragg. +We can note that the \(y\) shift is equal to zero for a bragg angle of 45 degrees, at which point the center of rotation of the second crystal is at \(x = 0\); +

    + + +
    +

    motion_beam_drx_error.png +

    +

    Figure 5: Motion of the output beam with drx error

    +
    +
    +
    + +
    +

    2.4. Effect of an error in crystal’s y parallelism

    +
    +

    + +

    + +

    +The effect of an error in ry crystal parallelism on the output beam is visually shown in Figure 6 for three bragg angles (5, 55 and 85 degrees). +

    + + +
    +

    ray_tracing_error_dry_overview.png +

    +

    Figure 6: Visual Effect of an error in dry (1 degree). Side view.

    +
    + +

    +The effect of dry as a function of the Bragg angle on the output beam pose is computed and shown in Figure 7. +It is clear that this induces a rotation of the output beam in the y direction equals to 2 times dry: +

    +\begin{equation} +\boxed{r_{b,z} = 2 r_z} +\end{equation} + +

    +It also induces a small vertical motion of the beam (at the \(x=0\) location) which is simply due to the fact that the \(x\) coordinate of the impact point on the second crystal changes with the Bragg angle. +

    + + +
    +

    motion_beam_dry_error.png +

    +

    Figure 7: Motion of the output beam with dry error

    +
    +
    +
    + +
    +

    2.5. Summary

    +
    +

    +Effects of crystal’s pose errors on the output beam are summarized in Table 3. +Note that the three pose errors are well decoupled regarding their effects on the output beam. +Also note that the effect of an error in crystal’s distance does not depend on the Bragg angle. +

    + + + + +++ ++ ++ ++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Table 3: Summary of the effects of the errors in second crystal’s pose on the output beam
    Beam MotionCrystal \(d_z\)Crystal \(r_x\)Crystal \(r_y\)
    \(d_{b,y}\)0\(\approx 0\)0
    \(d_{b,z}\)\(\boxed{d_{z} 2 \cos(\theta)}\)0\(\approx 0\)
    \(r_{b,y}\)00\(\boxed{2 r_{y}}\)
    \(r_{b,z}\)0\(\boxed{- r_x 2 \sin(\theta)}\)0
    +
    +
    + +
    +

    2.6. “Channel cut” Scan

    +
    +

    +A “channel cut” scan is a Bragg scan where the distance between the crystals is fixed. +

    + +

    +This is visually shown in Figure 8 where it is clear that the output beam experiences some vertical motion. +

    + + +
    +

    ray_tracing_channel_cut.png +

    +

    Figure 8: Visual Effect of a channel cut scan

    +
    + +

    +The \(z\) offset of the beam for several channel cut scans are shown in Figure 9. +

    + + +
    +

    channel_cut_scan.png +

    +

    Figure 9: Z motion of the beam during “channel cut” scans

    +
    +
    +
    +
    + +
    +

    3. Determining relative pose between the crystals using the X-ray

    +
    +

    +As Interferometers are only measuring relative displacement, it is mandatory to initialize them correctly. +

    + +

    +They should be initialize in such a way that: +

    +
      +
    • \(r_x = 0\) and \(r_y = 0\) when the two crystallographic planes are parallel
    • +
    • measured \(d_z\) is equal to the distance between the crystallographic planes
    • +
    + +

    +In order to do that, an external metrology using the x-ray is used. +

    +
    + +
    +

    3.1. Determine the \(y\) parallelism - “Rocking Curve”

    +
    + +
    +

    3.2. Determine the \(x\) parallelism - Bragg Scan

    +
    + + +
    +

    3.3. Determine the \(z\) distance - Bragg Scan

    +
    + +
    +

    3.4. Use Channel cut scan to determine crystal dry parallelism

    +
    +

    +Now, let’s suppose we want to determine the dry angle between the crystals. +

    + +
    +
    dry = 1e-6; % [rad]
    +
    +
    + +

    +The error is +

    +\begin{equation} +\boxed{d_{b,z} = -2 d_z \cos()} +\end{equation} +
    +
    + +
    +

    3.5. Effect of an error on Bragg angle

    +
    +
    + +
    +

    4. Deformations of the Metrology Frame

    +
    +

    + +

    +

    +The transformation matrices are valid only if the metrology frames are solid bodies. +

    + +

    +The metrology frame itself is experiencing some deformations due to the gravity. +When the bragg axis is scanned, the effect of gravity on the metrology frame is changing and this introduce some measurement errors. +

    + +

    +This can be calibrated. +

    +
    +
    +

    4.1. Measurement Setup

    +
    +

    +Two beam viewers: +

    +
      +
    • one close to the DCM to measure position of the beam
    • +
    • one far away to the DCM to measure orientation of the beam
    • +
    + +

    +For each Bragg angle, the Fast Jacks are actuated to that the beam is at the center of the beam viewer. +Then, then position of the crystals as measured by the interferometers is recorded. +This position is the wanted position for a given Bragg angle. +

    + + +

    calibration_setup.png

    -

    Figure 5: Schematic of the setup

    +

    Figure 10: Schematic of the setup

    @@ -529,104 +827,10 @@ Frame rate is: 42 fps

    -
    -

    2.2. Relation between second crystal motion and beam motion

    -
    -
    -
    -

    2.2.1. Axial motion of second crystal

    -
    -

    -Let’s consider the relation between the \([y, z]\) motion of the beam and the motion of the second crystal \([z^\prime, R_{y^\prime}, R_{x^\prime}]\). -

    - -
    -

    relation_dz_output_beam.png -

    -

    Figure 6: Relation between \(d_{z^\prime}\) motion of the second crystal and vertical motion of the beam

    -
    - -\begin{equation} - d_z = d_{z^\prime} 2 \cos \theta -\end{equation} - - -
    -

    relation_vert_motion_crystal_beam.png -

    -

    Figure 7: Relation between vertical motion of the second crystal and vertical motion of the output beam

    -
    -
    -
    - -
    -

    2.2.2. Ry motion of second crystal

    -
    -\begin{equation} -d_z = D_{\text{vlm}} d_{R_y^\prime} -\end{equation} - -

    -with \(D_{\text{vlm}} \approx 10\,m\). -

    -
    -
    - -
    -

    2.2.3. Rx motion of second crystal

    -
    -\begin{equation} -d_y = 2 D_{\text{vlm}} \sin \theta \cdot d_{R_x^\prime} -\end{equation} -
    -
    -
    -
    - - - -
    -

    3. Deformations of the Metrology Frame

    -
    -

    - -

    -

    -The transformation matrix in Table 4 is valid only if the metrology frames are solid bodies. -

    - -

    -The metrology frame itself is experiencing some deformations due to the gravity. -When the bragg axis is scanned, the effect of gravity on the metrology frame is changing and this introduce some measurement errors. -

    - -

    -This can be calibrated. -

    -
    -
    -

    3.1. Measurement Setup

    -
    -

    -Two beam viewers: -

    -
      -
    • one close to the DCM to measure position of the beam
    • -
    • one far away to the DCM to measure orientation of the beam
    • -
    - -

    -For each Bragg angle, the Fast Jacks are actuated to that the beam is at the center of the beam viewer. -Then, then position of the crystals as measured by the interferometers is recorded. -This position is the wanted position for a given Bragg angle. -

    -
    -
    - -
    -

    3.2. Simulations

    -
    +
    +

    4.2. Simulations

    +

    The deformations of the metrology frame and therefore the expected interferometric measurements can be computed as a function of the Bragg angle. This may be done using FE software. @@ -634,13 +838,13 @@ This may be done using FE software.

    -
    -

    3.3. Comparison

    +
    +

    4.3. Comparison

    -
    -

    3.4. Test

    -
    +
    +

    4.4. Test

    +
    aa = importdata("correctInterf-vlm-220201.dat");
     
    @@ -654,9 +858,9 @@ This may be done using FE software.
    -
    -

    3.5. Measured frame deformation

    -
    +
    +

    4.5. Measured frame deformation

    +
    data = table2array(readtable('itf_polynom.csv','NumHeaderLines',1));
     th = pi/180*data(:,1); % [rad]
    @@ -683,10 +887,10 @@ ry1 = 1e-9*dat
     
    -
    +

    calibration_drx_pres.png

    -

    Figure 8: description

    +

    Figure 11: description

    @@ -756,9 +960,9 @@ f_ry1 = fit(180/p
    -
    -

    3.6. Test

    -
    +
    +

    4.6. Test

    +
    filename = "/home/thomas/mnt/data_id21/22Jan/blc13550/id21/test_xtal1_interf/test_xtal1_interf_0001/test_xtal1_interf_0001.h5";
     
    @@ -789,10 +993,10 @@ data.xtal2_111_d = double(h5read(filename, '/7.1/instru
    -
    +

    drifts_xtal2_detrend.png

    -

    Figure 9: Drifts of the second crystal as a function of Bragg Angle

    +

    Figure 12: Drifts of the second crystal as a function of Bragg Angle

    @@ -806,9 +1010,9 @@ data.xtal2_111_d = double(h5read(filename, '/7.1/instru
    -
    -

    3.7. Repeatability of frame deformation

    -
    +
    +

    4.7. Repeatability of frame deformation

    +
    filename = "/home/thomas/mnt/data_id21/22Jan/blc13550/id21/test_xtal1_interf/test_xtal1_interf_0001/test_xtal1_interf_0001.h5";
     
    @@ -857,15 +1061,15 @@ data_2.dz = 1e-9*<
    -
    -

    4. Attocube - Periodic Non-Linearity

    -
    +
    +

    5. Attocube - Periodic Non-Linearity

    +

    - +

    -Interferometers have some periodic nonlinearity (Thurner et al., 2015). -The period is a fraction of the wavelength (usually \(\lambda/2\)) and can be due to polarization mixing, non perfect alignment of the optical components and unwanted reflected beams (See Ducourtieux, 2018, p. 67 to 69; Thurner et al., 2015). +Interferometers have some periodic nonlinearity (NO_ITEM_DATA:thurner15_fiber_based_distan_sensin_inter). +The period is a fraction of the wavelength (usually \(\lambda/2\)) and can be due to polarization mixing, non perfect alignment of the optical components and unwanted reflected beams (See NO_ITEM_DATA:ducourtieux18_towar_high_precis_posit_contr, NO_ITEM_DATA:thurner15_fiber_based_distan_sensin_inter). The amplitude of the nonlinearity can vary from a fraction of a nanometer to tens of nanometers.

    @@ -882,9 +1086,9 @@ This process is performed over several periods in order to characterize the erro

    -
    -

    4.1. Measurement Setup

    -
    +
    +

    5.1. Measurement Setup

    +

    The metrology that will be compared with the interferometers are the strain gauges incorporated in the PI piezoelectric stacks.

    @@ -894,7 +1098,7 @@ It is here supposed that the measured displacement by the strain gauges are conv It is also supposed that we are at a certain Bragg angle, and that the stepper motors are not moving: only the piezoelectric actuators are used.

    -
    +

    Note that the strain gauges are measuring the relative displacement of the piezoelectric stacks while the interferometers are measuring the relative motion between the second crystals and the metrology frame.

    @@ -910,7 +1114,7 @@ As any deformations of the metrology frame of deformation of the crystal’s

    -The setup is schematically with the block diagram in Figure 10. +The setup is schematically with the block diagram in Figure 13.

    @@ -926,10 +1130,10 @@ The PI controller takes care or controlling to position as measured by the strai -

    +

    block_diagram_lut_attocube.png

    -

    Figure 10: Block Diagram schematic of the setup used to measure the periodic non-linearity of the Attocube

    +

    Figure 13: Block Diagram schematic of the setup used to measure the periodic non-linearity of the Attocube

    @@ -938,9 +1142,9 @@ The problem is to estimate the periodic non-linearity of the Attocube from the i

    -
    -

    4.2. Choice of the reference signal

    -
    +
    +

    5.2. Choice of the reference signal

    +

    The main specifications for the reference signal are;

    @@ -963,9 +1167,9 @@ Based on the above discussion, one suitable excitation signal is a sinusoidal sw
    -
    -

    4.3. Repeatability of the non-linearity

    -
    +
    +

    5.3. Repeatability of the non-linearity

    +

    Instead of calibrating the non-linear errors of the interferometers over the full fast jack stroke (25mm), one can only calibrate the errors of one period.

    @@ -984,9 +1188,9 @@ One way to precisely estimate the laser wavelength is to estimate the non linear
    -
    -

    4.4. Simulation

    -
    +
    +

    5.4. Simulation

    +

    Suppose we have a first approximation of the non-linear period.

    @@ -1005,18 +1209,18 @@ period_nl = period_est + period_err;

    -The non-linear errors are first estimated at the beginning of the stroke (Figure 11). +The non-linear errors are first estimated at the beginning of the stroke (Figure 14).

    -
    +

    non_linear_errors_start_stroke.png

    -

    Figure 11: Estimation of the non-linear errors at the beginning of the stroke

    +

    Figure 14: Estimation of the non-linear errors at the beginning of the stroke

    From this only measurement, it is not possible to estimate with great accuracy the period of the error. -To do so, the same measurement is performed with a stroke of several millimeters (Figure 12). +To do so, the same measurement is performed with a stroke of several millimeters (Figure 15).

    @@ -1025,10 +1229,10 @@ This is due to a mismatch between the estimated period and the true period of th

    -
    +

    non_linear_errors_middle_stroke.png

    -

    Figure 12: Estimated non-linear errors at a latter position

    +

    Figure 15: Estimated non-linear errors at a latter position

    @@ -1058,7 +1262,7 @@ with \(\lambda_{\text{est}}\) the estimated error’s period.

    -From Figure 12, we can see that there is an offset between the two curves. +From Figure 15, we can see that there is an offset between the two curves. Let’s call this offset \(\epsilon_x\), we then have:

    \begin{equation} @@ -1138,9 +1342,9 @@ The maximum stroke is 2.9 [mm]
    -
    -

    4.5. Measurements

    -
    +
    +

    5.5. Measurements

    +

    We have some constrains on the way the motion is imposed and measured:

    @@ -1165,20 +1369,10 @@ Suppose we have the power spectral density (PSD) of both \(n_a\) and \(n_g\).
    - -
    -

    Bibliography

    -
    -
    -
    Ducourtieux, S., 2018. Toward high precision position control using laser interferometry: Main sources of error. https://doi.org/10.13140/rg.2.2.21044.35205
    -
    Thurner, K., Quacquarelli, F.P., Braun, P.-F., Dal Savio, C., Karrai, K., 2015. Fiber-based distance sensing interferometry. Applied optics 54, 3051–3063.
    -
    -
    -

    Author: Dehaeze Thomas

    -

    Created: 2022-02-15 mar. 14:25

    +

    Created: 2022-06-02 Thu 18:06

    diff --git a/dcm-metrology.org b/dcm-metrology.org index 5569e59..0957ca6 100644 --- a/dcm-metrology.org +++ b/dcm-metrology.org @@ -184,10 +184,12 @@ In this section, the impact of an error in the relative pose between the first a This is very important in order to: - link a measurement of the x-ray beam position to a default in the crystal position - understand which pose default will have large impact on the output beam position/orientation -- calibrate the deformations of the metrology frame using and external metrology measuring the x-ray beam position/orientation +- calibrate the deformations of the metrology frame using an external metrology measuring the x-ray beam position/orientation In order to simplify the problem, the first crystal is supposed to be fixed (i.e. ideally positioned), and only the motion of the second crystal is studied. +In order to easily study that, "ray tracing" techniques are used. + ** Matlab Init :noexport:ignore: #+begin_src matlab :tangle no :exports none :results silent :noweb yes :var current_dir=(file-name-directory buffer-file-name) <> @@ -197,66 +199,6 @@ In order to simplify the problem, the first crystal is supposed to be fixed (i.e <> #+end_src -#+begin_src matlab -bragg = pi/180*linspace(5,75,100); -#+end_src - -** Axial motion of second crystal -Let's consider the relation between the $[y, z]$ motion of the beam and the motion of the second crystal $[z^\prime, R_{y^\prime}, R_{x^\prime}]$. - -#+name: fig:relation_dz_output_beam -#+caption: Relation between $d_{z^\prime}$ motion of the second crystal and vertical motion of the beam -[[file:figs/relation_dz_output_beam.png]] - -\begin{equation} - d_z = d_{z^\prime} 2 \cos \theta -\end{equation} - -#+begin_src matlab :exports none :results none -%% Relation between vertical motion of the second crystal and vertical motion of the output beam -figure; -hold on; -plot(180/pi*bragg, 2*cos(bragg)) -xlabel('Bragg [deg]'); ylabel('Motion amplification'); -#+end_src - -#+begin_src matlab :tangle no :exports results :results file replace -exportFig('figs/relation_vert_motion_crystal_beam.pdf', 'width', 'wide', 'height', 'normal'); -#+end_src - -#+name: fig:relation_vert_motion_crystal_beam -#+caption: Relation between vertical motion of the second crystal and vertical motion of the output beam -#+RESULTS: -[[file:figs/relation_vert_motion_crystal_beam.png]] - -** Ry motion of second crystal - -\begin{equation} -d_z = D_{\text{vlm}} d_{R_y^\prime} -\end{equation} - -with $D_{\text{vlm}} \approx 10\,m$. - -** Rx motion of second crystal - -\begin{equation} -d_y = 2 D_{\text{vlm}} \sin \theta \cdot d_{R_x^\prime} -\end{equation} - - - -* Ray Tracing -** Introduction :ignore: - -** Matlab Init :noexport:ignore: -#+begin_src matlab :tangle no :exports none :results silent :noweb yes :var current_dir=(file-name-directory buffer-file-name) -<> -#+end_src - -#+begin_src matlab :exports none :results silent :noweb yes -<> -#+end_src - #+begin_src matlab :tangle no :noweb yes <> #+end_src @@ -280,271 +222,73 @@ d_y = 2 D_{\text{vlm}} \sin \theta \cdot d_{R_x^\prime} | output beam | =x3,y3,z3= | =s3= | | Dectector | =xd,yd,zd= | =nd= | -#+begin_src matlab -theta = 85*pi/180; % [rad] -#+end_src +- [ ] Add schematic -#+begin_src matlab -thetas = pi/180*[5:1:85]; -#+end_src +Notations for the pose of the output beam: =d_b_y=, =d_b_z=, =r_b_y=, =r_b_z=. -#+begin_src matlab -yz = zeros(2, length(thetas)); -#+end_src +$d_{b,y}, d_{b,z}, r_{b,y}, r_{b,z}$ -#+begin_src matlab -for i = 1:length(thetas) - theta = thetas(i); -#+end_src +The xy position of the beam is taken in the $x=0$ plane. -#+begin_src matlab -%% Secondary crystal defaults -drx = 0; % [rad] -dry = 0; % [rad] -dz = 1e-9; % [m] +** Effect of an error in crystal's distance +<> -% Rotation matrix for drx -udrx = [cos(theta), 0, -sin(theta)]; -Rdrx = cos(drx)*eye(3)+sin(drx)*[0, -udrx(3), udrx(2); udrx(3), 0, -udrx(1); -udrx(2), udrx(1), 0] + (1-cos(drx))*(udrx'*udrx); +In Figure [[fig:ray_tracing_error_dz_overview]] is shown the light path for three bragg angles (5, 55 and 85 degrees) when there is an error in the =dz= position of 1mm. -% Rotation matrix for dry -Rdry = [ cos(dry), 0, sin(dry); ... - 0, 1, 0; ... - -sin(dry), 0, cos(dry)]; -#+end_src - -#+begin_src matlab -%% Input Beam -p1 = [-0.1, 0, 0]; % [m] -s1 = [ 1, 0, 0]; - -%% Primary Mirror -pp = [0, 0, 0]; % [m] -np = [cos(pi/2-theta), 0, sin(pi/2-theta)]; - -%% Reflected beam -[p2, s2] = get_plane_reflection(p1, s1, pp, np); - -%% Secondary Mirror -ps = pp ... - + 0.07*[cos(theta), 0, -sin(theta)] ... % x offset (does not matter a lot) - - np*10e-3./(2*cos(theta)) ... % Theoretical offset - + np*dz; % Add error in distance - -ns = [Rdry*Rdrx*[cos(pi/2-theta), 0, sin(pi/2-theta)]']'; % Normal - -%% Output Beam -[p3, s3] = get_plane_reflection(p2, s2, ps, ns); - -%% Detector -pd = [1, 0, 0]; % [m] -nd = [-1, 0, 0]; - -%% Get beam position on the decector -p4 = get_plane_reflection(p3, s3, pd, nd); -yz(:,i) = p4(2:3); -end -#+end_src - -#+begin_src matlab -figure; -hold on; -plot(180/pi*thetas, 1e9*(yz(2,:) + 10e-3)); -xlabel('Bragg Angle [deg]'); ylabel('Z position [nm/m/nrad]'); -#+end_src - -#+begin_src matlab -figure; -hold on; -plot(180/pi*thetas, 1e9*yz(1,:)); -xlabel('Bragg Angle [deg]'); ylabel('Y position [nm/m/nrad]'); -#+end_src - -#+begin_src matlab -%% Primary crystal plane -z = np; -y = [0,1,0]; -x = cross(y,z); -xtal1_rectangle = [pp + 0.02*y + 0.07*x; - pp - 0.02*y + 0.07*x; - pp - 0.02*y - 0.07*x; - pp + 0.02*y - 0.07*x]; - -%% Secondary crystal plane -z = ns; -y = [0,cos(drx),sin(drx)]; -x = cross(y,z); -xtal2_rectangle = [ps + 0.02*y + 0.07*x; - ps - 0.02*y + 0.07*x; - ps - 0.02*y - 0.07*x; - ps + 0.02*y - 0.07*x]; -#+end_src - -#+begin_src matlab -figure; -tiledlayout(2, 1, 'TileSpacing', 'Compact', 'Padding', 'None'); - -ax1 = nexttile(); -hold on; -plot3([p1(1), p2(1)],[p1(2), p2(2)], [p1(3), p2(3)]) -plot3([p2(1), p3(1)],[p2(2), p3(2)], [p2(3), p3(3)]) -plot3([p3(1), p3(1)+0.3*s3(1)],[p3(2), p3(2)+0.3*s3(2)], [p3(3), p3(3)+0.3*s3(3)]) -patch(xtal1_rectangle(:,1), xtal1_rectangle(:,2), xtal1_rectangle(:,3), 'k') -patch(xtal2_rectangle(:,1), xtal2_rectangle(:,2), xtal2_rectangle(:,3), 'k') -hold off; -view(0,0) -axis equal -xlim([-0.1, 0.15]) -zlim([-0.02, 0.01]) -grid off; -xlabel('X') -ylabel('Y') -zlabel('Z') - -ax2 = nexttile(); -hold on; -plot3([p1(1), p2(1)],[p1(2), p2(2)], [p1(3), p2(3)]) -plot3([p2(1), p3(1)],[p2(2), p3(2)], [p2(3), p3(3)]) -plot3([p3(1), p3(1)+0.3*s3(1)],[p3(2), p3(2)+0.3*s3(2)], [p3(3), p3(3)+0.3*s3(3)]) -patch(xtal1_rectangle(:,1), xtal1_rectangle(:,2), xtal1_rectangle(:,3), 'k') -patch(xtal2_rectangle(:,1), xtal2_rectangle(:,2), xtal2_rectangle(:,3), 'k') -hold off; -view(0,90) -axis equal -xlim([-0.1, 0.15]) -zlim([-0.02, 0.01]) -grid off; -xlabel('X') -ylabel('Y') -zlabel('Z') -#+end_src - -#+begin_src matlab -figure; -hold on; -plot3([p1(1), p2(1)],[p1(2), p2(2)], [p1(3), p2(3)]) -plot3([p2(1), p3(1)],[p2(2), p3(2)], [p2(3), p3(3)]) -plot3([p3(1), p3(1)+0.3*s3(1)],[p3(2), p3(2)+0.3*s3(2)], [p3(3), p3(3)+0.3*s3(3)]) -surf(xtal1_x, xtal1_y, xtal1_z) -patch(xtal2_rectangle(:,1), xtal2_rectangle(:,2), xtal2_rectangle(:,3), 'k') -hold off; -view(0,0) -axis equal -xlim([-0.1, 0.15]) -zlim([-0.02, 0.01]) -grid off; -#+end_src - -#+begin_src matlab -figure; -hold on; -plot3([p1(1), p2(1)],[p1(2), p2(2)], [p1(3), p2(3)]) -plot3([p2(1), p3(1)],[p2(2), p3(2)], [p2(3), p3(3)]) -plot3([p3(1), p3(1)+0.3*s3(1)],[p3(2), p3(2)+0.3*s3(2)], [p3(3), p3(3)+0.3*s3(3)]) -surf(xtal1_x, xtal1_y, xtal1_z) -patch(xtal2_rectangle(:,1), xtal2_rectangle(:,2), xtal2_rectangle(:,3), 'k') -hold off; -view(90,90) -axis equal -xlim([-0.1, 0.15]) -zlim([-0.02, 0.01]) -grid off; -#+end_src - -** Effect of =dry= -#+begin_src matlab :exports none -%% Effect of dry -thetas = 1:1:85; -Dy = zeros(length(thetas), 1); -Dz = zeros(length(thetas), 1); -Ry = zeros(length(thetas), 1); -Rz = zeros(length(thetas), 1); -for i = 1:length(thetas) - results = getBeamPath(thetas(i)*pi/180, 'dry', 1e-9); - Dy(i) = results.p4(2); - Dz(i) = results.p4(3); - Ry(i) = atan2(results.s3(3), results.s3(1)); - Rz(i) = atan2(results.s3(2), results.s3(1)); -end -#+end_src +Visually, it is clear that this induce a =z= offset of the output beam. #+begin_src matlab :exports none :results none -%% Motion of the output beam with dry error +%% Visual Effect of an error in dz figure; hold on; -plot(thetas, 1e9*(Dz+10e-3), '--', 'DisplayName', 'Dz'); -plot(thetas, 1e9*Dy, '--', 'DisplayName', 'Dy'); -plot(thetas, 1e9*Rz, 'DisplayName', 'Rz'); -plot(thetas, 1e9*Ry, 'DisplayName', 'Ry'); +for theta = [5, 55, 85] + results = getBeamPath(theta*pi/180, 'dz', 1e-3); + set(gca,'ColorOrderIndex',1) + plotBeamPath(results); + plotCrystals(results); +end hold off; -xlabel('Bragg [deg]'); ylabel('Offset [nm/m], Tilt [nrad]') -legend('location', 'northeast', 'FontSize', 8, 'NumColumns', 2); -xlim([0, 85]); +view(0,0) +xlim([-10, 15]) +zlim([-4, 2]) +grid off; +axis equal +xlabel('X [cm]') +ylabel('Y [cm]') +zlabel('Z [cm]') #+end_src #+begin_src matlab :tangle no :exports results :results file replace -exportFig('figs/motion_beam_dry_error.pdf', 'width', 'wide', 'height', 'normal'); +exportFig('figs/ray_tracing_error_dz_overview.pdf', 'width', 'full', 'height', 'normal'); #+end_src -#+name: fig:motion_beam_dry_error -#+caption: Motion of the output beam with dry error +#+name: fig:ray_tracing_error_dz_overview +#+caption: Visual Effect of an error in =dz= (1mm). Side view. #+RESULTS: -[[file:figs/motion_beam_dry_error.png]] +[[file:figs/ray_tracing_error_dz_overview.png]] -** Effect of =drx= -#+begin_src matlab :exports none -%% Effect of drx -thetas = 1:1:85; -Dy = zeros(length(thetas), 1); -Dz = zeros(length(thetas), 1); -Ry = zeros(length(thetas), 1); -Rz = zeros(length(thetas), 1); -for i = 1:length(thetas) - results = getBeamPath(thetas(i)*pi/180, 'drx', 1e-9); - Dy(i) = results.p4(2); - Dz(i) = results.p4(3); - Ry(i) = atan2(results.s3(3), results.s3(1)); - Rz(i) = atan2(results.s3(2), results.s3(1)); -end -#+end_src +The motion of the output beam is displayed as a function of the Bragg angle in Figure [[fig:motion_beam_dz_error]]. +It is clear that an error in the distance =dz= between the crystals only induce a =z= offset of the output beam. +This offset decreases with the Bragg angle. -#+begin_src matlab :exports none :results none -%% Motion of the output beam with drx error -figure; -hold on; -plot(thetas, 1e9*(Dz+10e-3), '--', 'DisplayName', 'Dz'); -plot(thetas, 1e9*Dy, '--', 'DisplayName', 'Dy'); -plot(thetas, 1e9*Rz, 'DisplayName', 'Rz'); -plot(thetas, 1e9*Ry, 'DisplayName', 'Ry'); -hold off; -xlabel('Bragg [deg]'); ylabel('Offset [nm/m], Tilt [nrad]') -legend('location', 'southwest', 'FontSize', 8, 'NumColumns', 2); -xlim([0, 85]); -#+end_src +This is indeed equal to: +\begin{equation} +\boxed{d_{b,z} = 2 d_z \cos \theta} +\end{equation} -#+begin_src matlab :tangle no :exports results :results file replace -exportFig('figs/motion_beam_drx_error.pdf', 'width', 'wide', 'height', 'normal'); -#+end_src - -#+name: fig:motion_beam_drx_error -#+caption: Motion of the output beam with drx error -#+RESULTS: -[[file:figs/motion_beam_drx_error.png]] - -** Effect of =dz= #+begin_src matlab :exports none %% Effect of dz thetas = 1:1:85; -Dy = zeros(length(thetas), 1); -Dz = zeros(length(thetas), 1); -Ry = zeros(length(thetas), 1); -Rz = zeros(length(thetas), 1); +Dy = zeros(length(thetas), 1); % [m] +Dz = zeros(length(thetas), 1); % [m] +Ry = zeros(length(thetas), 1); % [rad] +Rz = zeros(length(thetas), 1); % [rad] for i = 1:length(thetas) results = getBeamPath(thetas(i)*pi/180, 'dz', 1e-9); - Dy(i) = results.p4(2); - Dz(i) = results.p4(3); Ry(i) = atan2(results.s3(3), results.s3(1)); Rz(i) = atan2(results.s3(2), results.s3(1)); + Dy(i) = results.p4(2)-tan(Rz(i)); + Dz(i) = results.p4(3)+tan(Ry(i)); end #+end_src @@ -552,12 +296,12 @@ end %% Motion of the output beam with dZ error figure; hold on; -plot(thetas, 1e9*(Dz+10e-3), '--', 'DisplayName', 'Dz'); plot(thetas, 1e9*Dy, '--', 'DisplayName', 'Dy'); -plot(thetas, 1e9*Rz, 'DisplayName', 'Rz'); +plot(thetas, 1e9*(Dz+10e-3), '--', 'DisplayName', 'Dz'); plot(thetas, 1e9*Ry, 'DisplayName', 'Ry'); +plot(thetas, 1e9*Rz, 'DisplayName', 'Rz'); hold off; -xlabel('Bragg [deg]'); ylabel('Offset [nm/m], Tilt [nrad]') +xlabel('Bragg [deg]'); ylabel('Offset [m/m] Tilt [rad/m]') legend('location', 'northeast', 'FontSize', 8, 'NumColumns', 2); xlim([0, 85]); #+end_src @@ -571,98 +315,338 @@ exportFig('figs/motion_beam_dz_error.pdf', 'width', 'wide', 'height', 'normal'); #+RESULTS: [[file:figs/motion_beam_dz_error.png]] -** Test :noexport: -#+begin_src matlab -figure; -plot(thetas, 1e9*yz(:,1)); -xlabel('Bragg [deg]'); ylabel('Y Displacement [nm/m/nrad]') -#+end_src +** Effect of an error in crystal's x parallelism +<> -#+begin_src matlab -figure; -plot(thetas, 1e9*yz(:,1)); -xlabel('Bragg [deg]'); ylabel('Y Displacement [nm/m/nrad]') -#+end_src +The effect of an error in =rx= crystal parallelism on the output beam is visually shown in Figure [[fig:ray_tracing_error_drx_overview]] for three bragg angles (5, 55 and 85 degrees). +The error is set to one degree, and the top view is shown. +It is clear that the output beam experiences some rotation around a vertical axis. +The amount of rotation depends on the bragg angle. -#+begin_src matlab -%% Effect of dry -thetas = 1:1:85; -yz = zeros(length(thetas), 2); -for i = 1:length(thetas) - results = getBeamPath(thetas(i)*pi/180, 'dry', 1e-9); - yz(i,:) = results.p4(2:3); -end -#+end_src - -#+begin_src matlab -figure; -plot(thetas, 1e9*(yz(:,2) + 10e-3)); -xlabel('Bragg [deg]'); ylabel('Z Displacement [nm/m/nrad]') -#+end_src - -#+begin_src matlab -%% Effect of dz -thetas = 1:1:85; -yz = zeros(length(thetas), 2); -for i = 1:length(thetas) - results = getBeamPath(thetas(i)*pi/180, 'dz', 1e-9); - yz(i,:) = results.p4(2:3); -end -#+end_src - -#+begin_src matlab -figure; -plot(thetas, 1e9*(yz(:,2) + 10e-3)); -xlabel('Bragg [deg]'); ylabel('Z Displacement [nm/m/nm]') -#+end_src - - - -#+begin_src matlab +#+begin_src matlab :exports none :results none +%% Visual Effect of an error in drx figure; hold on; -for theta = 5:5:85 +for theta = [5, 55, 85] + results = getBeamPath(theta*pi/180, 'drx', -1*pi/180); set(gca,'ColorOrderIndex',1) - plotBeamPath(getBeamPath(theta*pi/180, 'dz', 1e-3)) -end -hold off; -view(0,0) -axis equal -xlim([-0.1, 0.15]) -zlim([-0.02, 0.01]) -grid off; -#+end_src - -#+begin_src matlab -figure; -hold on; -for theta = 5:5:85 - set(gca,'ColorOrderIndex',1) - plotBeamPath(getBeamPath(theta*pi/180, 'dry', 1*pi/180)) -end -hold off; -view(0,0) -axis equal -xlim([-0.1, 0.15]) -zlim([-0.02, 0.01]) -grid off; -#+end_src - -#+begin_src matlab -figure; -hold on; -for theta = 5:5:85 - set(gca,'ColorOrderIndex',1) - plotBeamPath(getBeamPath(theta*pi/180, 'drx', 1*pi/180)) + plotBeamPath(results); + % plotCrystals(results); end hold off; view(0,90) axis equal -xlim([-0.1, 0.15]) -zlim([-0.02, 0.01]) +xlim([-10, 15]) +ylim([-1, 1]) grid off; +xlabel('X [cm]'); +ylabel('Y [cm]'); +zlabel('Z [cm]'); #+end_src +#+begin_src matlab :tangle no :exports results :results file replace +exportFig('figs/ray_tracing_error_drx_overview.pdf', 'width', 'full', 'height', 'normal'); +#+end_src + +#+name: fig:ray_tracing_error_drx_overview +#+caption: Visual Effect of an error in =drx= (1 degree). Top View. +#+RESULTS: +[[file:figs/ray_tracing_error_drx_overview.png]] + +The effect of =drx= as a function of the Bragg angle on the output beam pose is computed and shown in Figure [[fig:motion_beam_drx_error]]. + +It induces a rotation of the output beam in the =z= direction that depends on the Bragg Angle. +It is starting at zero for small bragg angles, and it increases with the bragg angle up to 2 times =drx=. +This is indeed equal to: +\begin{equation} +\boxed{r_{b,z} = 2 r_x \cos \theta} +\end{equation} + +If also induces a small $y$ shift of the beam. +This shift is due to the fact that the rotation point (around which the second crystal is moved) is changing as a function of bragg. +We can note that the $y$ shift is equal to zero for a bragg angle of 45 degrees, at which point the center of rotation of the second crystal is at $x = 0$; + +#+begin_src matlab :exports none +%% Effect of drx +thetas = 1:1:85; +Dy = zeros(length(thetas), 1); +Dz = zeros(length(thetas), 1); +Ry = zeros(length(thetas), 1); +Rz = zeros(length(thetas), 1); +for i = 1:length(thetas) + results = getBeamPath(thetas(i)*pi/180, 'drx', 1e-9); + Ry(i) = atan2(results.s3(3), results.s3(1)); + Rz(i) = atan2(results.s3(2), results.s3(1)); + Dy(i) = results.p4(2)-tan(Rz(i)); + Dz(i) = results.p4(3)+tan(Ry(i)); +end +#+end_src + +#+begin_src matlab :exports none :results none +%% Motion of the output beam with drx error +figure; +hold on; +plot(thetas, 1e9*Dy, '--', 'DisplayName', 'Dy'); +plot(thetas, 1e9*(Dz+10e-3), '--', 'DisplayName', 'Dz'); +plot(thetas, 1e9*Ry, 'DisplayName', 'Ry'); +plot(thetas, 1e9*Rz, 'DisplayName', 'Rz'); +hold off; +xlabel('Bragg [deg]'); ylabel('Offset [m/rad] Tilt [rad/rad]') +legend('location', 'southwest', 'FontSize', 8, 'NumColumns', 2); +xlim([0, 85]); +#+end_src + +#+begin_src matlab :tangle no :exports results :results file replace +exportFig('figs/motion_beam_drx_error.pdf', 'width', 'wide', 'height', 'normal'); +#+end_src + +#+name: fig:motion_beam_drx_error +#+caption: Motion of the output beam with drx error +#+RESULTS: +[[file:figs/motion_beam_drx_error.png]] + +** Effect of an error in crystal's y parallelism +<> + +The effect of an error in =ry= crystal parallelism on the output beam is visually shown in Figure [[fig:ray_tracing_error_dry_overview]] for three bragg angles (5, 55 and 85 degrees). + +#+begin_src matlab :exports none :results none +%% Visual Effect of an error in dry +figure; +hold on; +for theta = [5, 55, 85] + results = getBeamPath(theta*pi/180, 'dry', -1*pi/180); + set(gca,'ColorOrderIndex',1) + plotBeamPath(results); + plotCrystals(results); +end +hold off; +view(0,0) +axis equal +xlim([-10, 15]) +zlim([-4, 2]) +grid off; +xlabel('X [cm]') +ylabel('Y [cm]') +zlabel('Z [cm]') +#+end_src + +#+begin_src matlab :tangle no :exports results :results file replace +exportFig('figs/ray_tracing_error_dry_overview.pdf', 'width', 'full', 'height', 'normal'); +#+end_src + +#+name: fig:ray_tracing_error_dry_overview +#+caption: Visual Effect of an error in =dry= (1 degree). Side view. +#+RESULTS: +[[file:figs/ray_tracing_error_dry_overview.png]] + +The effect of =dry= as a function of the Bragg angle on the output beam pose is computed and shown in Figure [[fig:motion_beam_dry_error]]. +It is clear that this induces a rotation of the output beam in the =y= direction equals to 2 times =dry=: +\begin{equation} +\boxed{r_{b,z} = 2 r_z} +\end{equation} + +It also induces a small vertical motion of the beam (at the $x=0$ location) which is simply due to the fact that the $x$ coordinate of the impact point on the second crystal changes with the Bragg angle. + +#+begin_src matlab :exports none +%% Effect of dry +thetas = 1:1:85; +Dy = zeros(length(thetas), 1); +Dz = zeros(length(thetas), 1); +Ry = zeros(length(thetas), 1); +Rz = zeros(length(thetas), 1); +for i = 1:length(thetas) + results = getBeamPath(thetas(i)*pi/180, 'dry', 1e-9); + Ry(i) = atan2(results.s3(3), results.s3(1)); + Rz(i) = atan2(results.s3(2), results.s3(1)); + Dy(i) = results.p4(2)-tan(Rz(i)); + Dz(i) = results.p4(3)-tan(Ry(i)); +end +#+end_src + +#+begin_src matlab :exports none :results none +%% Motion of the output beam with dry error +figure; +hold on; +plot(thetas, 1e9*Dy, '--', 'DisplayName', 'Dy'); +plot(thetas, 1e9*(Dz+10e-3), '--', 'DisplayName', 'Dz'); +plot(thetas, 1e9*Ry, 'DisplayName', 'Ry'); +plot(thetas, 1e9*Rz, 'DisplayName', 'Rz'); +hold off; +xlabel('Bragg [deg]'); ylabel('Offset [m/rad] Tilt [rad/rad]') +legend('location', 'east', 'FontSize', 8, 'NumColumns', 2); +xlim([0, 85]); +#+end_src + +#+begin_src matlab :tangle no :exports results :results file replace +exportFig('figs/motion_beam_dry_error.pdf', 'width', 'wide', 'height', 'normal'); +#+end_src + +#+name: fig:motion_beam_dry_error +#+caption: Motion of the output beam with dry error +#+RESULTS: +[[file:figs/motion_beam_dry_error.png]] + +** Summary + +Effects of crystal's pose errors on the output beam are summarized in Table [[tab:crystal_pose_beam_pose]]. +Note that the three pose errors are well decoupled regarding their effects on the output beam. +Also note that the effect of an error in crystal's distance does not depend on the Bragg angle. + +#+name: tab:crystal_pose_beam_pose +#+caption: Summary of the effects of the errors in second crystal's pose on the output beam +#+attr_latex: :environment tabularx :width 0.65\linewidth :align X|ccc +#+attr_latex: :center t :booktabs t +| *Beam Motion* | *Crystal* $d_z$ | *Crystal* $r_x$ | *Crystal* $r_y$ | +|---------------+--------------------------------+--------------------------------------+--------------------| +| $d_{b,y}$ | 0 | $\approx 0$ | 0 | +| $d_{b,z}$ | $\boxed{d_{z} 2 \cos(\theta)}$ | 0 | $\approx 0$ | +| $r_{b,y}$ | 0 | 0 | $\boxed{2 r_{y}}$ | +| $r_{b,z}$ | 0 | $\boxed{- r_x 2 \sin(\theta)}$ | 0 | + +** "Channel cut" Scan +A "channel cut" scan is a Bragg scan where the distance between the crystals is fixed. + +This is visually shown in Figure [[fig:ray_tracing_channel_cut]] where it is clear that the output beam experiences some vertical motion. + +#+begin_src matlab :exports none :results none +%% Visual Effect of a channel cut scan +figure; +hold on; +for theta = [30, 40, 50] + results = getBeamPath(theta*pi/180, 'dz', 10e-3/(2*cos(pi/180*theta))-10e-3/(2*cos(pi/180*theta_fixed))); + set(gca,'ColorOrderIndex',1) + plotBeamPath(results); + plotCrystals(results); +end +hold off; +view(0,0) +axis equal +xlim([-10, 15]) +zlim([-4, 2]) +grid off; +xlabel('X [cm]') +ylabel('Y [cm]') +zlabel('Z [cm]') +#+end_src + +#+begin_src matlab :tangle no :exports results :results file replace +exportFig('figs/ray_tracing_channel_cut.pdf', 'width', 'full', 'height', 'normal'); +#+end_src + +#+name: fig:ray_tracing_channel_cut +#+caption: Visual Effect of a channel cut scan +#+RESULTS: +[[file:figs/ray_tracing_channel_cut.png]] + +The $z$ offset of the beam for several channel cut scans are shown in Figure [[fig:channel_cut_scan]]. + +#+begin_src matlab :exports none +%% Computation of Z motion of the beam during "channel cut" scans +thetas = 5:1:84; +Dz = zeros(length(thetas), 1); + +for i = 1:length(thetas) + results = getBeamPath(thetas(i)*pi/180, 'dz', 10e-3/(2*cos(pi/180*thetas(i)))-10e-3/(2*cos(pi/180*(10*fix((5+thetas(i))/10))))); + Dz(i) = results.p4(3); +end +#+end_src + +#+begin_src matlab :exports none :results none +%% Dz motion of the beam during "channel cut" scans +figure; +hold on; +for i = 1:8 + plot(thetas((i-1)*10+1:i*10), 1e3*(Dz((i-1)*10+1:i*10)+10e-3), '-', 'DisplayName', sprintf('$%i^o$: $%.0f\\,\\mu$m/deg', (10*fix((5+thetas((i-1)*10+5))/10)), 1e6*(Dz((i-1)*10+6)-Dz((i-1)*10+5)))); +end +hold off; +xlabel('Bragg [deg]'); ylabel('Dz Offset [mm]') +xlim([0, 90]); ylim([-4, 4]); +xticks([0:10:90]); +legend('location', 'southwest', 'FontSize', 8, 'NumColumns', 2); +#+end_src + +#+begin_src matlab :tangle no :exports results :results file replace +exportFig('figs/channel_cut_scan.pdf', 'width', 'wide', 'height', 'normal'); +#+end_src + +#+name: fig:channel_cut_scan +#+caption: Z motion of the beam during "channel cut" scans +#+RESULTS: +[[file:figs/channel_cut_scan.png]] + +* Determining relative pose between the crystals using the X-ray +** Introduction :ignore: +As Interferometers are only measuring /relative/ displacement, it is mandatory to initialize them correctly. + +They should be initialize in such a way that: +- $r_x = 0$ and $r_y = 0$ when the two crystallographic planes are parallel +- measured $d_z$ is equal to the distance between the crystallographic planes + +In order to do that, an external metrology using the x-ray is used. + +** Determine the $y$ parallelism - "Rocking Curve" + +** Determine the $x$ parallelism - Bragg Scan + + +** Determine the $z$ distance - Bragg Scan + +** Use Channel cut scan to determine crystal =dry= parallelism + +Now, let's suppose we want to determine the =dry= angle between the crystals. + +#+begin_src matlab +dry = 1e-6; % [rad] +#+end_src + +#+begin_src matlab :exports none +%% Computation of Z motion of the beam during "channel cut" scans +thetas = 5:1:84; +Dz_expected = zeros(length(thetas), 1); +Dz_obtained = zeros(length(thetas), 1); + +for i = 1:length(thetas) + results = getBeamPath(thetas(i)*pi/180, 'dz', 10e-3/(2*cos(pi/180*thetas(i)))-10e-3/(2*cos(pi/180*(10*fix((5+thetas(i))/10))))); + Dz_expected(i) = results.p4(3); + + results = getBeamPath(thetas(i)*pi/180, 'dz', 10e-3/(2*cos(pi/180*thetas(i)))-10e-3/(2*cos(pi/180*(10*fix((5+thetas(i))/10)))), 'dry', dry); + Dz_obtained(i) = results.p4(3); +end +#+end_src + +The error is +\begin{equation} +\boxed{d_{b,z} = -2 d_z \cos()} +\end{equation} + +#+begin_src matlab :exports none :results none +%% Dz motion of the beam during "channel cut" scans +figure; +hold on; +plot(thetas, 1e6*(Dz_expected-Dz_obtained), '-'); +hold off; +xlabel('Bragg [deg]'); ylabel('Dz Offset [$\mu$m]') +xlim([0, 90]); +xticks([0:10:90]); +legend('location', 'southwest', 'FontSize', 8, 'NumColumns', 2); +#+end_src + +#+begin_src matlab :exports none :results none +%% Dz motion of the beam during "channel cut" scans +figure; +hold on; +plot(thetas, 1e3*Dz_expected, '-'); +plot(thetas, 1e3*Dz_obtained, '-'); +hold off; +xlabel('Bragg [deg]'); ylabel('Dz Offset [mm]') +xlim([0, 90]); +xticks([0:10:90]); +legend('location', 'southwest', 'FontSize', 8, 'NumColumns', 2); +#+end_src + +** Effect of an error on Bragg angle + * Deformations of the Metrology Frame <> ** Introduction :ignore: @@ -1396,16 +1380,16 @@ freqs = logspace(1, 3, 1000); ** Intersection between Ray and Plane :PROPERTIES: -:header-args:matlab+: :tangle matlab/src/get_plane_reflection.m +:header-args:matlab+: :tangle matlab/src/getPlaneReflection.m :header-args:matlab+: :comments none :mkdirp yes :eval no :END: -<> +<> #+begin_src matlab -function [p_reflect, s_reflect] = get_plane_reflection(p_in, s_in, p_plane, n_plane) -% get_plane_reflection - +function [p_reflect, s_reflect] = getPlaneReflection(p_in, s_in, p_plane, n_plane) +% getPlaneReflection - % -% Syntax: [p_reflect, s_reflect] = get_plane_reflection(p_in, s_in, p_plane, n_plane) +% Syntax: [p_reflect, s_reflect] = getPlaneReflection(p_in, s_in, p_plane, n_plane) % % Inputs: % - p_in, s_in, p_plane, n_plane - @@ -1474,25 +1458,25 @@ pp = [0, 0, 0]; % [m] np = [cos(pi/2-theta), 0, sin(pi/2-theta)]; %% Reflected beam -[p2, s2] = get_plane_reflection(p1, s1, pp, np); +[p2, s2] = getPlaneReflection(p1, s1, pp, np); %% Secondary Mirror ps = pp ... - + 0.07*[cos(theta), 0, -sin(theta)] ... % x offset (does not matter a lot) + + 0.032*[cos(theta), 0, -sin(theta)] ... % x offset (does not matter a lot) - np*10e-3./(2*cos(theta)) ... % Theoretical offset + np*args.dz; % Add error in distance ns = [Rdry*Rdrx*[cos(pi/2-theta), 0, sin(pi/2-theta)]']'; % Normal %% Output Beam -[p3, s3] = get_plane_reflection(p2, s2, ps, ns); +[p3, s3] = getPlaneReflection(p2, s2, ps, ns); %% Detector pd = [1, 0, 0]; % [m] nd = [-1, 0, 0]; %% Get beam position on the decector -p4 = get_plane_reflection(p3, s3, pd, nd); +p4 = getPlaneReflection(p3, s3, pd, nd); #+end_src #+begin_src matlab @@ -1535,8 +1519,65 @@ function [] = plotBeamPath(results) #+end_src #+begin_src matlab -plot3([results.p1(1), results.p2(1)],[results.p1(2), results.p2(2)], [results.p1(3), results.p2(3)]) -plot3([results.p2(1), results.p3(1)],[results.p2(2), results.p3(2)], [results.p2(3), results.p3(3)]) -plot3([results.p3(1), results.p4(1)],[results.p3(2), results.p4(2)], [results.p3(3), results.p4(3)]) +plot3(100*[results.p1(1), results.p2(1)],100*[results.p1(2), results.p2(2)], 100*[results.p1(3), results.p2(3)], 'linewidth', 0.5) +plot3(100*[results.p2(1), results.p3(1)],100*[results.p2(2), results.p3(2)], 100*[results.p2(3), results.p3(3)], 'linewidth', 0.5) +plot3(100*[results.p3(1), results.p4(1)],100*[results.p3(2), results.p4(2)], 100*[results.p3(3), results.p4(3)], 'linewidth', 0.5) #+end_src + +** Plot Crystal +:PROPERTIES: +:header-args:matlab+: :tangle matlab/src/plotCrystals.m +:header-args:matlab+: :comments none :mkdirp yes :eval no +:END: +<> + +#+begin_src matlab +function [] = plotCrystals(results, args) +% plotCrystals - +% +% Syntax: [in_data] = plotCrystals(drx, dry, dz, theta, ) +% +% Inputs: +% - drx, dry, dz, theta, - +% +% Outputs: +% - in_data - +#+end_src + +#+begin_src matlab +arguments + results + args.color (3,1) double {mustBeNumeric} = [1;1;1] + args.alpha (1,1) double {mustBeNumeric} = 1 +end +#+end_src + +#+begin_src matlab +z = results.np; +y = [0,1,0]; +x = cross(y,z); +xtal1_rectangle = [results.pp + 0.02/2*y + 0.035/2*x; + results.pp - 0.02/2*y + 0.035/2*x; + results.pp - 0.02/2*y - 0.035/2*x; + results.pp + 0.02/2*y - 0.035/2*x]; +#+end_src + +#+begin_src matlab +patch(100*xtal1_rectangle(:,1), 100*xtal1_rectangle(:,2), 100*xtal1_rectangle(:,3), 'k-') +#+end_src + +#+begin_src matlab +z = results.ns; +% y = [0,cos(drx),sin(drx)]; +y = [0,1,0]; +x = cross(y,z); +xtal2_rectangle = [results.ps + 0.02/2*y + 0.07/2*x; + results.ps - 0.02/2*y + 0.07/2*x; + results.ps - 0.02/2*y - 0.07/2*x; + results.ps + 0.02/2*y - 0.07/2*x]; +#+end_src + +#+begin_src matlab +patch(100*xtal2_rectangle(:,1), 100*xtal2_rectangle(:,2), 100*xtal2_rectangle(:,3), 'k-') +#+end_src diff --git a/dcm-metrology.pdf b/dcm-metrology.pdf index 71b9ce2..b8e415b 100644 Binary files a/dcm-metrology.pdf and b/dcm-metrology.pdf differ diff --git a/figs/channel_cut_scan.pdf b/figs/channel_cut_scan.pdf new file mode 100644 index 0000000..10a18b7 Binary files /dev/null and b/figs/channel_cut_scan.pdf differ diff --git a/figs/channel_cut_scan.png b/figs/channel_cut_scan.png new file mode 100644 index 0000000..670e0a3 Binary files /dev/null and b/figs/channel_cut_scan.png differ diff --git a/figs/motion_beam_drx_error.pdf b/figs/motion_beam_drx_error.pdf index 4ff5c13..e818648 100644 Binary files a/figs/motion_beam_drx_error.pdf and b/figs/motion_beam_drx_error.pdf differ diff --git a/figs/motion_beam_drx_error.png b/figs/motion_beam_drx_error.png index 8c83bd6..4d10886 100644 Binary files a/figs/motion_beam_drx_error.png and b/figs/motion_beam_drx_error.png differ diff --git a/figs/motion_beam_dry_error.pdf b/figs/motion_beam_dry_error.pdf index bea8e1d..d2c11c3 100644 Binary files a/figs/motion_beam_dry_error.pdf and b/figs/motion_beam_dry_error.pdf differ diff --git a/figs/motion_beam_dry_error.png b/figs/motion_beam_dry_error.png index 7d53404..182808d 100644 Binary files a/figs/motion_beam_dry_error.png and b/figs/motion_beam_dry_error.png differ diff --git a/figs/motion_beam_dz_error.pdf b/figs/motion_beam_dz_error.pdf index add6385..865a76d 100644 Binary files a/figs/motion_beam_dz_error.pdf and b/figs/motion_beam_dz_error.pdf differ diff --git a/figs/motion_beam_dz_error.png b/figs/motion_beam_dz_error.png index a16ef39..3bf73f9 100644 Binary files a/figs/motion_beam_dz_error.png and b/figs/motion_beam_dz_error.png differ diff --git a/figs/ray_tracing_channel_cut.pdf b/figs/ray_tracing_channel_cut.pdf new file mode 100644 index 0000000..e252c8c Binary files /dev/null and b/figs/ray_tracing_channel_cut.pdf differ diff --git a/figs/ray_tracing_channel_cut.png b/figs/ray_tracing_channel_cut.png new file mode 100644 index 0000000..7447ee6 Binary files /dev/null and b/figs/ray_tracing_channel_cut.png differ diff --git a/figs/ray_tracing_error_drx_overview.pdf b/figs/ray_tracing_error_drx_overview.pdf new file mode 100644 index 0000000..df4ba13 Binary files /dev/null and b/figs/ray_tracing_error_drx_overview.pdf differ diff --git a/figs/ray_tracing_error_drx_overview.png b/figs/ray_tracing_error_drx_overview.png new file mode 100644 index 0000000..fbaccfc Binary files /dev/null and b/figs/ray_tracing_error_drx_overview.png differ diff --git a/figs/ray_tracing_error_dry_overview.pdf b/figs/ray_tracing_error_dry_overview.pdf new file mode 100644 index 0000000..9f57e88 Binary files /dev/null and b/figs/ray_tracing_error_dry_overview.pdf differ diff --git a/figs/ray_tracing_error_dry_overview.png b/figs/ray_tracing_error_dry_overview.png new file mode 100644 index 0000000..b876e50 Binary files /dev/null and b/figs/ray_tracing_error_dry_overview.png differ diff --git a/figs/ray_tracing_error_dz_overview.pdf b/figs/ray_tracing_error_dz_overview.pdf new file mode 100644 index 0000000..44456e2 Binary files /dev/null and b/figs/ray_tracing_error_dz_overview.pdf differ diff --git a/figs/ray_tracing_error_dz_overview.png b/figs/ray_tracing_error_dz_overview.png new file mode 100644 index 0000000..80723cc Binary files /dev/null and b/figs/ray_tracing_error_dz_overview.png differ diff --git a/matlab/src/getBeamPath.m b/matlab/src/getBeamPath.m index bffa885..10d834f 100644 --- a/matlab/src/getBeamPath.m +++ b/matlab/src/getBeamPath.m @@ -34,25 +34,25 @@ pp = [0, 0, 0]; % [m] np = [cos(pi/2-theta), 0, sin(pi/2-theta)]; %% Reflected beam -[p2, s2] = get_plane_reflection(p1, s1, pp, np); +[p2, s2] = getPlaneReflection(p1, s1, pp, np); %% Secondary Mirror ps = pp ... - + 0.07*[cos(theta), 0, -sin(theta)] ... % x offset (does not matter a lot) + + 0.032*[cos(theta), 0, -sin(theta)] ... % x offset (does not matter a lot) - np*10e-3./(2*cos(theta)) ... % Theoretical offset + np*args.dz; % Add error in distance ns = [Rdry*Rdrx*[cos(pi/2-theta), 0, sin(pi/2-theta)]']'; % Normal %% Output Beam -[p3, s3] = get_plane_reflection(p2, s2, ps, ns); +[p3, s3] = getPlaneReflection(p2, s2, ps, ns); %% Detector pd = [1, 0, 0]; % [m] nd = [-1, 0, 0]; %% Get beam position on the decector -p4 = get_plane_reflection(p3, s3, pd, nd); +p4 = getPlaneReflection(p3, s3, pd, nd); results = struct(); % Beam position and orientations diff --git a/matlab/src/get_plane_reflection.m b/matlab/src/getPlaneReflection.m similarity index 57% rename from matlab/src/get_plane_reflection.m rename to matlab/src/getPlaneReflection.m index b65c203..56cc19d 100644 --- a/matlab/src/get_plane_reflection.m +++ b/matlab/src/getPlaneReflection.m @@ -1,7 +1,7 @@ -function [p_reflect, s_reflect] = get_plane_reflection(p_in, s_in, p_plane, n_plane) -% get_plane_reflection - +function [p_reflect, s_reflect] = getPlaneReflection(p_in, s_in, p_plane, n_plane) +% getPlaneReflection - % -% Syntax: [p_reflect, s_reflect] = get_plane_reflection(p_in, s_in, p_plane, n_plane) +% Syntax: [p_reflect, s_reflect] = getPlaneReflection(p_in, s_in, p_plane, n_plane) % % Inputs: % - p_in, s_in, p_plane, n_plane - diff --git a/matlab/src/plotBeamPath.m b/matlab/src/plotBeamPath.m index 066468b..7120a74 100644 --- a/matlab/src/plotBeamPath.m +++ b/matlab/src/plotBeamPath.m @@ -9,6 +9,6 @@ function [] = plotBeamPath(results) % Outputs: % - in_data - -plot3([results.p1(1), results.p2(1)],[results.p1(2), results.p2(2)], [results.p1(3), results.p2(3)]) -plot3([results.p2(1), results.p3(1)],[results.p2(2), results.p3(2)], [results.p2(3), results.p3(3)]) -plot3([results.p3(1), results.p4(1)],[results.p3(2), results.p4(2)], [results.p3(3), results.p4(3)]) +plot3(100*[results.p1(1), results.p2(1)],100*[results.p1(2), results.p2(2)], 100*[results.p1(3), results.p2(3)], 'linewidth', 0.5) +plot3(100*[results.p2(1), results.p3(1)],100*[results.p2(2), results.p3(2)], 100*[results.p2(3), results.p3(3)], 'linewidth', 0.5) +plot3(100*[results.p3(1), results.p4(1)],100*[results.p3(2), results.p4(2)], 100*[results.p3(3), results.p4(3)], 'linewidth', 0.5) diff --git a/matlab/src/plotCrystals.m b/matlab/src/plotCrystals.m new file mode 100644 index 0000000..f3e7770 --- /dev/null +++ b/matlab/src/plotCrystals.m @@ -0,0 +1,37 @@ +function [] = plotCrystals(results, args) +% plotCrystals - +% +% Syntax: [in_data] = plotCrystals(drx, dry, dz, theta, ) +% +% Inputs: +% - drx, dry, dz, theta, - +% +% Outputs: +% - in_data - + +arguments + results + args.color (3,1) double {mustBeNumeric} = [1;1;1] + args.alpha (1,1) double {mustBeNumeric} = 1 +end + +z = results.np; +y = [0,1,0]; +x = cross(y,z); +xtal1_rectangle = [results.pp + 0.02/2*y + 0.035/2*x; + results.pp - 0.02/2*y + 0.035/2*x; + results.pp - 0.02/2*y - 0.035/2*x; + results.pp + 0.02/2*y - 0.035/2*x]; + +patch(100*xtal1_rectangle(:,1), 100*xtal1_rectangle(:,2), 100*xtal1_rectangle(:,3), 'k-') + +z = results.ns; +% y = [0,cos(drx),sin(drx)]; +y = [0,1,0]; +x = cross(y,z); +xtal2_rectangle = [results.ps + 0.02/2*y + 0.07/2*x; + results.ps - 0.02/2*y + 0.07/2*x; + results.ps - 0.02/2*y - 0.07/2*x; + results.ps + 0.02/2*y - 0.07/2*x]; + +patch(100*xtal2_rectangle(:,1), 100*xtal2_rectangle(:,2), 100*xtal2_rectangle(:,3), 'k-')