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
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" )
IdCoordinate(Fraction(100 , 1 ), quarters, 'score:1' )
Methods
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
timeline_id
str
The timeline to check.
required
Returns
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
timeline_a_id
str
First timeline.
required
timeline_b_id
str
Second timeline.
required
Returns
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,
* ,
format = 'id_coordinate' ,
rounding= 'round' ,
)
Get the coordinate for a specific timeline.
Parameters
timeline_id
str
The timeline to get coordinate for.
required
format
CoordinateFormat
Requested coordinate output format.
'id_coordinate'
rounding
Rounding
Integral projection mode.
'round'
Returns
CoordinateResult | pd.Series
The requested coordinate projection.
Raises
KeyError
If the timeline is not part of this anchor.
to_dict
alignment.AlignmentAnchor.to_dict()
Serialize to dictionary for storage.