Skip to content

Commit

Permalink
Fixed pixel line plot requiring idxs reflection column.
Browse files Browse the repository at this point in the history
  • Loading branch information
toastisme committed Dec 14, 2023
1 parent 2e97283 commit 3ff9c9f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
15 changes: 11 additions & 4 deletions src/dials/array_family/flex_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,7 @@ def contains_tof_data(self):
return "tof" in self

def get_pixel_bbox_centroid_positions(
self, panel: int, pixel_pos: Tuple[int, int]
self, panel: int, pixel_pos: Tuple[int, int], return_miller_indices: bool = True
) -> Tuple[list, list, list, list]:
"""
Finds any bounding boxes within px and py on panel
Expand All @@ -1074,7 +1074,9 @@ def get_pixel_bbox_centroid_positions(

sel = self["panel"] == panel
x0, x1, y0, y1, z0, z1 = self["bbox"].select(sel).parts()
idxs = self["idx"].select(sel)
idxs = None
if "idx" in self:
idxs = self["idx"].select(sel)
if "xyzobs.px.value" in self:
centroids = self["xyzobs.px.value"].select(sel)
else:
Expand All @@ -1093,7 +1095,8 @@ def get_pixel_bbox_centroid_positions(
if px >= x0[i] and px <= x1[i]:
if py >= y0[i] and py <= y1[i]:
bbox_pos.append([z0[i], z1[i]])
refl_ids.append(idxs[i])
if idxs:
refl_ids.append(idxs[i])
if centroids:
centroid_pos.append(centroids[i][2])
ci = centroids[i][2]
Expand All @@ -1104,7 +1107,11 @@ def get_pixel_bbox_centroid_positions(
else:
selected_miller_indices.append((0, 0, 0))

return bbox_pos, centroid_pos, refl_ids, selected_miller_indices
if idxs:
return bbox_pos, centroid_pos, refl_ids, selected_miller_indices
elif return_miller_indices:
return bbox_pos, centroid_pos, selected_miller_indices
return bbox_pos, centroid_pos

def find_overlaps(self, experiments=None, border=0):
"""
Expand Down
4 changes: 3 additions & 1 deletion src/dials/util/image_viewer/spotfinder_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -2421,7 +2421,9 @@ def get_pixel_bbox_centroid_positions(self, panel: int, coords: Tuple[int, int])
all_bboxes = []
all_centroids = []
for rt in self.reflection_table_list:
bboxes, centroids = rt.get_pixel_bbox_centroid_positions(panel, coords)
bboxes, centroids = rt.get_pixel_bbox_centroid_positions(
panel, coords, False
)
all_bboxes += list(bboxes)
all_centroids += list(centroids)
return all_bboxes, all_centroids
Expand Down

0 comments on commit 3ff9c9f

Please sign in to comment.