AlignmentAnchor
alignment.AlignmentAnchor()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
| Name | Type | Description |
|---|---|---|
| timeline_a_id | str |
First timeline’s unique identifier. |
| coordinate_a | Coordinate |
Coordinate in first timeline. |
| timeline_b_id | str |
Second timeline’s unique identifier. |
| coordinate_b | Coordinate |
Coordinate in second timeline. |
Examples
>>> anchor = AlignmentAnchor(
... timeline_a_id="score:1",
... coordinate_a=Coordinate(100.0, TimeUnit.quarters),
... timeline_b_id="recording:1",
... coordinate_b=Coordinate(45.5, TimeUnit.seconds),
... )
>>> anchor.get_coordinate_for("score:1")
Coordinate(100.0, quarters)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
alignment.AlignmentAnchor.connects(timeline_id)Check if this anchor connects to a specific timeline.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| timeline_id | str |
The timeline to check. | required |
Returns
| Name | Type | Description |
|---|---|---|
bool |
True if the anchor involves this timeline. |
connects_both
alignment.AlignmentAnchor.connects_both(timeline_a_id, timeline_b_id)Check if this anchor connects two specific timelines.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| timeline_a_id | str |
First timeline. | required |
| timeline_b_id | str |
Second timeline. | required |
Returns
| Name | Type | Description |
|---|---|---|
bool |
True if the anchor connects exactly these two timelines. |
from_dict
alignment.AlignmentAnchor.from_dict(data)Deserialize from dictionary.
get_coordinate_for
alignment.AlignmentAnchor.get_coordinate_for(timeline_id)Get the coordinate for a specific timeline.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| timeline_id | str |
The timeline to get coordinate for. | required |
Returns
| Name | Type | Description |
|---|---|---|
Coordinate | None |
The coordinate, or None if timeline not in this anchor. |
to_dict
alignment.AlignmentAnchor.to_dict()Serialize to dictionary for storage.