hennequin-lab / optimal-preparation

Optimal anticipatory controlas a theory of motor preparation: a thalamo-cortical circuit model
0 stars 0 forks source link

optimal-preparation

Optimal anticipatory control as a theory of motor preparation: a thalamo-cortical circuit model

Dependencies

  1. OCaml 4.10.0
  2. Owl
  3. Owl Opt
  4. Cmdargs

Construct target reaches and ISN network

mkdir results
dune exec construct/reaches.exe -- -d results # create target reaches
dune exec soc/construct.exe -- -d results # create ISN

Find target initial states and readout matrix

dune exec construct/setup.exe -- -d results # learn initial states and readout

Feedback vs feedforward preparatory control

dune exec construct/vanilla.exe -- -d results # vanilla LQR preparation
dune exec construct/naive.exe -- -d results # naive feedforward preparation

Full thalamo-cortical loop + preparation strategy

dune exec construct/dynamic_setup.exe -- -d results # setup full thalamocortical loop
dune exec construct/dynamic.exe -- -d results

Plotting the results with gnuplot

To plot the activity of neuron 2 under optimal feedback (LQR) control for all 8 reaches, use the following command inside a gnuplot terminal within the results folder:

# activity of neuron 2
plot for [i=1:8] "x_vanilla_loop_r1_".i u 2 w l lc black

Similarly, to plot the corresponding hand trajectories and propsective motor cost in log-scale, use the following command:

# hand trajectories (x-y coordinates)
plot for [i=1:8] "hand_vanilla_loop_r1_".i u 1:3 w l lc black 
# prospective motor cost
set log y
set xrange [0:1000]
plot for [i=1:8] "cost_vanilla_loop_r1_".i u 1 w l lc black

To plot similar quantities for feedforward control or full thalamo-cortical feedback control, substitute vanilla for naive or dynamic in the plotting commands above.