Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

IntervalTier.intervalContaining(time), if index = 0 ,return None #38

Open
yuyanghua opened this issue Mar 5, 2022 · 3 comments
Open

Comments

@yuyanghua
Copy link

class IntervalTier(object)
def intervalContaining(self, time):
i = self.indexContaining(time)
if i :
return self.intervals[i]

indexContaining return 0, ‘ if 0 ’ return false ,then return None。 but must return intervals[0]

@kylebgorman
Copy link
Owner

This is too cryptic for me to interpret. Can you state clearly what the issue is?

@yuyanghua
Copy link
Author

This is one part of your script (see below).

class IntervalTier(object)
    def intervalContaining(self, time):
        i = self.indexContaining(time)
        if i :
            return self.intervals[i]

For this part of script, I think there is something wrong.

test.zip
Based on your script, I wrote an example script named test.py. And I created a TextGrid file named data.TextGrid.
The files of test.py and data.TextGrid are in the attachment.
You can run test.py with data.TextGrid, then you will find what is wrong.

In data.TextGrid, in the first tier there are two intervals. The first interval is from 0 to 1.04s and the second interval is from 1.04 to 5s.
In test.py, for the command, itv = tg.tiers[0].intervalContaining(0.2), I want to find which interval is at 0.2s in the first tier.
The problem is:
When I run test.py, the result turns out to be NONE. It means there is no interval at 0.2s. I think the result is wrong and the correct result should be the 1st interval in the first tier. So, I think there is something wrong with your script.

@kylebgorman
Copy link
Owner

I'm sorry, I still don't understand the example. Can you give actual code (e.g., with an assert statement that shows what you expect to happen), or better yet, file a pull request that gives the behavior you want?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants