-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathca_arn.py
More file actions
60 lines (50 loc) · 1.88 KB
/
Copy pathca_arn.py
File metadata and controls
60 lines (50 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
from arn import *
import numpy as np
def getmoore(x, y):
return [(x,y+1), (x+1, y+1), (x+1,y), (x+1, y-1),
(x,y-1), (x-1, y-1), (x-1,y), (x-1, y+1)]
def getvonneumann(x, y):
return [(x,y+1), (x+1,y),
(x,y-1), (x-1,y)]
_CELLSIZE = 5
_INTENSITY = 2
_COEFFICIENT = .2
if __name__ == '__main__':
arnconfigfile = '../configfiles/arnsim.cfg'
log.setLevel(logging.DEBUG)
cfg = ConfigParser.ConfigParser()
cfg.readfp(open(arnconfigfile))
proteins=[]
nump = 0
try:
f = open(sys.argv[1], 'r')
genome = BitStream(bin=f.readline())
arnet = ARNetwork(genome, cfg)
except:
while nump < 3:
genome = BitStream(float=random.random(), length=32)
for i in range(cfg.getint('default','initdm')):
genome = dm_event(genome,
.02)
arnet = ARNetwork(genome, cfg)
nump = len(arnet.promlist)
f = open('genome.save','w')
f.write(genome.bin)
f.close
for p in arnet.proteins: print p
c = Cell(arnet,_CELLSIZE)
# for x in range(_CELLSIZE):
# for y in range(_CELLSIZE):
# for k in arnet.promlist:
# print [c.proteins[k][e[0]][e[1]]
# for e in getneighbors(x,y)+[(x,y)]
# if 0 < e[0] < c.cellsize and
# 0 < e[1] < c.cellsize]
cchistory=nparray(c.ccs)
for i in range(2):
c.stepsimulate()
cchistory = np.column_stack((cchistory,c.ccs))
displayARNresults(arnet.proteins, cchistory)
#c.diffuseproteins(_COEFFICIENT,_INTENSITY)
#for k,v in c.proteins.items():
# print k, v