Repository navigation
Expand file tree
/
Copy pathmodel_template_v0.py
More file actions
191 lines (155 loc) · 11.3 KB
/
Copy pathmodel_template_v0.py
File metadata and controls
191 lines (155 loc) · 11.3 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# Defining static nodes and edges not represented in the datasets
import hexgrid_reference
hex_areas = []
for j in range(0,10):
hex_areas.append([offset for offset in hexgrid_reference.hex_area(j)])
nodes = []
edges = []
################################################################################
# Input units
input_units = ['R1', 'R2', 'R3', 'R4', 'R5', 'R6', 'R7', 'R8']
################################################################################
# Output units
# All cells that go into lobula layers plus T4a,b,c,d
output_units = ['Tm1', 'Tm2',
'Tm3', 'Tm3-ant', 'Tm3-post',
'Tm4', 'Tm4-ant', 'Tm4-post',
'Tm5a', 'Tm5b', 'Tm5c', 'Tm5d',
'Tm6', 'Tm9', 'Tm16', 'Tm20', 'Tm28',
'TmY3', 'TmY4', 'Tm5Y', 'TmY5a', 'TmY9',
'TmY10','TmY13', 'TmY14', 'TmY15', 'TmY17',
'T1', 'T2', 'T2a', 'T3',
'T4a', 'T4b', 'T4c', 'T4d',
'T5a', 'T5b', 'T5c', 'T5d']
################################################################################
# Nodes
# Motion detection (intensity)
# The PR neurons target 6 different cartridges
nodes.append(('R1', ('stride', (1, 1)), 'relu', 3.5))
nodes.append(('R2', ('stride', (1, 1)), 'relu', 3.5))
nodes.append(('R3', ('stride', (1, 1)), 'relu', 3.5))
nodes.append(('R4', ('stride', (1, 1)), 'relu', 3.5))
nodes.append(('R5', ('stride', (1, 1)), 'relu', 3.5))
nodes.append(('R6', ('stride', (1, 1)), 'relu', 3.5))
# Color vision (30% blue, 70% yellow)
nodes.append(('R7', ('stride', (1, 1)), 'relu', 3.5))
nodes.append(('R8', ('stride', (1, 1)), 'relu', 3.5))
# Lamina monopolar cells
nodes.append(('L1', ('stride', (1, 1)), 'relu', 3.5)) # ON-pathway (Armin Bahl)
nodes.append(('L2', ('stride', (1, 1)), 'relu', 3.5)) # OFF-pathway (Armin Bahl)
nodes.append(('L3', ('stride', (1, 1)), 'relu', 3.5))
nodes.append(('L4', ('stride', (1, 1)), 'relu', 3.5))
nodes.append(('L5', ('stride', (1, 1)), 'relu', 3.5))
# Lamina wide-field neurons
# LAWF: Enhance neural coding by subtracting low-frequency signals from the inputs to motion detection circuits (Tuthill 2014)
# ~ 140 Lawf2 per optic lobe (780 ommatidia = 30(A-P)x26(D-V), 135 Lawf2 = 15(A-P)x9(D-V))
# ~ 5 Lawf2 connections to each cartridge
# Innervation in lamina: 28 cartridges, skewed along dorsal-ventral (A-P: 4, D-V: 7)
# Innervation in medulla: M1 127 cartridges (hexagon sidelength 7), M8-10 19 cartridges (hexagon sidelength 3)
nodes.append(('Lawf2', ('stride', (3, 2)), 'relu', 3.5))
nodes.append(('Lawf1', ('stride', (3, 2)), 'relu', 3.5))
# Amacrine cell
nodes.append(('Am', ('stride', (1, 1)), 'relu', 3.5))
# Centrifugal medulla neurons (feedback)
nodes.append(('C2', ('stride', (1, 1)), 'relu', 3.5))
nodes.append(('C3', ('stride', (1, 1)), 'relu', 3.5))
################################################################################
# Edges
# Lamina connections; Rivera-Alba (2011)
# Changed model: R1 - R6 project into the same cartridge to simplify programming
# All photoreceptors use histamine as a neurotransmitter --> inhibitory (Hardie, 1989).
edges.append(('R1', 'L1', [((0, 0), 40.0)], -1.0, 1.0)) # simplified, accounted for in input data
edges.append(('R2', 'L1', [((0, 0), 43.0)], -1.0, 1.0)) # simplified, accounted for in input data
edges.append(('R3', 'L1', [((0, 0), 37.0)], -1.0, 1.0)) # simplified, accounted for in input data
edges.append(('R4', 'L1', [((0, 0), 38.0)], -1.0, 1.0)) # simplified, accounted for in input data
edges.append(('R5', 'L1', [((0, 0), 38.0)], -1.0, 1.0)) # simplified, accounted for in input data
edges.append(('R6', 'L1', [((0, 0), 45.0)], -1.0, 1.0)) # simplified, accounted for in input data
edges.append(('R1', 'L2', [((0, 0), 46.0)], -1.0, 1.0)) # simplified, accounted for in input data
edges.append(('R2', 'L2', [((0, 0), 45.0)], -1.0, 1.0)) # simplified, accounted for in input data
edges.append(('R3', 'L2', [((0, 0), 39.0)], -1.0, 1.0)) # simplified, accounted for in input data
edges.append(('R4', 'L2', [((0, 0), 41.0)], -1.0, 1.0)) # simplified, accounted for in input data
edges.append(('R5', 'L2', [((0, 0), 39.0)], -1.0, 1.0)) # simplified, accounted for in input data
edges.append(('R6', 'L2', [((0, 0), 47.0)], -1.0, 1.0)) # simplified, accounted for in input data
edges.append(('R1', 'L3', [((0, 0), 11.0)], -1.0, 1.0)) # simplified, accounted for in input data
edges.append(('R2', 'L3', [((0, 0), 10.0)], -1.0, 1.0)) # simplified, accounted for in input data
edges.append(('R3', 'L3', [((0, 0), 4.0)], -1.0, 1.0)) # simplified, accounted for in input data
edges.append(('R4', 'L3', [((0, 0), 8.0)], -1.0, 1.0)) # simplified, accounted for in input data
edges.append(('R5', 'L3', [((0, 0), 6.0)], -1.0, 1.0)) # simplified, accounted for in input data
edges.append(('R6', 'L3', [((0, 0), 12.0)], -1.0, 1.0)) # simplified, accounted for in input data
edges.append(('R1', 'Am', [((0, 0), 36.0)], -1.0, 1.0)) # simplified, accounted for in input data
edges.append(('R2', 'Am', [((0, 0), 39.0)], -1.0, 1.0)) # simplified, accounted for in input data
edges.append(('R3', 'Am', [((0, 0), 40.0)], -1.0, 1.0)) # simplified, accounted for in input data
edges.append(('R4', 'Am', [((0, 0), 37.0)], -1.0, 1.0)) # simplified, accounted for in input data
edges.append(('R5', 'Am', [((0, 0), 35.0)], -1.0, 1.0)) # simplified, accounted for in input data
edges.append(('R6', 'Am', [((0, 0), 40.0)], -1.0, 1.0)) # simplified, accounted for in input data
edges.append(('R1', 'T1', [((0, 0), 2.0)], -1.0, 1.0)) # simplified, accounted for in input data
edges.append(('R2', 'T1', [((0, 0), 2.0)], -1.0, 1.0)) # simplified, accounted for in input data
edges.append(('R3', 'T1', [((0, 0), 2.0)], -1.0, 1.0)) # simplified, accounted for in input data
edges.append(('R4', 'T1', [((0, 0), 2.0)], -1.0, 1.0)) # simplified, accounted for in input data
edges.append(('R5', 'T1', [((0, 0), 2.0)], -1.0, 1.0)) # simplified, accounted for in input data
edges.append(('R6', 'T1', [((0, 0), 2.0)], -1.0, 1.0)) # simplified, accounted for in input data
# L2 --> R1, R2, L1, L4, L4+x, L4-y, T1
edges.append(('L2', 'R1', [((0, 0), 1.0)], 1.0, 1.0)) # simplified, accounted for in input data
edges.append(('L2', 'R2', [((0, 0), 2.0)], 1.0, 1.0)) # simplified, accounted for in input data
edges.append(('L2', 'L1', [((0, 0), 3.0)], 1.0, 1.0))
edges.append(('L2', 'L4', [((0, 0), 5.0), ((-1, 1), 5.0), ((0, 1), 3.0)], 1.0, 1.0))
edges.append(('L4', 'R1', [((1, -1), 1.0), ((0, -1), 1.0)], 1.0, 1.0)) # simplified, accounted for in input data
edges.append(('L4', 'R2', [((0, -1), 1.0)], 1.0, 1.0)) # simplified, accounted for in input data
edges.append(('L4', 'R3', [((1, -1), 2.0), ((0, -1), 2.0)], 1.0, 1.0)) # simplified, accounted for in input data
edges.append(('L4', 'R4', [((1, -1), 1.0), ((0, -1), 1.0)], 1.0, 1.0)) # simplified, accounted for in input data
edges.append(('L4', 'R5', [((0, 0), 1.0), ((0, -1), 3.0)], 1.0, 1.0)) # simplified, accounted for in input data
edges.append(('L4', 'R6', [((1, -1), 2.0), ((0, -1), 2.0)], 1.0, 1.0)) # simplified, accounted for in input data
edges.append(('L4', 'L2', [((0, 0), 4.0), ((1, -1), 6.0), ((0, -1), 5.0)], 1.0, 1.0))
edges.append(('L4', 'L3', [((0, 0), 0.0), ((1, -1), 1.0), ((0, -1), 1.0)], 1.0, 1.0))
edges.append(('L4', 'L4', [((1, -1), 2.0), (( 0, -1), 3.0), ((-1, 0), 1.0), ((1, 0), 3.0)], 1.0, 1.0))
edges.append(('L4', 'L5', [((0, 0), 2.0), ((1, -1), 3.0), ((0, -1), 2.0)], 1.0, 1.0))
edges.append(('L4', 'Am', [((0, 0), 1.0), ((1, -1), 1.0), ((0, -1), 1.0)], 1.0, 1.0))
# Am --> R1, R2, R4, R5, L1, L2, L3, L4, L5, Am, T1, C2, C3
edges.append(('Am', 'R1', [((0, 0), 1.0)], 1.0, 1.0)) # simplified, accounted for in input data
edges.append(('Am', 'R2', [((0, 0), 1.0)], 1.0, 1.0)) # simplified, accounted for in input data
edges.append(('Am', 'R4', [((0, 0), 2.0)], 1.0, 1.0)) # simplified, accounted for in input data
edges.append(('Am', 'R5', [((0, 0), 2.0)], 1.0, 1.0)) # simplified, accounted for in input data
edges.append(('Am', 'L1', [((0, 0), 1.0)], 1.0, 1.0))
edges.append(('Am', 'L2', [((0, 0), 4.0)], 1.0, 1.0))
edges.append(('Am', 'L3', [((0, 0), 14.0)], 1.0, 1.0))
edges.append(('Am', 'L4', [((0, 0), 5.0)], 1.0, 1.0))
edges.append(('Am', 'Am', [((0, 0), 2.0)], 1.0, 1.0))
edges.append(('Am', 'T1', [((0, 0), 63.0)], 1.0, 1.0))
edges.append(('Am', 'C2', [((0, 0), 1.0)], 1.0, 1.0))
edges.append(('Am', 'C3', [((0, 0), 1.0)], 1.0, 1.0))
# C2 --> L2, L5, Am, Lawf
# C2 is inhibitory (Michael Reiser, 27.01.2017)
edges.append(('C2', 'Am', [((0, 0), 8.0)], -1.0, 1.0))
# C3 --> R3, L1, L2, L3, Am
# C3 is inhibitory (Michael Reiser, 27.01.2017)
edges.append(('C3', 'R3', [((-2, 1), 1.0)], -1.0, 1.0))
edges.append(('C3', 'L1', [((0, 0), 6.0)], -1.0, 1.0))
edges.append(('C3', 'L3', [((0, 0), 1.0)], -1.0, 1.0))
edges.append(('C3', 'Am', [((0, 0), 22.0)], -1.0, 1.0))
lawf2_lamina_range = [(-4,-1),(-3,-1),(-2,-1),(-1,-1),(0,-1),(1,-1),(2,-1),(3,-1),(4,-1),
(-4,0),(-3,0),(-2,0),(-1,0),(0,0),(1,0),(2,0),(3,0),(4,0),
(-5,1),(-4,1),(-3,1),(-2,1),(-1,1),(0,1),(1,1),(2,1),(3,1)]
# Tuthill 2014 (LAWF); "It is likely that wide-field neurons form synapses on most cell types in the lamina [...] high [...] on Am and L3"
# Lawf --> R1, R2, R3, R4, R6, L1, L2, L3, L5, Am, T1, C2, C3, Lawf
# Lawf2 range (distributed to ~5 processes of Lawf2 cells)
edges.append(('Lawf2', 'Lawf2', list(zip(lawf2_lamina_range, [7.0/5.0 for o in lawf2_lamina_range])), 1.0, 1.0))
edges.append(('Lawf2', 'R1', list(zip(lawf2_lamina_range, [1.0/11.0 for o in lawf2_lamina_range])), 1.0, 1.0))
edges.append(('Lawf2', 'R2', list(zip(lawf2_lamina_range, [3.0/11.0 for o in lawf2_lamina_range])), 1.0, 1.0))
edges.append(('Lawf2', 'R3', list(zip(lawf2_lamina_range, [1.0/11.0 for o in lawf2_lamina_range])), 1.0, 1.0))
edges.append(('Lawf2', 'R4', list(zip(lawf2_lamina_range, [1.0/11.0 for o in lawf2_lamina_range])), 1.0, 1.0))
edges.append(('Lawf2', 'R5', list(zip(lawf2_lamina_range, [0.0/11.0 for o in lawf2_lamina_range])), 1.0, 1.0))
edges.append(('Lawf2', 'R6', list(zip(lawf2_lamina_range, [1.0/11.0 for o in lawf2_lamina_range])), 1.0, 1.0))
edges.append(('Lawf2', 'L1', list(zip(lawf2_lamina_range, [2.0/11.0 for o in lawf2_lamina_range])), 1.0, 1.0))
edges.append(('Lawf2', 'L2', list(zip(lawf2_lamina_range, [9.0/11.0 for o in lawf2_lamina_range])), 1.0, 1.0))
edges.append(('Lawf2', 'L3', list(zip(lawf2_lamina_range, [21.0/11.0 for o in lawf2_lamina_range])), 1.0, 1.0))
edges.append(('Lawf2', 'L5', list(zip(lawf2_lamina_range, [1.0/11.0 for o in lawf2_lamina_range])), 1.0, 1.0))
edges.append(('Lawf2', 'Am', list(zip(lawf2_lamina_range, [36.0/11.0 for o in lawf2_lamina_range])), 1.0, 1.0))
edges.append(('Lawf2', 'T1', list(zip(lawf2_lamina_range, [6.0/11.0 for o in lawf2_lamina_range])), 1.0, 1.0))
edges.append(('Lawf2', 'C2', list(zip(lawf2_lamina_range, [6.0/11.0 for o in lawf2_lamina_range])), 1.0, 1.0))
edges.append(('Lawf2', 'C3', list(zip(lawf2_lamina_range, [2.0/11.0 for o in lawf2_lamina_range])), 1.0, 1.0))
# Hypothesis 1: L1/L2 connect to Lawf2 in the M1 layer
edges.append(('L1', 'Lawf2', list(zip(hex_areas[3], [5.0 for o in hex_areas[3]])), 1.0, 1.0))
edges.append(('L2', 'Lawf2', list(zip(hex_areas[3], [5.0 for o in hex_areas[3]])), 1.0, 1.0))
# Hypothesis 2: C2/C3 connect to Lawf2 in the M8-M10 layers
edges.append(('C2', 'Lawf2', list(zip(hex_areas[3], [5.0 for o in hex_areas[3]])), -1.0, 1.0))
edges.append(('C3', 'Lawf2', list(zip(hex_areas[3], [5.0 for o in hex_areas[3]])), -1.0, 1.0))