diff --git a/newsfragments/XXX.misc b/newsfragments/XXX.misc new file mode 100644 index 0000000000..e2a302055d --- /dev/null +++ b/newsfragments/XXX.misc @@ -0,0 +1 @@ +Add filter in `TOFSpotFinder._post_process` to remove any reflections outside of the time of flight range diff --git a/src/dials/algorithms/centroid/__init__.py b/src/dials/algorithms/centroid/__init__.py index d650f9232b..f78ce90bab 100644 --- a/src/dials/algorithms/centroid/__init__.py +++ b/src/dials/algorithms/centroid/__init__.py @@ -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): diff --git a/src/dials/algorithms/spot_finding/finder.py b/src/dials/algorithms/spot_finding/finder.py index 1db461537a..93ead73dd2 100644 --- a/src/dials/algorithms/spot_finding/finder.py +++ b/src/dials/algorithms/spot_finding/finder.py @@ -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)