Skip to content

Commit 6d114b8

Browse files
seto77claude
andcommitted
Add geometry/calibration/integration appendix to the manual
Create the IPAnalyzer algorithm appendix (EN/JA), reconstructed from the legacy doc/IPAnalyzerAlgorithm.pdf and the current implementation, with Japanese as the lead language and English reflected from it. - A1 Detector geometry: right-handed coordinate system, IP tilt rotation matrices (phi, tau), and pixel-shape correction (PixSizeX/Y, xi). - A2 Parameter determination: calibrating camera length, wavelength, pixel size, and IP tilt from a standard (two-distance, two-line, ellipse fitting). - A3 Image integration: the area-partitioning algorithm distributing pixel intensity into angular steps. - Expand both appendix index pages with the shared coordinate-system figure and parameter table; wire A1-A3 into the EN/JA nav; add the CL and SN abbreviations; add the reference figures (coordinate-system and area-distribution PNGs, camera-length and tilt-ellipse SVGs). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 6438875 commit 6d114b8

14 files changed

Lines changed: 603 additions & 4 deletions

docs/includes/abbreviations.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@
66
*[ROI]: Region of Interest
77
*[FWHM]: Full Width at Half Maximum
88
*[RAxis]: Rigaku R-Axis image format
9+
*[CL]: Camera Length
10+
*[SN]: Signal-to-Noise ratio

