rendered paste bodyimport logginglogging.basicConfig(level=1) # be very verbose with logging for nowdef evaluate(function, x): return function(x)times = []def mintime(): return times[0]def maxtime(): return times[-1]"""sens2.csv sample:1328565067.000,0.0963890795246276,0.02450452482438531328565067.050,0.227296347215609,0.08356794117035791328565067.100,0.240972698811569,0.0612613120609633"""if __name__ == '__main__': input_ = file('/Users/hdiwan/Dropbox/iMeee/data/sens2.csv', 'r') lines = input_.read() d1 = d2 = {} lineNumber = 0 for line in lines.split(u'\n'): lineNumber = lineNumber + 1 part = line.split(u',') try: xval = float(part[1]) yval = float(part[2]) d1 = {part[0] : xval} d2 = {part[0] : yval} times.append(part[0]) except IndexError: # logging.log(5, u'{'+unicode(lineNumber)+u'}: '+line) continue from scipy import interpolate,integrate t = interpolate.UnivariateSpline(d1.values(), d2.values()) print integrate.dblquad(evaluate, min(times), max(times), mintime, maxtime)