def readFloatArrayWithSkip(filename, col):
"Return a floating-point array containing the data from file |filename|."
if not type(col) == list: col = [col]
data = []
from operator import getitem
for line in TextFile(filename):
if line[0] != '#':
fields = string.split(line)
data.append(map(string.atof, [fields[x] for x in col]))
a = Numeric.array(data)
if a.shape[0] == 1 or a.shape[1] == 1:
a = Numeric.ravel(a)
return a
评论列表
文章目录