Skip to content

Cannot concatenate TextGrids despite identical number and name of tiers #29

@jhdeov

Description

@jhdeov

I have two small TextGrids tg1 and tg2. They have the same number of tiers and tier names, but the concatenate code fails and raises an error.

tg1 = tgt.read_textgrid(file1)
tg2 = tgt.read_textgrid(file2)
print(len(tg1.tiers) == len(tg2.tiers))
print(tg1.get_tier_names() == tg2.get_tier_names())
tg = tgt.util.concatenate_textgrids([tg1,tg2])

Result:

/usr/local/lib/python3.10/dist-packages/tgt/util.py in concatenate_textgrids(textgrids, ignore_nonmatching_tiers, use_absolute_time)
151 if (not ignore_nonmatching_tiers and
152 not all([len(common_tiers) == len(tg) for tg in textgrids])):
--> 153 raise TextGridToolsException(
154 'Different numbers of tiers or non-matching tier names.')
155 ccd_tiers = {}
TextGridToolsException: Different numbers of tiers or non-matching tier names.

I get the same error even when I concatenate a file with itself:

9 tg = tgt.util.concatenate_textgrids([tg1,tg1])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions