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

add_refl_ids_to_centroid_bbox_info #28

Merged
merged 1 commit into from
Aug 16, 2023
Merged
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
7 changes: 5 additions & 2 deletions src/dials/array_family/flex_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,7 @@ def contains_tof_data(self):

def get_pixel_bbox_centroid_positions(
self, panel: int, pixel_pos: Tuple[int, int]
) -> Tuple[list, list]:
) -> Tuple[list, list, list]:

"""
Finds any bounding boxes within px and py on panel
Expand All @@ -1075,6 +1075,7 @@ 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)
if "xyzobs.px.value" in self:
centroids = self["xyzobs.px.value"].select(sel)
else:
Expand All @@ -1083,16 +1084,18 @@ def get_pixel_bbox_centroid_positions(
px = int(pixel_pos[1])
bbox_pos = []
centroid_pos = []
refl_ids = []
for i in range(len(x0)):
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 centroids:
centroid_pos.append(centroids[i][2])
ci = centroids[i][2]
x, y = z0[i], z1[i]
assert ci >= x and ci <= y, f"{ci} {x} {y}"
return bbox_pos, centroid_pos
return bbox_pos, centroid_pos, refl_ids

def find_overlaps(self, experiments=None, border=0):
"""
Expand Down
Loading