Skip to content

Commit 327d24e

Browse files
committedOct 29, 2015
Scripts to generate figures for publication
1 parent 5ee6868 commit 327d24e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+143422
-0
lines changed
 

‎paper-2015/Fig2_elecModels/Fig2A.py

+527
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import numpy as np
2+
from pylab import *
3+
from itertools import islice
4+
fh = open('wt.xplot',mode='r')
5+
6+
fulltime = 1200 #s
7+
plotdt = 1 #s
8+
numpts = int(fulltime/plotdt)+1
9+
10+
print 'reading'
11+
wts = []
12+
while True:
13+
next_line = ''
14+
while 'plotname' not in next_line:
15+
next_line = fh.readline()
16+
if next_line == '': break
17+
if next_line == '': break
18+
next_wt = [float(fh.readline()) for i in range(numpts)]
19+
wts.append(next_wt)
20+
print 'weight',len(wts)
21+
22+
23+
hiAve = np.zeros( len( wts[0] ) )
24+
loAve = np.zeros( len( wts[0] ) )
25+
numHi = 0
26+
for i in wts:
27+
if i[0] > 0.5:
28+
hiAve += np.array( i )
29+
numHi += 1
30+
else:
31+
loAve += np.array( i )
32+
33+
34+
hiAve /= numHi
35+
loAve /= ( len( wts ) - numHi )
36+
37+
def dumpVec( f, name, vec ):
38+
f.write( '/newplot\n' )
39+
f.write( '/plotname ' + name + '\n' )
40+
for i in vec:
41+
f.write( str( i ) + '\n' )
42+
43+
f = open( 'averageOfxplots', 'w' )
44+
dumpVec( f, 'highAverage', hiAve )
45+
dumpVec( f, 'lowAverage', loAve )
46+
dumpVec( f, 'highExample', wts[4] )
47+
dumpVec( f, 'lowExample', wts[5] )
48+
f.close()
49+
50+
51+
print 'numHi = ', numHi, ' plotting...'
52+
figure()
53+
plot(transpose(wts))
54+
plot( hiAve, linewidth=4 )
55+
plot( loAve, linewidth=4 )
56+
show()

0 commit comments

Comments
 (0)
Please sign in to comment.