Skip to content

int-brain-lab/prior-localization

Repository files navigation

Prior Localization

The repository provides the code associated with the manuscript Brain-wide representations of prior information in mouse decision-making (Findling, Hubert et al, 2023).

Dependencies

The code has been tested on Ubuntu 20.04 and 22.04, Rocky Linux 8.8 and OSX 13.4.1, using Python 3.8, 3.9 and 3.10. Required Python software packages are listed in requirements.txt.

Installation

The installation takes about 7 min on a standard desktop computer. It is recommended to set up and activate a clean environment using conda or virtualenv, e.g.

virtualenv prior --python=python3.10
source prior/bin/activate

Then clone this repository and install it along with its dependencies

git clone https://github.com/int-brain-lab/prior-localization.git
cd prior-localization
pip install -e .

In a Python console, test if you can import functions from prior_localization

from prior_localization.fit_data import fit_session_ephys

Connecting to IBL database

In order to run the example code or the tests, you need to connect to the public IBL database to access example data. Our API, the Open Neurophysiology Environment (ONE) has already been installed with the requirements. If you have never used ONE, you can just establish the default database connection like this in a Python console. The first time you instantiate ONE you will have to enter the password (international)

from one.api import ONE
ONE.setup(silent=True)
one = ONE()

NOTE: if you have previously used ONE with a different database you might want to run this instead. Again, the first time you instantiate ONE you will have to enter the password (international)

from one.api import ONE
ONE.setup(base_url='https://openalyx.internationalbrainlab.org', make_default=False, silent=True)
one = ONE(base_url='https://openalyx.internationalbrainlab.org')

If you run into any issues refer to the ONE documentation

Running example code

We provide an example script in prior_localization/decode_single_session.ipynb that performs a region-level decoding of the Bayes optimal prior from pre-stimulus neural activity. The data is automatically downloaded from the public IBL database, provided that the above ONE setup has been performed.

This script has been tested on a laptop computer (Intel® Core™ i7 processor, 4 cores, 16GB RAM) running Ubuntu 22.04, with Python 3.10 and Python package versions listed in software_versions_example.txt. In this setup, it takes about 2 min to run (including data download times).

Running tests

To run the full set of tests you can use e.g. unittest

python -m unittest discover -s prior_localization/tests

Code Description

The main fitting functions can be found in prior_localication/fit_data.py. The inputs of these functions are described in the docstrings. The functions return paths to the folders containing the decoding results. See the example notebook for more details and examples on how to inspect the outputs.

About

Project seeking to localize encoding of the task prior in the brain

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published