Bidirectional coordinate warping derived from alignment data.
A WarpMap converts coordinates from a source timeline to a target timeline (and back) using linear interpolation between anchor points extracted from a timetoalign.MatchLine.
Internally it delegates to an timetoalign.maps.interpolation.InterpolationMap for O(log n) lookup. The materialise() method produces a complete copy of a source timetoalign.Timeline with all coordinates warped to the target’s coordinate space.
Explicit target representation validator or inferred homogeneous anchor representation.
None
Returns
Name
Type
Description
'WarpMap'
A new WarpMap.
Raises
Name
Type
Description
TypeError
If coordinate lists use unsupported or mixed scalar forms.
ValueError
If fewer than two pairs exist, typed identities or axis metadata conflict, source values are ambiguous, or remaining source coordinates are not strictly increasing.
Build a WarpMap from a MatchLine’s coordinate pairs.
Extracts (source_coord, target_coord) pairs from the MatchLine for the given target timeline, deduplicates compatible chord coordinates, and constructs the interpolation map. A repeated source coordinate with materially different targets is rejected.
Parameters
Name
Type
Description
Default
match_line
'MatchLine'
The MatchLine providing ordered stamps.
required
target_timeline_id
str
The target timeline to warp towards.
required
source_unit
'TimeUnit | None'
Explicit source unit, which must match every anchor.
None
target_unit
'TimeUnit | None'
Explicit target unit, which must match every anchor.
Warp a collection of source positions to the target axis.
Parameters
Name
Type
Description
Default
at
CoordinateCollection
Source positions to resolve atomically.
required
timeline_id
str | None
Optional target-axis identity validator.
None
format
CoordinateFormat
Requested coordinate output format.
'id_coordinate'
rounding
Rounding
Integral projection mode.
'round'
Returns
Name
Type
Description
list[CoordinateResult] | pd.Series
A list of projections or canonical-value Series.
inverse
alignment.WarpMap.inverse()
Return the cached inverse map with source and target swapped.
Returns
Name
Type
Description
'WarpMap'
A WarpMap converting target coordinates back to source coordinates.
Raises
Name
Type
Description
ValueError
If the target coordinates are not strictly monotonic (map is not invertible).
materialise
alignment.WarpMap.materialise(source_timeline)
Produce a new Timeline with all contents warped to target coordinates.
Creates a complete copy of the source timeline where every coordinate (events, children, regions) is converted by calling this map. The resulting timeline:
Has length equal to the mapped source_timeline.length
Preserves the source’s unit (unless target_unit differs)
Contains warped copies of all events
Contains warped copies of all children (recursively)
Contains warped copies of all regions
Carries an inverse WarpMap as a ConversionMap for traceability
Parameters
Name
Type
Description
Default
source_timeline
'Timeline'
The timeline to warp.
required
Returns
Name
Type
Description
'Timeline'
A new Timeline with warped coordinates.
Raises
Name
Type
Description
ValueError
If source_timeline.id does not match self.source_timeline_id.
to_dict
alignment.WarpMap.to_dict()
Serialize to dictionary.
Returns
Name
Type
Description
dict[str, Any]
Dict with timeline IDs, units, and coordinate arrays.