|
106 | 106 | " \"_calibration\",\n", |
107 | 107 | " torch.tensor(\n", |
108 | 108 | " [\n", |
109 | | - " [dely, 0, 0, -y0],\n", |
110 | | - " [0, delx, 0, -x0],\n", |
| 109 | + " [delx, 0, 0, x0],\n", |
| 110 | + " [0, dely, 0, y0],\n", |
111 | 111 | " [0, 0, sdd, 0],\n", |
112 | 112 | " [0, 0, 0, 1],\n", |
113 | 113 | " ]\n", |
|
120 | 120 | "\n", |
121 | 121 | " @property\n", |
122 | 122 | " def delx(self):\n", |
123 | | - " return self._calibration[1, 1].item()\n", |
| 123 | + " return self._calibration[0, 0].item()\n", |
124 | 124 | "\n", |
125 | 125 | " @property\n", |
126 | 126 | " def dely(self):\n", |
127 | | - " return self._calibration[0, 0].item()\n", |
| 127 | + " return self._calibration[1, 1].item()\n", |
128 | 128 | "\n", |
129 | 129 | " @property\n", |
130 | 130 | " def x0(self):\n", |
131 | | - " return -self._calibration[1, -1].item()\n", |
| 131 | + " return -self._calibration[0, -1].item()\n", |
132 | 132 | "\n", |
133 | 133 | " @property\n", |
134 | 134 | " def y0(self):\n", |
135 | | - " return -self._calibration[0, -1].item()\n", |
| 135 | + " return -self._calibration[1, -1].item()\n", |
136 | 136 | "\n", |
137 | 137 | " @property\n", |
138 | 138 | " def reorient(self):\n", |
|
170 | 170 | " center = torch.tensor([[0.0, 0.0, 1.0]], device=device)\n", |
171 | 171 | "\n", |
172 | 172 | " # Use the standard basis for the detector plane\n", |
173 | | - " basis = torch.tensor([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0]], device=device)\n", |
| 173 | + " basis = torch.tensor([[0.0, 1.0, 0.0], [1.0, 0.0, 0.0]], device=device)\n", |
174 | 174 | "\n", |
175 | 175 | " # Construct the detector plane with different offsets for even or odd heights\n", |
176 | 176 | " # These ensure that the detector plane is centered around (0, 0, 1)\n", |
|
180 | 180 | " # Construct equally spaced points along the basis vectors\n", |
181 | 181 | " t = torch.arange(-self.height // 2, self.height // 2, device=device) + h_off\n", |
182 | 182 | " s = torch.arange(-self.width // 2, self.width // 2, device=device) + w_off\n", |
183 | | - " if self.reverse_x_axis:\n", |
| 183 | + "\n", |
| 184 | + " t = -t\n", |
| 185 | + " s = -s\n", |
| 186 | + " if not self.reverse_x_axis:\n", |
184 | 187 | " s = -s\n", |
| 188 | + "\n", |
185 | 189 | " coefs = torch.cartesian_prod(t, s).reshape(-1, 2)\n", |
186 | 190 | " target = torch.einsum(\"cd,nc->nd\", basis, coefs)\n", |
187 | 191 | " target += center\n", |
|
0 commit comments