Skip to content

Commit 6e0180b

Browse files
Fix incorrectly unrolled snaked grid scans (#253)
It was not shuffling the data for the first grid scan. The code is pretty much obfuscated though, matplotlib plotting the results helped a lot. Co-authored-by: Nicholas Devenish <ndevenish@gmail.com>
1 parent be301d0 commit 6e0180b

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/dlstbx/services/xray_centering.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,8 @@ def add_pia_result(self, rw, header, message):
246246
dlstbx.util.xray_centering.reshape_grid(
247247
cd.data,
248248
(cd.gridinfo.steps_x, cd.gridinfo.steps_y),
249-
cd.gridinfo.snaked,
250-
cd.gridinfo.orientation,
249+
snaked=cd.gridinfo.snaked,
250+
orientation=cd.gridinfo.orientation,
251251
)
252252
]
253253
for _dcid in dcg_dcids:
@@ -261,8 +261,8 @@ def add_pia_result(self, rw, header, message):
261261
dlstbx.util.xray_centering.reshape_grid(
262262
_cd.data,
263263
(_cd.gridinfo.steps_x, _cd.gridinfo.steps_y),
264-
not _cd.gridinfo.snaked, # XXX
265-
_cd.gridinfo.orientation,
264+
snaked=_cd.gridinfo.snaked,
265+
orientation=_cd.gridinfo.orientation,
266266
)
267267
)
268268
else:

src/dlstbx/util/xray_centering.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class GridScan2DResult(GridScanResultBase):
4343

4444

4545
def reshape_grid(
46-
data: np.ndarray, steps: tuple[int, int], snaked: bool, orientation: Orientation
46+
data: np.ndarray, steps: tuple[int, int], *, snaked: bool, orientation: Orientation
4747
) -> np.ndarray:
4848
if orientation == Orientation.VERTICAL:
4949
data = data.reshape(steps)
@@ -84,7 +84,7 @@ def gridscan2d(
8484
message="No good images found",
8585
), "\n".join(output)
8686

87-
data = reshape_grid(data, steps, snaked, orientation).T
87+
data = reshape_grid(data, steps, snaked=snaked, orientation=orientation).T
8888

8989
output.append(f"There are {maximum_spots} reflections in image #{best_image}.")
9090

0 commit comments

Comments
 (0)