Skip to content

Commit e34dd8b

Browse files
committed
notebooks: update path testing notebook
1 parent 96e14f6 commit e34dd8b

File tree

1 file changed

+87
-74
lines changed

1 file changed

+87
-74
lines changed

notebooks/ideas/shifted-readout-steering dyes.ipynb

Lines changed: 87 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -52,106 +52,121 @@
5252
" \"T_outbound\":T_outbound,\n",
5353
" \"T_inbound\": T_inbound,\n",
5454
" \"min_homing_distance\": 300,\n",
55-
" \"motor_factor\": -0.5 if cheat else 0.3,\n",
56-
" \"seed\": None,\n",
57-
" \"record\": [\"memory\", \"TB1\", \"Pontine\", \"motor\", \"theory\", \"CPU4\"],\n",
55+
" \"motor_factor\": -0.25 if cheat else 0.25,\n",
56+
"# \"seed\": 42,\n",
57+
"# \"record\": [\"memory\", \"TB1\", \"Pontine\", \"motor\", \"theory\", \"CPU4\"],\n",
5858
" \"cx\": {\n",
5959
" \"type\": \"dye\",\n",
6060
" \"output_layer\": \"motor\",\n",
6161
" \"params\": {\n",
6262
" \"noise\": 0.1,\n",
63-
" \"phi\": 0.00045,#0.00045,\n",
64-
" \"beta\": 0.1,\n",
63+
" \"phi\": 0.0003,#0.00045,\n",
64+
" \"beta\": 0.3,\n",
6565
" \"k\": 0,\n",
66-
" \"epsilon\":10,\n",
66+
" \"epsilon\":15,\n",
6767
" \"length\": 1, #cm\n",
6868
" \"c_tot\": 0.3, #M\n",
6969
" \"cheat\": cheat,\n",
70-
" \"holonomic\": True\n",
70+
" \"holonomic\": False,\n",
71+
" \"disable_beta_on_outbound\": False\n",
7172
" }\n",
7273
" }\n",
7374
"}\n",
7475
"\n",
75-
"# parameters = {\n",
76-
"# \"type\": \"simulation\",\n",
77-
"# \"T_outbound\":T_outbound,\n",
78-
"# \"T_inbound\": T_inbound,\n",
79-
"# \"motor_factor\": 1,\n",
80-
"# \"min_homing_distance\": 300,\n",
81-
"# \"seed\": 1,\n",
82-
"# \"record\": [\"memory\"],\n",
83-
"# \"cx\": {\n",
84-
"# \"type\": \"weights\",\n",
85-
"# \"params\": {\n",
86-
"# \"noise\": 0.1,\n",
87-
"# \"motor_noise\": 0.1,\n",
88-
"# \"pfn_background_activity\": 0.0,\n",
89-
"# \"mem_gain\": 0.0045,\n",
90-
"# \"mem_fade\": 0.125,\n",
91-
"# \"sigmoid\": False,\n",
92-
"# \"cpu1_slope\": 5.0,\n",
93-
"# \"cpu1_bias\": 2.5,\n",
94-
"# }\n",
95-
"# }\n",
96-
"# }\n",
97-
"\n",
98-
"\n",
9976
"experiment = SimulationExperiment(parameters)\n",
10077
"results = experiment.run(\"test\", config_id=\"1\")\n",
10178
"plt.figure(figsize=(10, 10))\n",
10279
"ax = plt.axes()\n",
10380
"ax.axis(\"equal\")\n",
10481
"results.plot_path(ax, decode=False)\n",
10582
"\n",
106-
"results.report()\n"
83+
"results.report()"
84+
]
85+
},
86+
{
87+
"cell_type": "code",
88+
"execution_count": null,
89+
"id": "eebc0465",
90+
"metadata": {},
91+
"outputs": [],
92+
"source": [
93+
"with open('positions.json', 'w', encoding='utf-8') as f:\n",
94+
" json.dump([p.tolist() for p in results.reconstruct_path()], f)"
95+
]
96+
},
97+
{
98+
"cell_type": "code",
99+
"execution_count": null,
100+
"id": "18219b9f",
101+
"metadata": {},
102+
"outputs": [],
103+
"source": [
104+
"print(results.parameters.keys())"
107105
]
108106
},
109107
{
110108
"cell_type": "code",
111109
"execution_count": null,
112-
"id": "1cf1326f",
110+
"id": "4c2cb266",
113111
"metadata": {},
114112
"outputs": [],
115113
"source": [
116-
"# T = 1600\n",
117114
"\n",
118-
"# def timeline(t):\n",
119-
"# plt.plot([t, t], [-0.5, 16-0.5], '--')\n",
115+
"parameters = {\n",
116+
" \"type\": \"simulation\",\n",
117+
" \"T_outbound\":T_outbound,\n",
118+
" \"T_inbound\": T_inbound,\n",
119+
" \"motor_factor\": 0.25,\n",
120+
" \"min_homing_distance\": 300,\n",
121+
" \"seed\": 1,\n",
122+
" \"record\": [\"memory\"],\n",
123+
" \"cx\": {\n",
124+
" \"type\": \"weights\",\n",
125+
" \"params\": {\n",
126+
" \"noise\": 0.1,\n",
127+
" \"beta\": 0.5,\n",
128+
" \"mem_gain\": 0.0025,\n",
129+
" \"mem_fade\": 0.625,\n",
130+
" \"cheat\": not cheat\n",
131+
" }\n",
132+
" }\n",
133+
"}\n",
120134
"\n",
121-
"# t = results.closest_position_timestep()\n",
122135
"\n",
123-
"# Ts = 1 - results.transmittances().T\n",
124-
"# weights = results.transmittances().T\n",
125-
"# memory = results.concentrations().T\n",
126-
"# # cpu4 = np.array(results.recordings[\"CPU4\"][\"output\"]).T\n",
136+
"experiment = SimulationExperiment(parameters)\n",
137+
"results = experiment.run(\"test\", config_id=\"1\")\n",
138+
"plt.figure(figsize=(10, 10))\n",
139+
"ax = plt.axes()\n",
140+
"ax.axis(\"equal\")\n",
141+
"results.plot_path(ax, decode=False)\n",
127142
"\n",
128-
"# # plt.figure(figsize=(10, 5))\n",
129-
"# # plt.imshow(cpu4, cmap=\"hot\", interpolation=\"nearest\", aspect=\"auto\", norm=clr.Normalize(0, 1))\n",
130-
"# # timeline(T)\n",
131-
"# # plt.title(\"PFN\")\n",
132143
"\n",
133-
"# fig = plt.figure(figsize=(10, 5))\n",
134-
"# plt.imshow(weights, cmap=\"hot\", interpolation=\"nearest\", aspect=\"auto\", norm=clr.Normalize(0, 1))\n",
135-
"# timeline(T)\n",
136-
"# timeline(t)\n",
137-
"# plt.plot([parameters[\"T_outbound\"], parameters[\"T_outbound\"]], [-0.5, 16-0.5], '-')\n",
138-
"# plt.title(\"weights\")\n",
144+
"parameters = {\n",
145+
" \"type\": \"simulation\",\n",
146+
" \"T_outbound\":T_outbound,\n",
147+
" \"T_inbound\": T_inbound,\n",
148+
" \"motor_factor\": 1,\n",
149+
" \"min_homing_distance\": 300,\n",
150+
" \"seed\": 1,\n",
151+
" \"record\": [\"memory\"],\n",
152+
" \"cx\": {\n",
153+
" \"type\": \"pontine\",\n",
154+
" \"params\": {\n",
155+
" \"noise\": 0.1,\n",
156+
" \"holonomic\": False\n",
157+
" }\n",
158+
" }\n",
159+
"}\n",
139160
"\n",
140-
"# fig = plt.figure(figsize=(10, 5))\n",
141-
"# plt.imshow(Ts, cmap=\"hot\", interpolation=\"nearest\", aspect=\"auto\", )#norm=clr.Normalize(0, 1))\n",
142-
"# timeline(T)\n",
143-
"# timeline(t)\n",
144-
"# plt.plot([parameters[\"T_outbound\"], parameters[\"T_outbound\"]], [-0.5, 16-0.5], '-')\n",
145-
"# plt.title(\"1 - Transmittance\")\n",
146-
"# plt.colorbar()\n",
161+
"experiment = SimulationExperiment(parameters)\n",
162+
"results = experiment.run(\"test\", config_id=\"1\")\n",
163+
"plt.figure(figsize=(10, 10))\n",
164+
"ax = plt.axes()\n",
165+
"ax.axis(\"equal\")\n",
166+
"results.plot_path(ax, decode=False)\n",
147167
"\n",
148-
"# plt.figure(figsize=(10, 5))\n",
149-
"# plt.imshow(memory, cmap=\"hot\", interpolation=\"nearest\", aspect=\"auto\", norm=clr.Normalize(0, 0.3))\n",
150-
"# timeline(T)\n",
151-
"# plt.title(\"concentration output\")\n",
152168
"\n",
153-
"# plt.figure(figsize=(10, 5))\n",
154-
"# plt.imshow(weights[:8,:] - weights[8:,:], cmap=\"hot\", interpolation=\"nearest\", aspect=\"auto\", norm=clr.Normalize(-1, 1))\n"
169+
"# results.report()"
155170
]
156171
},
157172
{
@@ -191,25 +206,23 @@
191206
"\n",
192207
"parameters = {\n",
193208
" \"type\": \"simulation\",\n",
194-
" \"T_outbound\":2,\n",
209+
" \"T_outbound\":10,\n",
195210
" \"T_inbound\": 3000,\n",
196211
" \"min_homing_distance\": 0,\n",
197-
" \"motor_factor\": 0.3,\n",
198-
" \"record\": [\"memory\", \"TB1\", \"Pontine\", \"motor\", \"theory\", \"CPU4\"],\n",
212+
" \"motor_factor\": -0.25,\n",
213+
" \"record\": [\"memory\", \"TB1\", \"Pontine\", \"motor\", \"CPU4\"],\n",
199214
" \"cx\": {\n",
200215
" \"type\": \"dye\",\n",
201216
" \"output_layer\": \"motor\",\n",
202217
" \"params\": {\n",
203218
" \"noise\": 0.1,\n",
204-
" \"mem_initial\": 0.0,\n",
205-
" \"pfn_weight_factor\": 1,\n",
206-
" \"phi\": 0.00045,#0.00045,\n",
219+
" \"phi\": 0.0003,#0.00045,\n",
207220
" \"beta\": 0.3,\n",
208221
" \"k\": 0,\n",
209-
" \"epsilon\":1e4,\n",
222+
" \"epsilon\":1.5e4,\n",
210223
" \"length\": 1e-3, #cm\n",
211224
" \"c_tot\": 0.3, #M\n",
212-
" \"holonomic\": True\n",
225+
" \"cheat\": True \n",
213226
" \n",
214227
" }\n",
215228
" }\n",
@@ -231,7 +244,7 @@
231244
{
232245
"cell_type": "code",
233246
"execution_count": null,
234-
"id": "f7581020",
247+
"id": "7ee0347c",
235248
"metadata": {},
236249
"outputs": [],
237250
"source": []
@@ -253,7 +266,7 @@
253266
"name": "python",
254267
"nbconvert_exporter": "python",
255268
"pygments_lexer": "ipython3",
256-
"version": "3.8.10"
269+
"version": "3.10.6"
257270
}
258271
},
259272
"nbformat": 4,

0 commit comments

Comments
 (0)