A TimelineGroup holds timelines (or sections thereof) that are commensurable - i.e., bijectively mapped to each other via linear interpolation. The group is defined by a timestamp table where each row is a boundary instant.
Between any two adjacent timestamps, all present timelines have coordinates that can be converted via linear interpolation.
Like Timeline, a Group can be locked to prevent extension.
Attributes
Name
Type
Description
id
str
Unique identifier for this group.
name
str | None
Optional human-readable name.
is_locked
bool
Whether the group can be extended.
meta
dict[str, Any]
Additional metadata dictionary.
Examples
>>># Create empty group>>> group = TimelineGroup(id="my_group")
>>># Or create with initial timelines>>> group = TimelineGroup(id="my_group", timelines=[dgt1, audio])
The timeline’s full extent (0 to length) becomes commensurable with the group between the specified start and end boundaries.
This method works the same whether the group is empty or already has timelines. For an empty group, start/end default to the timeline’s own boundaries (0 and length).
Parameters
Name
Type
Description
Default
timeline
'Timeline'
The timeline or Child to add. If a Child, its 0-origin extent is used. If a Timeline, its full extent (0 to length).
Where this timeline’s section STARTS in the group. - CoordinateSpec: Coordinate in the alignment-reference timeline - IdCoordinate: Coordinate with explicit timeline_id - GroupTimestamp: Use this existing timestamp - float: Coordinate (only if single timeline in group) - None: Use group’s current start, or 0 if empty
>>># Extend group with new timeline>>> group.add_timeline(... extended_audio,... end=IdCoordinate(200.0, TimeUnit.seconds, "extended_audio:1"),... allow_extension=True,... )
Unfold ALL timelines in this group via a single flow.
Uses the flow controller’s repeat structure to compute section boundaries in the reference timeline’s coordinate space, then resolves those boundaries into every other timeline’s coordinates via the group’s interpolation maps. Each member is unfolded along its own resolved played spans: a new timeline of the member’s same concrete type with one appended child (plus a matching named Region) per section, in unfolded coordinates.
This is the group-level equivalent of timetoalign.timelines.flow.create_unfolded_timeline, but applied to every member at once. It shares the append-children assembly via unfold_via_flowmap, so each member’s children and Regions carry the same per-section names as the single-timeline path (repeats suffixed -rend2, -rend3 …).
Parameters
Name
Type
Description
Default
flow
'Flow'
The computed Flow (from controller.compute_flow()).
required
flow_controller
'FlowControllerBase'
The FlowControllerBase that produced the flow. Required to convert flow sections to quarter-beat coordinates.
required
reference_timeline_id
str
ID of the timeline whose coordinate space the flow is defined in (typically the score CLT). Section boundaries are resolved here first, then mapped to all other timelines.
required
include_children
bool
Whether to recursively slice child timelines within each section.
True
name
str | None
Name for the returned group. Defaults to f"{self.name} (unfolded)".
None
Returns
Name
Type
Description
'TimelineGroup'
A new TimelineGroup containing the unfolded timelines. Each
'TimelineGroup'
member keeps its original timeline ID, is the same concrete type as
'TimelineGroup'
its source, and carries one appended child and Region per section.
'TimelineGroup'
The reference timeline additionally carries a reverse FlowMap
'TimelineGroup'
(id "source") and a forward FlowMap (id f"forward_{flow.id}").
Raises
Name
Type
Description
KeyError
If reference_timeline_id is not in the group.
ValueError
If the flow controller cannot compute QB sections.
Convert a coordinate from one timeline to another.
This is a convenience method that gets the timestamp at the source coordinate and returns the target timeline’s coordinate from it.
Parameters
Name
Type
Description
Default
coordinate
CoordinateSpec
The coordinate value to convert. Accepts a raw int/float/Fraction, a Coordinate, or an IdCoordinate. A unit-qualified coordinate is resolved by the source timeline, and an IdCoordinate must agree with source.
required
source
str
Source timeline ID.
required
target
str
Target timeline ID.
required
relative_to
Literal['group', 'original']
“group” - coordinate is relative to timeline’s 0-origin IN THIS GROUP “original” - coordinate is relative to timeline’s ORIGINAL origin
'group'
Returns
Name
Type
Description
float | None
The converted coordinate, or None if target timeline is not
float | None
present at this coordinate.
Raises
Name
Type
Description
KeyError
If source or target timeline is not in the group.
ValueError
If coordinate is outside the source timeline’s range.
Get events from all timelines in the group, concatenated.
Collects events from all member timelines (or a specific one) and concatenates their Arrow tables into a single EventData. Each row includes a timeline_id field identifying the source timeline. A member-provided timeline_id column is discarded because group membership is authoritative.
Parameters
Name
Type
Description
Default
timeline_id
str | None
If provided, only return events from this timeline. Supports partial string and regex matching.
None
**kwargs
Any
Passed through to each timeline’s get_events() method (e.g., min_coord, max_coord, event_type).
{}
Returns
Name
Type
Description
EventData
EventData with events from all (or specified) timelines. Includes
EventData
a timeline_id field and standard event fields (start,
EventData
end, event_type, etc.).
Examples
>>># Get all events from all timelines>>> df = group.get_events().to_dataframe()
>>># Get events from a specific timeline>>> df = group.get_events(timeline_id="clt1").to_dataframe()
>>># Get events with filters>>> df = group.get_events(... event_type="Note", min_coord=0.0, max_coord=100.0... ).to_dataframe()
Get the coordinate range for a timeline in the group.
Parameters
Name
Type
Description
Default
timeline_id
str
The timeline to query.
required
relative_to
Literal['group', 'original']
Coordinate system for the result.
'group'
Returns
Name
Type
Description
tuple[float, float] | None
(start, end) tuple, or None if timeline not in group.
get_timeline
timelines.TimelineGroup.get_timeline(timeline_id)
Get a timeline by ID.
Supports partial string and regex matching: 1. Exact match: If timeline_id matches an ID exactly, returns it. 2. Substring match: If timeline_id is a substring of exactly one ID, returns that timeline. If multiple match, returns the first and warns. 3. Regex match: If timeline_id is a valid regex, matches via re.search(). Same first-match logic with warning.
Parameters
Name
Type
Description
Default
timeline_id
str
The timeline’s unique identifier, or a partial/regex pattern.
This is the primary coordinate resolution API for TimelineGroup. Returns a proper TimeStamp object (same as Timeline.get_timestamp).
Parameters
Name
Type
Description
Default
coordinate
CoordinateSpec
The query coordinate. Can be: - int/float/Fraction: Raw value, timeline_id required - Coordinate: Value with unit, timeline_id required - IdCoordinate: Value with unit AND timeline_id (timeline_id param optional)
required
timeline_id
str | None
Which timeline the coordinate refers to. Required unless coordinate is an IdCoordinate.
None
relative_to
Literal['group', 'original']
“group” - coordinate is relative to timeline’s 0-origin IN THIS GROUP (default; e.g., “3 seconds into this group”) “original” - coordinate is relative to timeline’s ORIGINAL origin (e.g., “50 seconds in the original timeline”) NOTE: Currently not implemented, reserved for future use.
'group'
conversion_maps
ConversionMapsSpec
Whether to include C-Map values in timestamp. - True (default): C-Maps accessible via ts.get_unit() and ts[“unit_name”] - False/None: Only timeline coordinates
Get timestamps at multiple coordinates - the batch version of get_timestamp_at.
This is the DEAD-SIMPLE API for batch coordinate transfer: pass a sequence of coordinates and get back a DataFrame with one field per timeline and per C-Map.
Parameters
Name
Type
Description
Default
coordinates
Sequence[CoordinateSpec]
Sequence of CoordinateSpec to query.
required
timeline_id
str
Which timeline the coordinates refer to.
required
conversion_maps
ConversionMapsSpec
Whether to include C-Map fields from member timelines. - True (default): Include all attached C-Maps - False/None: Only timeline coordinates
True
units
bool
If True (default), append units to field names.
True
Returns
Name
Type
Description
pd.DataFrame
DataFrame with one row per coordinate, one field per timeline and C-Map.
How to name the DataFrame fields. Options: - None or ColumnNaming.name (default): Use timeline/cmap name - ColumnNaming.id: Use timeline/cmap id - Callable: Function taking (name, metadata_dict) -> new_name - list[str]: Explicit field names
None
units
bool
If True (default), append units to field names like “name (unit)”.
True
format
str
Output format. Currently only “pandas” is supported.
'pandas'
Returns
Name
Type
Description
pd.DataFrame
pandas DataFrame with:
pd.DataFrame
- Fields named according to the fields parameter
pd.DataFrame
- Units appended if units=True
pd.DataFrame
- Integer fields using pandas nullable Int64 dtype