Skip to content

Commit

Permalink
Added method for correcting time of flight spot centroids.
Browse files Browse the repository at this point in the history
  • Loading branch information
toastisme committed Feb 7, 2024
1 parent c90d6fc commit 1de2e91
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/dials/algorithms/centroid/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions src/dials/algorithms/spot_finding/finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1de2e91

Please sign in to comment.