docs/mkdocs.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ nav:
106106
- 6. Find Parameter (brute force): en/6-find-parameter.md
107107
- Appendix:
108108
- en/appendix/index.md
109+
- A1. Detector geometry: en/appendix/a1-geometry.md
110+
- A2. Parameter determination: en/appendix/a2-calibration.md
111+
- A3. Image integration: en/appendix/a3-image-integration.md
109112
- 日本語:
110113
- ホーム: ja/index.md
111114
- 0. 概要: ja/0-overview.md
@@ -120,3 +123,6 @@ nav:
120123
- 6. パラメータ校正(力ずく): ja/6-find-parameter.md
121124
- 付録:
122125
- ja/appendix/index.md
126+
- A1. 検出器の幾何: ja/appendix/a1-geometry.md
127+
- A2. パラメータの決定: ja/appendix/a2-calibration.md
128+
- A3. 画像の積算: ja/appendix/a3-image-integration.md
Lines changed: 53 additions & 0 deletions
Loading
Lines changed: 73 additions & 0 deletions
Loading
128 KB
Loading
106 KB
Loading
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
<!-- 260602Cl: Reflected from ja/appendix/a1-geometry.md (lead language: Japanese). -->
2+
3+
# Appendix A1. Detector geometry and coordinate transforms
4+
5+
This page defines, with equations, the **coordinate system, IP tilt correction, and pixel-shape correction** that IPAnalyzer uses to map pixel positions on a flat detector (IP, CCD/CMOS) to diffraction angles. For an overview of the coordinate system, see also the [appendix top page](index.md) and [0. Overview](../0-overview.md).
6+
7+
---
8+
9+
## Coordinate system and parameters
10+
11+
IPAnalyzer consistently uses a **right-handed** coordinate system internally.
12+
13+
- The point where the X-ray or electron beam intersects the IP (the **direct spot**) is taken as the origin $(0,0,0)$, and the $Z$ axis is aligned with the beam propagation direction.
14+
- Treating the sample as infinitesimally small, the distance between the sample and the origin is defined as the **camera length** $\mathrm{CL}$. The sample position is therefore $(0,\ 0,\ -\mathrm{CL})$.
15+
- The $X$ axis is aligned with the scanning direction of the readout laser when the IP is not tilted (the rightward direction of the image). The $Y$ axis therefore points downward on the screen.
16+
- A diffraction ring with cone angle $2\theta$ is observed, on an untilted $XY$ plane, as a perfect circle of radius $\mathrm{CL}\tan 2\theta$.
17+
18+
![Definition of the coordinate system](../../assets/references/geometry-coordinate-system.png){width=520px}
19+
20+
Free rotation of a 3D object inherently requires three axes, but because the Debye-ring distribution is invariant under rotation about the $Z$ axis, the $X$ axis can be chosen arbitrarily. This removes one degree of freedom, so the IP tilt can be expressed with **two variables** $\varphi,\ \tau$.
21+
22+
!!! note "Correspondence with (WIN)PIP"
23+
The legacy software PIP expresses the tilt with a different pair of angles $(\beta,\ \Phi)$. The conversion from $(\beta,\ \Phi)$ to IPAnalyzer's $(\varphi,\ \tau)$ is $(\beta,\ \Phi)\rightarrow(270^\circ-\beta,\ \Phi)$. For details, see "Relationship with (WIN)PIP" in [0. Overview](../0-overview.md).
24+
25+
---
26+
27+
## IP tilt correction
28+
29+
The tilt of the IP with respect to the optical axis (the $Z$ axis) is represented by a rotation whose axis is a line passing through the origin and lying in the $XY$ plane. This rotation can be written as the rotation matrix $R = R_2\,R_1\,R_2^{-1}$, an operation that rotates by $\tau$ along ($R_1$) an axis that has been rotated by $\varphi$ about the $Z$ axis ($R_2$).
30+
31+
$$
32+
R_2 = \begin{pmatrix} \cos\varphi & -\sin\varphi & 0 \\ \sin\varphi & \cos\varphi & 0 \\ 0 & 0 & 1 \end{pmatrix},
33+
\qquad
34+
R_1 = \begin{pmatrix} 1 & 0 & 0 \\ 0 & \cos\tau & -\sin\tau \\ 0 & \sin\tau & \cos\tau \end{pmatrix}
35+
$$
36+
37+
This is equivalent to a rotation by angle $\tau$ about the unit vector $\mathbf{n} = (\cos\varphi,\ \sin\varphi,\ 0)$ that makes angle $\varphi$ with the $X$ axis in the $XY$ plane, and expanding gives
38+
39+
$$
40+
R = R_2\,R_1\,R_2^{-1} =
41+
\begin{pmatrix}
42+
\cos^2\varphi + \cos\tau\,\sin^2\varphi & \cos\varphi\sin\varphi\,(1-\cos\tau) & \sin\varphi\sin\tau \\
43+
\cos\varphi\sin\varphi\,(1-\cos\tau) & \cos^2\varphi\,\cos\tau + \sin^2\varphi & -\cos\varphi\sin\tau \\
44+
-\sin\varphi\sin\tau & \cos\varphi\sin\tau & \cos\tau
45+
\end{pmatrix}
46+
$$
47+
48+
### Forward transform (untilted plane → tilted IP)
49+
50+
A point $P_1 = (X,\ Y,\ 0)$ on the untilted $XY$ plane maps to $P_2 = R\,P_1$ on the tilted IP.
51+
52+
$$
53+
P_2 =
54+
\begin{pmatrix}
55+
X\,(\cos^2\varphi + \cos\tau\sin^2\varphi) + Y\,\cos\varphi\sin\varphi\,(1-\cos\tau) \\
56+
X\,\cos\varphi\sin\varphi\,(1-\cos\tau) + Y\,(\cos^2\varphi\cos\tau + \sin^2\varphi) \\
57+
-X\,\sin\varphi\sin\tau + Y\,\cos\varphi\sin\tau
58+
\end{pmatrix}
59+
$$
60+
61+
### Projection (tilted IP → untilted plane)
62+
63+
What is actually needed is the inverse direction, namely the $XY$-plane coordinate that a "pixel observed on the tilted IP" would occupy if there were no tilt. This is given by the **central (perspective) projection** that finds the point $P_3$ where the line joining a point on the tilted IP and the sample $(0,0,-\mathrm{CL})$ intersects the $XY$ plane. Since this is a projective transform with the sample as the center of projection,
64+
65+
$$
66+
P_3 = \frac{\mathrm{CL}}{\mathrm{CL} + (P_2)_z}\,\big((P_2)_x,\ (P_2)_y,\ 0\big)
67+
$$
68+
69+
results. Because the entire tilt correction is a linear (projective in homogeneous coordinates) transform, the position of each pixel can be computed quickly on a computer.
70+
71+
---
72+
73+
## Pixel-shape correction
74+
75+
The pixel shape of the IP is treated as a **parallelogram** with length $\mathrm{PixSizeX}$ along the $X$ axis, length $\mathrm{PixSizeY}$ along the $Y$ axis, and a deviation from a right angle (distortion angle) $\xi$. A nonzero $\xi$ means that there is an offset in the start position of the readout laser scan, and this software assumes that this offset is constant along the $Y$ axis.
76+
77+
The actual coordinate $P$ of the pixel that is $\mathrm{PixNumX}$ away in the $X$ direction and $\mathrm{PixNumY}$ away in the $Y$ direction, counting from the central pixel, is given by
78+
79+
$$
80+
P =
81+
\begin{pmatrix} \mathrm{PixSizeX} & \mathrm{PixSizeY}\,\sin\xi & 0 \\ 0 & \mathrm{PixSizeY} & 0 \\ 0 & 0 & 1 \end{pmatrix}
82+
\begin{pmatrix} \mathrm{PixNumX} \\ \mathrm{PixNumY} \\ 0 \end{pmatrix}
83+
=
84+
\begin{pmatrix} \mathrm{PixNumX}\cdot\mathrm{PixSizeX} + \mathrm{PixNumY}\cdot\mathrm{PixSizeY}\,\sin\xi \\ \mathrm{PixNumY}\cdot\mathrm{PixSizeY} \\ 0 \end{pmatrix}
85+
$$
86+
87+
By combining this pixel-shape correction with the tilt correction described above, any pixel on a tilted IP can be mapped to its correct position on the untilted $XY$ plane. This mapping is the basis for the parameter determination in the next chapter and for [A3. Image integration](a3-image-integration.md).

0 commit comments

Comments
 (0)