representatives#
- irmsd.sorting.representatives.first_by_assignment(items: Sequence[T], assignments: Sequence[SupportsInt]) list[T][source]#
Select the first representative of each assignment label.
- Parameters:
items – Sequence of arbitrary objects (e.g. ASE Atoms, numpy arrays, ints, …).
assignments – Sequence of integer-like labels (same length as items). The i-th entry is the assignment for items[i].
- Returns:
A new list containing the first occurrence of each assignment, in the order the labels first appear.
- Return type:
list[T]
Example
>>> items = list("abcdefgh") >>> assignments = [1, 1, 1, 2, 3, 3, 3, 3] >>> first_by_assignment(items, assignments) ['a', 'd', 'e']