Skip to content

Tools for accessing, processing and presenting data from Dynamic Routing experiments.

Notifications You must be signed in to change notification settings

AllenInstitute/dynamic_routing_analysis

Repository files navigation

dynamic_routing_analysis

installation

  1. clone the dynamic_routing_analysis repo
  2. create a new environment with python=3.11.5
    conda create -n dr_analysis python=3.11.5
  3. navigate to the folder where you cloned the repo
  4. activate your new environment
    conda activate dr_analysis
  5. Optional: if you want to plot on the CCF, install allensdk (not necessary for other analyses; workaround to override some of allensdk's deps with dynamic_routing_analysis deps)
    pip install allensdk
  6. install remaining dependencies from requirements.txt file
    pip install -r requirements.txt
  7. install dynamic_routing_analysis in editable mode
    pip install -e .

contributing

first-time capsule use

  1. duplicate the dev capsule https://codeocean.allenneuraldynamics.org/capsule/3127916

  2. attach AWS and GitHub credentials (requires an access token)

  3. fire up VSCode

  4. pull from origin/main, activate and update the dev venv outside of conda:

    conda deactivate
    source install.sh
  5. verify that the venv is activated in VSCode

    • Ctrl+Shift+P and start typing any part of Python: Select Interpreter
    • the interpreter should be set to Python 3.9.12 ('.venv': venv) ./.venv/bin/python
    • if that's not an option, hit the refresh button
    • if it still doesn't appear, hit Enter interpreter path... and enter ./.venv/bin/python
  6. verify that the venv is activated in a new terminal [Ctrl+Shift+`]

    the folder name and Python version should be indicated on the command line (e.g. dra-3.9):

    (dra-3.9) root@c5876abdc7b5:/code/dra# |

capsule re-use

  1. Make sure to check for updates in the source control tab in VSCode [Ctrl+Shift+G] and pull where appropriate
  2. Update the venv in a terminal with
    pdm update

adding/removing dependencies

  • when adding, this method will find a compatible version of the dependency, based on the package's Python version requirement and other existing dependencies

  • the dependency will be added/removed from:

    • pyproject.toml, which specifies required dependencies
    • the currently-activated dev venv
      • if removed, all of its sub-dependencies will also be removed
    • pdm.lock, which specifies the dev venv
      • commit any changes to the pdm.lock to signal updates to the common dev venv
      • if you're unsure if your lock file is correct, run pdm update - this will add add the most up-to-date versions of dependencies specifed in pyproject.toml
      • if your venv is broken, delete the .venv folder and re-install

For dependencies of the package itself (ie. needed for code within dynamic_routing_analysis):

pdm add numpy pandas
pdm remove numpy pandas

For dependencies needed for development of the package (ie. testing, linting, formatting, static type-analysis):

pdm add -G dev mypy pytest
pdm remove -G dev mypy pytest

updating dependencies

If we specify only a lower bound on a dependency (e.g. pandas >= 2.0), any new install of dynamic_routing_analysis will also install the latest version of pandas.

To make sure that the latest versions of dependencies don't introduce breaking changes, we should update the dev venv periodically by running pdm update and running any tests, then committing pdm.lock.

More info on pdm and the lock file: https://pdm.fming.dev/latest/usage/dependency/#install-the-packages-pinned-in-lock-file

About

Tools for accessing, processing and presenting data from Dynamic Routing experiments.

Resources

Stars

Watchers

Forks

Languages