diff --git a/src/dials/algorithms/centroid/__init__.py b/src/dials/algorithms/centroid/__init__.py index 4ce44936c9..16f747ad69 100644 --- a/src/dials/algorithms/centroid/__init__.py +++ b/src/dials/algorithms/centroid/__init__.py @@ -81,8 +81,6 @@ def tof_centroid_px_to_mm_panel(panel, scan, position, variance, sd_error): tof = scan.get_property("time_of_flight") # (usec) frames = [i + 1 for i in range(len(tof))] frame_to_tof = frame_to_tof_interpolator(frames, tof) - scale = pixel_size + (tof[0],) - scale2 = tuple(s * s for s in scale) if isinstance(position, tuple): # Convert Pixel coordinate into mm/rad diff --git a/src/dials/algorithms/spot_finding/finder.py b/src/dials/algorithms/spot_finding/finder.py index c2a284b860..e95b5cd69d 100644 --- a/src/dials/algorithms/spot_finding/finder.py +++ b/src/dials/algorithms/spot_finding/finder.py @@ -911,8 +911,24 @@ def __init__( self.experiments = experiments + def _correct_centroid_tof(self, reflections): + + """ + Sets the centroid of the spot to the peak position along the + time of flight, as this tends to more accurately represent the true + centroid for spallation sources. + """ + + x, y, tof = reflections["xyzobs.px.value"].parts() + peak_x, peak_y, peak_tof = reflections["shoebox"].peak_coordinates().parts() + reflections["xyzobs.px.value"] = flex.vec3_double(x, y, peak_tof) + + return reflections + def _post_process(self, reflections): + reflections = self._correct_centroid_tof(reflections) + n_rows = reflections.nrows() panel_numbers = flex.size_t(reflections["panel"]) reflections["L1"] = flex.double(n_rows)