コード例 #1
0
ファイル: lr.py プロジェクト: pekkosk/hotbit
 def read_spectrum(self, filename):
     """ Read the linear response from given file.
     
     Format: energy & oscillator strength.
     """
     o = open(filename, "r")
     data = mix.read(filename)
     self.omega, self.F, self.collectivity = data[:, 0], data[:, 1], data[:, 2]
コード例 #2
0
 def read_spectrum(self, filename):
     """ Read the linear response from given file.
     
     Format: energy & oscillator strength.
     """
     o = open(filename, 'r')
     data = mix.read(filename)
     self.omega, self.F, self.collectivity = data[:, 0], data[:, 1], data[:,
                                                                          2]
コード例 #3
0
            fortran+=len( open(dirpath+'/'+file).readlines() )
        if file[-1:]=='c' or file[-1:]=='h':
            c+=len( open(dirpath+'/'+file).readlines() )
        

o=open(datafile,'a')
t=time()
print>>o, t, python, fortran, c
o.close()

fig = pl.figure()
ax = fig.add_subplot(111)

# plot the line info
t0=1223991504.5
data=mix.read(datafile)
timetuples = [localtime(sec) for sec in data[:,0]]
dates = [datetime.date(a[0],a[1],a[2]) for a in timetuples]
#data[:,0]-=t0
#data[:,0]/=356*24*3600
#pl.plot(dates,data[:,1])
#xs, ys = pl.poly_between(data[:,0],0,data[:,1])
xs, ys = pl.poly_between(dates,0,data[:,1])
pl.fill(xs,ys,label='python')
xs, ys = pl.poly_between(dates,data[:,1],data[:,1]+data[:,2])
pl.fill(xs,ys,label='fortran')
xs, ys = pl.poly_between(dates,data[:,1]+data[:,2],data[:,1]+data[:,2]+data[:,3])
pl.fill(xs,ys,label='C')
pl.title('lines of code in hotbit')
pl.xlabel('Years since 14.10 2008')
pl.ylabel('Lines of code')