Skip to content

Commit

Permalink
Added filter to TOFSpotFinder._post_process to filter reflections out…
Browse files Browse the repository at this point in the history
…side of the time of flight range.
  • Loading branch information
toastisme committed Mar 4, 2024
1 parent 0f4a435 commit 1646a43
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions newsfragments/XXX.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add filter in `TOFSpotFinder._post_process` to remove any reflections outside of the time of flight range
2 changes: 1 addition & 1 deletion src/dials/algorithms/centroid/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def tof_centroid_px_to_mm_panel(panel, scan, position, variance, sd_error):

pixel_size = panel.get_pixel_size()
tof = scan.get_property("time_of_flight") # (usec)
frames = [i + 1 for i in range(len(tof))]
frames = list(range(len(tof)))
frame_to_tof = frame_to_tof_interpolator(frames, tof)

if isinstance(position, tuple):
Expand Down
14 changes: 14 additions & 0 deletions src/dials/algorithms/spot_finding/finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,20 @@ def _post_process(self, reflections):

reflections = self._correct_centroid_tof(reflections)

# Filter any reflections outside of the tof range
for i, expt in enumerate(self.experiments):
_, _, frame = reflections["xyzobs.px.value"].parts()
tof_frame_range = (0, len(expt.scan.get_property("time_of_flight")) - 1)
if "imageset_id" in reflections:
sel_expt = reflections["imageset_id"] == i
else:
sel_expt = reflections["id"] == i

sel = sel_expt & (
(frame > tof_frame_range[1]) | (frame < tof_frame_range[0])
)
reflections = reflections.select(~sel)

n_rows = reflections.nrows()
panel_numbers = flex.size_t(reflections["panel"])
reflections["L1"] = flex.double(n_rows)
Expand Down

0 comments on commit 1646a43

Please sign in to comment.