This code reproduces the figures from the paper:
Festa D, Aschner A, Davila D, Kohn A, Coen-Cagli R
Neuronal variability reflects probabilistic inference tuned to natural image statistics
The code is multi-platform, provided that the follwing two requirements are fulfilled:
- Julia 1.5 (or newer)
- cmd-stan 2.22 (or newer)
Please note that cmd-stan
must be compiled after being downloaded. Refer to the installation instructions on the website. Take note of the folder where you copy cmdstan, it needs to be associated to the variable dir_stan_home
, as explained below.
- Import the data from Zenodo, using the following link:
https://doi.org/10.5281/zenodo.4710066
If you wish to use the default paths, simply create a folder called datadata
in the project directory (if it does not exist), and copy the contents offesta-et-al-2021-data.zip
in it. - Run
set_dirs.jl
with Julia, indicate the directory paths when prompted. The directory paths will be stored in the filedata/local_dirs.json
. You can also modify the file directly to indicate the data directories, as follows:
{
"dir_exp":"<directory containing experimental data>",
"dir_img":"<directory containing natural images>",
"dir_stan_home":"<home directory of cmd-stan installation>"
}
Make sure the directories exists. Regarding dir_stan_home
, remember that Stan must be compiled locally, as specified by the cmdstan installation instructions.
To load the code libraries and all package dependencies, run the script install_dependencies.jl
from the home folder of the project.
The scripts that generate each figure are in the folder scripts/figures/
. The name of each file refers to the corresponding figure in the paper.
The scripts automatically save the figures in the plots
folder, which is created in the home directory of the project.
Note that training a GSM model for figures 1D, 2D,3A may require 15 to 30 minutes (the code is not optimized for speed). Therefore, by default, the trained model is saved on disk, and cached. If you change the GSM parameters and you require a new training you can either:
- Remove the cached files, contained in
src/tmp
- Call the script with the
--rebuildGSM
option, for example:
julia paperfigures/3A.jl --rebuildGSM
.
To inspect the code and modify its parameters it is recommended using Juno, the official IDE for Julia.
In case of unexpected errors or problems, please submit an issue using the GitHub interface. Note that the code can only be tested and maintained on Linux platforms with the required versions of Julia and cmd-stan.
Code curated by Dylan Festa
Code for "Neuronal variability reflects probabilistic inference tuned to natural image statistics" by Festa, Aschner, Davila, Kohn and Coen-Cagli is licensed under CC BY-SA 4.0
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.