Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed pixel line plot requiring idxs reflection column. #38

Merged
merged 1 commit into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading