---------------------------------------------------------------------------------------------------------
# Project: Optimal Estimation-Control and Neural Space Control with Multiplicative and Internal Noise
---------------------------------------------------------------------------------------------------------

**Note**: All code was written using Julia v1.8.

------------------------------------------------------------------------
## Functions
------------------------------------------------------------------------

All functions required to run the scripts are located in the folder `myFunctions`.

------------------------------------------------------------------------
## Scripts to Generate the Results
------------------------------------------------------------------------

### Single-Joint Reaching Task — Appendix A.4.1 ("Optimal Estimation-Control for Goal-Directed Behavior")

Scripts located in the `Simulations` folder:
- `EC_1D_Reaching_Task.jl`: Produces the data used in Fig. 2.

### 3D Reaching Task — Section 4.1 ("Neural Space Control: From Reaching Tasks to Neural Population Steering")

Scripts located in the `Simulations` folder:
- `NSC_3D_Reaching_Task_vary_internal_noise.jl`: Produces the data used in Fig. 1.
- `NSC_3D_Reaching_Task.jl`: A more interactive version of the 3D reaching task using the NSC framework.

### Neural Population Steering — Appendix A.4.3 ("Neural Population Steering via Neural Space Control")

- `NSC_Neural_Populations.jl`: Produces the data used in Fig. 3.

------------------------------------------------------------------------
## Scripts to Generate the Plots
------------------------------------------------------------------------

### Single-Joint Reaching Task — Appendix A.4.1

Located in the folder `Plots/EC_1D_Reaching_Task`:
- `EC_1D_Reaching_Task_plots.jl`: Produces the subplots for Fig. 2.

### 3D Reaching Task — Section 4.1

Located in the folder `Plots/NSC_3D_Reaching_Task`:
- `NSC_3D_Reaching_Task_plots.jl`: Produces the subplots for Fig. 1.

### Neural Population Steering — Appendix A.4.3

- Subplots for Fig. 3 are automatically generated by `NSC_Neural_Populations.jl`.

Note: All subplots for Figs. 1–3 can be found in the corresponding subfolders inside the `Plots` directory.

------------------------------------------------------------------------
## Data
------------------------------------------------------------------------

The data used to generate the plots is located in the `Data_for_plots` folder, unless regenerated by the scripts (runtime is typically a few minutes).

### Single-Joint Reaching Task — Appendix A.4.1
- Folder: `EC_1D_Reaching_Task` — Contains `jld2` files for Fig. 2.

### 3D Reaching Task — Section 4.1
- Folder: `NSC_3D_Reaching_Task` — Contains `jld` files for Fig. 1.

### Neural Population Steering — Appendix A.4.3
- Data is generated on-the-fly by `NSC_Neural_Populations.jl`.

------------------------------------------------------------------------
## Notes
------------------------------------------------------------------------

- Scripts in the `Simulations` folder do **not** overwrite existing data (only plots).
- New outputs will be saved in automatically created subfolders named `New_Data`.
