#!/usr/bin/python import os,sys,math from scipy.integrate import quad def Iexp(t,tmu,la): return math.exp(-t/tmu)*math.exp(-la*t) def Inorm(t,tmu): return math.exp(-t/tmu) if __name__ == '__main__': tmu = 2197.#ns Lmetal = 1e-6 #per ns Lgas = 30e-6 #per ns t1 = 1050. #ns t2 = 9000. #ns m = 0.99 Lrecon = 1e-6 #per ns In = quad( Inorm, t1, t2, args=(tmu) )[0] I1 = m*quad( Iexp, t1, t2, args=(tmu,Lmetal) )[0] I2 = (1-m)*quad( Iexp, t1, t2, args=(tmu,Lgas) )[0] I3 = quad( Iexp, t1, t2, args=(tmu,Lrecon) )[0] print 'true integral = ',(I1+I2)/In print 'recon integral = ',I3/In print 'difference = ',(I1+I2-I3)/In