Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/docs' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
oliche committed Feb 6, 2024
2 parents 4f763c0 + 7e5dabd commit e1f720a
Show file tree
Hide file tree
Showing 21 changed files with 1,589 additions and 1,574 deletions.
5 changes: 2 additions & 3 deletions brainbox/behavior/dlc.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@ def likelihood_threshold(dlc, threshold=0.9):
features = np.unique(['_'.join(x.split('_')[:-1]) for x in dlc.keys()])
for feat in features:
nan_fill = dlc[f'{feat}_likelihood'] < threshold
dlc[f'{feat}_x'][nan_fill] = np.nan
dlc[f'{feat}_y'][nan_fill] = np.nan

dlc.loc[nan_fill, f'{feat}_x'] = np.nan
dlc.loc[nan_fill, f'{feat}_y'] = np.nan
return dlc


Expand Down
207 changes: 45 additions & 162 deletions brainbox/examples/docs_wheel_moves.ipynb

Large diffs are not rendered by default.

13 changes: 7 additions & 6 deletions examples/data_release/data_release_behavior.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
},
{
"cell_type": "markdown",
"id": "dd157e91",
"metadata": {
"collapsed": false
},
"source": [
"## Overview of the Data\n",
"We have released behavioral data throughout learning from our standardized training pipeline, implemented across 9 labs in 7 institutions. Users can download behavioral data from mice throughout their training, and analyse the transition from novice to expert behavior unfold. The behavioral data is associated with 198 mice up until 2020-03-23, as used in [The International Brain Laboratory et al. 2020](https://elifesciences.org/articles/63711). This dataset contains notably information on the sensory stimuli presented to the mouse, as well as mouse decisions and response times.\n",
Expand All @@ -35,10 +39,7 @@
"Note:\n",
"\n",
"* The tag associated to this release is `2021_Q1_IBL_et_al_Behaviour`"
],
"metadata": {
"collapsed": false
}
]
}
],
"metadata": {
Expand All @@ -58,9 +59,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
"version": "3.11.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
}
11 changes: 6 additions & 5 deletions examples/data_release/data_release_brainwidemap.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
},
{
"cell_type": "markdown",
"id": "e9be5894",
"metadata": {
"collapsed": false
},
"source": [
"## Overview of the Data\n",
"We have released data from 459 Neuropixel recording sessions, which encompass 699 probe insertions, obtained in 139 subjects performing the IBL task across 12 different laboratories. As output of spike-sorting, there are 376730 units; of which 45085 are considered to be of good quality. In total, 138 brain regions were recorded in sufficient numbers for inclusion in IBL’s analyses [(IBL et al. 2023)](https://www.biorxiv.org/content/10.1101/2023.07.04.547681v2).\n",
Expand All @@ -35,10 +39,7 @@
"\n",
"## Receive updates on the data\n",
"To receive a notification that we released new datasets, please fill up [this form](https://forms.gle/9ex2vL1JwV4QXnf98)\n"
],
"metadata": {
"collapsed": false
}
]
}
],
"metadata": {
Expand All @@ -58,7 +59,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
"version": "3.11.6"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions examples/data_release/data_release_repro_ephys.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
"version": "3.11.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
"version": "3.11.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
}
111 changes: 60 additions & 51 deletions examples/exploring_data/data_download.ipynb
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Turn off logging and disable tqdm this is a hidden cell on docs page\n",
"import logging\n",
"import os\n",
"\n",
"logger = logging.getLogger('ibllib')\n",
"logger.setLevel(logging.CRITICAL)\n",
"\n",
"os.environ[\"TQDM_DISABLE\"] = \"1\""
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": false
"collapsed": false,
"nbsphinx": "hidden"
},
"source": [
"# Download the public datasets\n",
Expand All @@ -21,10 +38,10 @@
"source": [
"## Installation\n",
"### Environment\n",
"To use IBL data you will need a python environment with python > 3.7. To create a new environment from scratch you can install [anaconda](https://www.anaconda.com/products/distribution#download-section) and follow the instructions below to create a new python environment (more information can also be found [here](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html))\n",
"To use IBL data you will need a python environment with python > 3.8. To create a new environment from scratch you can install [anaconda](https://www.anaconda.com/products/distribution#download-section) and follow the instructions below to create a new python environment (more information can also be found [here](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html))\n",
"\n",
"```\n",
"conda create --name ibl python=3.9\n",
"conda create --name ibl python=3.11\n",
"```\n",
"Make sure to always activate this environment before installing or working with the IBL data\n",
"```\n",
Expand Down Expand Up @@ -149,54 +166,51 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Find sessions that have spikes.times datasets\n",
"sessions_with_spikes = one.search(project='brainwide', data='spikes.times')"
],
"metadata": {
"collapsed": false
}
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": false
},
"source": [
"[Click here](https://int-brain-lab.github.io/ONE/notebooks/one_search/one_search.html) for a complete guide to searching using ONE.\n",
"\n",
"\n",
"### Find data associated with a release or publication\n",
"Datasets are often associated to a publication, and are tagged as such to facilitate reproducibility of analysis. You can list all tags and their associated publications like this:"
],
"metadata": {
"collapsed": false
}
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# List and print all tags in the public database\n",
"tags = {t['name']: t['description'] for t in one.alyx.rest('tags', 'list') if t['public']}\n",
"for key, value in tags.items():\n",
" print(f\"{key}\\n{value}\\n\")"
],
"metadata": {
"collapsed": false
}
]
},
{
"cell_type": "markdown",
"source": [
"You can use the tag to restrict your searches to a specific data release and as a filter when browsing the public database:"
],
"metadata": {
"collapsed": false
}
},
"source": [
"You can use the tag to restrict your searches to a specific data release and as a filter when browsing the public database:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Note that tags are associated with datasets originally\n",
Expand All @@ -212,10 +226,7 @@
"# To return to the full cache containing an index of all IBL experiments\n",
"ONE.cache_clear()\n",
"one = ONE(base_url='https://openalyx.internationalbrainlab.org')"
],
"metadata": {
"collapsed": false
}
]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -292,29 +303,28 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"# Load in all trials datasets\n",
"trials = one.load_object(eid, 'trials', collection='alf')\n",
"\n",
"# Load in a single wheel dataset\n",
"wheel_times = one.load_dataset(eid, '_ibl_wheel.timestamps.npy')"
],
"metadata": {
"collapsed": false,
"pycharm": {
"name": "#%%\n"
}
}
]
},
{
"cell_type": "markdown",
"source": [
"Examples for loading different objects can be found in the following tutorials [here](https://int-brain-lab.github.io/iblenv/loading_examples.html)."
],
"metadata": {
"collapsed": false
}
},
"source": [
"Examples for loading different objects can be found in the following tutorials [here](https://int-brain-lab.github.io/iblenv/loading_examples.html)."
]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -350,6 +360,13 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"# List details of all sessions (returns a list of dictionaries)\n",
"_, det = one.search(details=True)\n",
Expand All @@ -360,27 +377,19 @@
"\n",
"# Searching for RS sessions with specific lab name\n",
"sessions_lab = one.search(data='spikes', lab=lab_name)"
],
"metadata": {
"collapsed": false,
"pycharm": {
"name": "#%%\n"
}
},
"execution_count": null,
"outputs": []
]
},
{
"cell_type": "markdown",
"source": [
"You can also get this list, using [one.alyx.rest](https://int-brain-lab.github.io/ONE/notebooks/one_advanced/one_advanced.html), however it is a little slower."
],
"metadata": {
"collapsed": false,
"pycharm": {
"name": "#%% md\n"
}
}
},
"source": [
"You can also get this list, using [one.alyx.rest](https://int-brain-lab.github.io/ONE/notebooks/one_advanced/one_advanced.html), however it is a little slower."
]
},
{
"cell_type": "code",
Expand Down Expand Up @@ -411,16 +420,16 @@
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
"pygments_lexer": "ipython3",
"version": "3.11.6"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
}
8 changes: 4 additions & 4 deletions examples/exploring_data/data_structure.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -270,16 +270,16 @@
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
"pygments_lexer": "ipython3",
"version": "3.11.6"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
}
12 changes: 8 additions & 4 deletions examples/loading_data/loading_ephys_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@
},
"outputs": [],
"source": [
"# Turn off logging, this is a hidden cell on docs page\n",
"# Turn off logging and disable tqdm this is a hidden cell on docs page\n",
"import logging\n",
"import os\n",
"\n",
"logger = logging.getLogger('ibllib')\n",
"logger.setLevel(logging.CRITICAL)"
"logger.setLevel(logging.CRITICAL)\n",
"\n",
"os.environ[\"TQDM_DISABLE\"] = \"1\""
]
},
{
Expand Down Expand Up @@ -217,9 +221,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
"version": "3.11.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
}
Loading

0 comments on commit e1f720a

Please sign in to comment.