https://github.com/alleninstitute/visual_behavior_analysis
Python package for analyzing behavioral data for Brain Observatory: Visual Behavior
Science Score: 36.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
14 of 24 committers (58.3%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.9%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
Python package for analyzing behavioral data for Brain Observatory: Visual Behavior
Basic Info
Statistics
- Stars: 25
- Watchers: 9
- Forks: 7
- Open Issues: 71
- Releases: 2
Topics
Metadata Files
README.md
Allen Institute Visual Behavior Analysis package
This repository contains code for analyzing behavioral data from the Allen Brain Observatory: Visual Behavior 2P Project.
This code is an important part of the internal Allen Institute code base and we are actively using and maintaining it. Issues are encouraged, but because this tool is so central to our mission pull requests might not be accepted if they conflict with our existing plans.
Before installing, it's recommended to set up a new Python environment:
For example, using Conda:
conda create -n visual_behavior_analysis python=3.7
Then activate the environment:
conda activate visual_behavior_analysis
Quickstart
and install with pip (Allen Institute internal users only):
pip install git+https://github.com/AllenInstitute/visual_behavior_analysis.git
Installation
This package is designed to be installed using standard Python packaging tools. For example,
python setup.py install
If you are using pip to manage packages and versions (recommended), you can also install using pip:
pip install ./
If you are plan to contribute to the development of the package, I recommend installing in "editable" mode:
pip install -e ./
This ensures that Python uses the current, active files in the folder (even while switching between branches).
To ensure that the newly created environment is visible in Jupyter:
Activate the environment:
conda activate visual_behavior_analysis
Install ipykernel:
pip install ipykernel
Register the environment with Jupyter:
python -m ipykernel install --user --name visual_behavior_analysis
Use
First, load up a Foraging2 output
Python
import pandas as pd
data = pd.read_pickle(PATH_TO_FORAGING2_OUTPUT_PKL)
Then, we create the "core" data structure: a dictionary with licks, rewards, trials, running, visual stimuli, and metadata.
``` Python from visualbehavior.translator.foraging2 import datatochangedetection_core
coredata = datatochangedetection_core(data) ```
Finally, we create an "extended" dataframe for use in generating trial-level plots and analysis.
``` Python from visualbehavior.translator.core import createextended_dataframe
extendedtrials = createextendeddataframe( trials=coredata['trials'], metadata=coredata['metadata'], licks=coredata['licks'], time=core_data['time'], ) ```
Testing
Before committing and/or submitting a pull request, it is ideal to run tests.
Tests are currently run against Python 3.6.12 and 3.7.7 on github using CircleCI. You can replicate those tests locally as follows:
Creating test virtual environments
CD {your local VBA directory}
conda create -n VBA_test_36 python=3.6.12
conda activate VBA_test_36
pip install .[DEV]
Then deactivate VBAtest36 to create the 3.7 virtual environment:
conda create -n VBA_test_37 python=3.7.7
conda activate test_37
pip install .[DEV]
Basic testing (external users):
Baseline tests consist of tests that can be run from outside of the Allen Institute and do not require access to any internal databases such as LIMS. The not onprem argument will skip all tests that can only be run on internal Allen Institute servers and are marked as onprem. To run these tests, do the following:
CD {your local VBA directory}
conda activate VBA_test_36
pytest -m "not onprem"
On Premises Testing + Basic testing (internal Allen Institute Users): Some tests may only be run on premises (at the Allen Institute) because they must access our internal databases such as LIMS. For internal Allen Institute users, the call to pytest could be called without an onprem argument, which would run ALL tests. To run these tests, do the following:
CD {your local VBA directory}
conda activate VBA_test_36
pytest
Linting / Circle CI Testing (all users):
CircleCI also tests that all files meet Pep 8 style requirements using the Flake8 module - a process referred to as 'linting'. Linting can be performed locally before commiting using Flake8 as follows:
flake8 {FILE_TO_CHECK}
Running a subset of tests: You can run a subset of test by doing the following
All tests in a sub directory:
CD {subfolder of VBA that contains the tests you'd like to run}
conda activate VBA_test_36
pytest {add -m "not onprem" as necessary}
All test in a single .py file:
CD {subfolder of VBA that contains the file with the tests you'd like to run}
conda activate VBA_test_36
pytest fileWithTests.py {add -m "not onprem" as necessary}
Contributing
Pull requests are welcome.
- Fork the repo
- Create a feature branch
- Commit your changes
- Create a pull request
- Tag
@dougollerenshaw,@matchingsto review
Contributors:
- Nicholas Cain - @nicain
- Marina Garrett - marinag@alleninstitute.org, @matchings
- Nile Graddis - nileg@alleninstitute.org, @nilegraddis
- Justin Kiggins - @neuromusic
- Jerome Lecoq - jeromel@alleninstitute.org, @jeromelecoq
- Sahar Manavi - saharm@alleninstitute.org, @saharmanavi
- Nicholas Mei - nicholas.mei@alleninstitute.org, @njmei
- Christopher Mochizuki - chrism@alleninstitute.org, @mochic
- Doug Ollerenshaw - dougo@alleninstitute.org, @dougollerenshaw
- Natalia Orlova - nataliao@alleninstitute.org, @nataliaorlova
- Jed Perkins - @jfperkins
- Alex Piet - alex.piet@alleninstitute.org, @alexpiet
- Nick Ponvert - @nickponvert
- Kate Roll - kater@alleninstitute.org, @downtoncrabby
- Ryan Valenza - @ryval
- Farzaneh Najafi - farzaneh.najafi@alleninstitute.org
- Iryna Yavorska - iryna.yavorska@alleninstitute.org
Additional Links
Owner
- Name: Allen Institute
- Login: AllenInstitute
- Kind: organization
- Location: Seattle, WA
- Website: https://alleninstitute.org
- Repositories: 184
- Profile: https://github.com/AllenInstitute
Please visit http://alleninstitute.github.io/ for more information.
GitHub Events
Total
- Watch event: 2
- Push event: 11
- Pull request event: 2
- Fork event: 1
- Create event: 1
Last Year
- Watch event: 2
- Push event: 11
- Pull request event: 2
- Fork event: 1
- Create event: 1
Committers
Last synced: 10 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| matchings | m****g@a****g | 1,729 |
| Doug Ollerenshaw | d****o@a****g | 476 |
| iryna | i****a@g****m | 348 |
| Justin Kiggins | j****k@a****g | 291 |
| Doug Ollerenshaw | d****w@g****m | 287 |
| Kate Roll | k****r@a****g | 202 |
| Nick Ponvert | n****t@g****m | 99 |
| Doug Ollerenshaw | d****o@a****g | 98 |
| mochic808 | c****m@a****g | 93 |
| nicholasc | n****e@g****m | 68 |
| Alex Piet | a****t@g****m | 66 |
| Justin Kiggins | j****s@g****m | 62 |
| Jerome Lecoq | j****l@a****g | 13 |
| Dan Kapner | d****k@a****g | 11 |
| Nile Graddis | n****s@g****m | 8 |
| Farzaneh Najafi | f****i@a****g | 7 |
| Corbett Bennett | c****b@a****g | 5 |
| Sean McCulloch | s****h@a****g | 5 |
| Jed Perkins | p****d@g****m | 4 |
| Ryan Valenza | r****v@a****g | 3 |
| Nick Ponvert | n****t@i****g | 1 |
| Matt | m****v@a****g | 1 |
| Matthew J. Davis | m****s@g****m | 1 |
| Nicholas Mei | n****i@a****g | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 9 months ago
All Time
- Total issues: 74
- Total pull requests: 111
- Average time to close issues: 3 months
- Average time to close pull requests: 7 days
- Total issue authors: 7
- Total pull request authors: 6
- Average comments per issue: 2.59
- Average comments per pull request: 1.88
- Merged pull requests: 78
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- neuromusic (19)
- dougollerenshaw (11)
- mochic (5)
- matchings (2)
- yavorska-iryna (2)
- nicain (1)
- mtv2101 (1)
- ryyesterday (1)
Pull Request Authors
- mochic (30)
- neuromusic (21)
- dougollerenshaw (6)
- matchings (2)
- arielleleon (1)
- saharmanavi (1)
- nicain (1)
- yavorska-iryna (1)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- continuumio/anaconda latest build
- backports-abc ==0.4
- backports.shutil-get-terminal-size ==1.0.0
- backports.ssl-match-hostname ==3.5.0.1
- behaviorist *
- braintv-pilot *
- click ==6.7
- dro *
- figrid *
- h5py ==2.6.0
- imaging-behavior *
- ipython-genutils ==0.1.0
- jupyter-client ==4.4.0
- jupyter-core ==4.2.0
- mouse-info *
- nwb *
- prompt-toolkit ==1.0.9
- psychopy ==1.82.1
- pygraphviz ==1.3.1
- squarify *
- tables ==3.3.0
- transitions ==0.4.2