AlignmentAnchor

AlignmentAnchor(timeline_a_id, coordinate_a, timeline_b_id, coordinate_b)

A coordinate pair associating one coordinate on timeline A with one coordinate on timeline B.

A neutral record with no claim semantics. AlignmentAnchors are value objects: two anchors with the same coordinates and timeline IDs are equivalent regardless of how they were created.

Only synchronous MatchClaim instances produce AlignmentAnchors. Non-synchronous claims (conceptual matches, NOMATCH) have no anchors.

Attributes: timeline_a_id: First timeline’s unique identifier. coordinate_a: Coordinate in first timeline. timeline_b_id: Second timeline’s unique identifier. coordinate_b: Coordinate in second timeline.

Examples: >>> anchor = AlignmentAnchor( … timeline_a_id=“score:1”, … coordinate_a=100.0, … timeline_b_id=“recording:1”, … coordinate_b=45.5, … ) >>> anchor.get_coordinate_for(“score:1”) 100.0

Attributes

Name Description
coordinates Return tuple of coordinates.
timelines Return tuple of timeline IDs.

Methods

Name Description
connects Check if this anchor connects to a specific timeline.
connects_both Check if this anchor connects two specific timelines.
from_dict Deserialize from dictionary.
get_coordinate_for Get the coordinate for a specific timeline.
to_dict Serialize to dictionary for storage.

connects

AlignmentAnchor.connects(timeline_id)

Check if this anchor connects to a specific timeline.

Args: timeline_id: The timeline to check.

Returns: True if the anchor involves this timeline.

connects_both

AlignmentAnchor.connects_both(timeline_a_id, timeline_b_id)

Check if this anchor connects two specific timelines.

Args: timeline_a_id: First timeline. timeline_b_id: Second timeline.

Returns: True if the anchor connects exactly these two timelines.

from_dict

AlignmentAnchor.from_dict(data)

Deserialize from dictionary.

get_coordinate_for

AlignmentAnchor.get_coordinate_for(timeline_id)

Get the coordinate for a specific timeline.

Args: timeline_id: The timeline to get coordinate for.

Returns: The coordinate, or None if timeline not in this anchor.

to_dict

AlignmentAnchor.to_dict()

Serialize to dictionary for storage.