本文整理汇总了Python中Interval.Interval.viewable方法的典型用法代码示例。如果您正苦于以下问题:Python Interval.viewable方法的具体用法?Python Interval.viewable怎么用?Python Interval.viewable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Interval.Interval
的用法示例。
在下文中一共展示了Interval.viewable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parse
# 需要导入模块: from Interval import Interval [as 别名]
# 或者: from Interval.Interval import viewable [as 别名]
def parse(filehandle):
intervalstart = False
dimno = 0
for line in filehandle:
elems = [x.strip() for x in line.split('=')]
# Filter useless lines
if len(elems) < 2:
continue
if not intervalstart:
if elems[0] == 'Object class':
objectclass = elems[1]
elif elems[0] == 'xmin':
xmin = float(elems[1])
elif elems[0] == 'xmax':
xmax = float(elems[1])
elif elems[0] == 'nx':
size = int(elems[1])
elif elems[0] == 'dx':
shift = float(elems[1])
elif elems[0] == 'x1':
start = float(elems[1])
elif elems[0] == 'maximumNumberOfCoefficients':
dimensions = float(elems[1]) + 1
intervalstart = True
# Increase size to hold first Interval object as padding
mfccTier = Tier(xmin, xmax, size+1, objectclass)
mfccTier.shift = shift
text = np.zeros(dimensions)
first = Interval(0.0, start, text)
mfccTier.addInterval(first)
continue
elif intervalstart:
if elems[0] == 'c0':
dimno = 0
vec = np.zeros(dimensions)
vec[dimno] = float(elems[1])
elif elems[0] == 'numberOfCoefficients':
assert int(elems[1]) <= dimensions
elif elems[0][0] == 'c':
dimno += 1
#print(dimno)
vec[dimno] = float(elems[1])
#print(vec)
if dimensions == dimno+1:
#print('here, ...')
begin = mfccTier[-1].xmax
end = begin + mfccTier.shift
interval = Interval(begin, end, vec)
interval.viewable = False
mfccTier.addInterval(interval)
return mfccTier