Skip to content

Commit 8e21f4d

Browse files
feat-wip: add DFPoseResults dataclass
1 parent 14703e8 commit 8e21f4d

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/gh/diffCheck/diffCheck/df_error_estimation.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from diffCheck import diffcheck_bindings # type: ignore
2020
from diffCheck import df_cvt_bindings
2121
from diffCheck.df_geometries import DFAssembly
22+
from diffCheck.df_poses import DFPosesBeam, DFPose
2223

2324

2425
class NumpyEncoder(json.JSONEncoder):
@@ -268,6 +269,24 @@ def analysis_type(self):
268269
self._analysis_type = self._compute_dfresult_type()
269270
return self._analysis_type
270271

272+
class DFPoseResults():
273+
"""
274+
This class compiles the results of the pose estimation into one object
275+
"""
276+
def __init__(self, assembly: DFAssembly):
277+
self.assembly = assembly
278+
self.pose_history : dict[str, DFPosesBeam] = dict()
279+
self.last_poses : dict[str, DFPose] = dict()
280+
def add_history(self, pose_history):
281+
"""
282+
The pose history is a dictionnary where the keys are the element names ("element_0", "element_1", etc),
283+
and the values are DFPosesBeam objects containing a dictionnary of poses for each element.
284+
"""
285+
self.pose_history = pose_history
286+
for element in pose_history:
287+
self.last_poses[element] = pose_history[element].poses_dictionary[list(pose_history[element].poses_dictionary.keys())[-1]]
288+
289+
271290
# FIXME: ths is currently broken, we need to fix it
272291
def df_cloud_2_df_cloud_comparison(
273292
assembly: DFAssembly,

0 commit comments

Comments
 (0)