Skip to content

Commit

Permalink
Merge pull request #28 from toastisme/add_refl_ids_to_centroid_bbox_info
Browse files Browse the repository at this point in the history
add_refl_ids_to_centroid_bbox_info
  • Loading branch information
toastisme authored Aug 16, 2023
2 parents 3acb31f + 400ff01 commit f245920
Showing 1 changed file with 5 additions and 2 deletions.
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

0 comments on commit f245920

Please sign in to comment.