-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Here's the current code:
def reduce_poses_to_intersection(
poses: Iterable[Pose],
progress=False,
) -> List[Pose]:
poses = list(poses) # get a list, no need to copy
# look at the first pose
component_names = {c.name for c in poses[0].header.components}
points = {c.name: set(c.points) for c in poses[0].header.components}
# remove anything that other poses don't have
for pose in tqdm(poses[1:], desc="reduce poses to intersection", disable=not progress):
component_names.intersection_update({c.name for c in pose.header.components})
for component in pose.header.components:
points[component.name].intersection_update(set(component.points))
# change datatypes to match get_components, then update the poses
points_dict = {}
for c_name in points.keys():
points_dict[c_name] = list(points[c_name])
poses = [pose.get_components(list(component_names), points_dict) for pose in poses]
return posesIt crashed on this line:
points[component.name].intersection_update(set(component.points))This happens, I think, when an entire component is gone from one of the poses, but not all.
Metadata
Metadata
Assignees
Labels
No labels