Somata
State-space Oscillator Modeling And Time-series Analysis (SOMATA) is a Python library for state-space neural signal processing algorithms developed in the Purdon Lab.
Install / Use
npx skills add mh105/somataInstalls into whichever agent you are using.
README
somata
Github: https://github.com/mh105/somata
State-space Oscillator Modeling And Time-series Analysis (SOMATA) is a Python library for state-space neural signal processing algorithms developed in the Purdon Lab. Basic state-space models are introduced as class objects for flexible manipulations. Classical exact and approximate inference algorithms are implemented and interfaced as class methods. Advanced neural oscillator modeling techniques are brought together to work synergistically.
Table of Contents
- Requirements
- Install
- Basic state-space models
- Advanced neural oscillator methods
- Authors
- Citation
- License
Requirements
somata is built on numpy arrays for computations. joblib is used for multithreading.
Additional dependencies include scipy, matplotlib, cmdstanpy, and spectrum.
The source localization module also requires pytorch and MNE-python.
-
Full package requirements for each release will be updated in the
requirements-*.txtfiles. Thepyproject.tomlfile is specified to dynamically retrieve the metadata of dependencies forsetuptoolsduringpip installto verify that runtime dependent packages of compatible versions have been installed. Whenpip installis used, missing dependencies will be fetched from Python Package Index (PyPI) and installed. -
For development or installing
somatainto a new conda environment,requirements-*.txtfiles can also be passed toconda createvia the--filedirective to create a new conda environment with all and only the required packages installed in the new conda environment. Whenconda createorconda installis used, missing dependencies will be fetched from conda channels and installed.
Install
$ pip install somata
or
$ conda install somata -c pytorch -c conda-forge
conda-forge channel (recommended)
While pip install usually works, an alternative way to install somata is through the conda-forge channel, which utilizes continuous integration (CI) across OS platforms.
This means that conda-forge packages are more compatible with each other compared to PyPI packages installed via pip by default.
If pip install somata fails to resolve some dependencies, the conda-forge somata feedstock can be used to install somata.
If you have not installed CmdStan on your OS before, it is easier to install from the conda-forge channel if you need to use the Phase Amplitude Coupling Estimation module.
On Windows, it is also easier to use conda install due to a need to build spectrum during pip install that requires Microsoft Visual C++ 14.0 or greater.
torch requirement
If the torch dependency is not resolved correctly for your OS (such as installed the cpu-only version when GPU processing is needed), first install pytorch manually in a conda environment that you want to install somata in, and then rerun either of the above two lines to install somata.
Please be aware of a common mixup that PyTorch is distributed as torch on PyPI but as pytorch on conda-forge.
If using conda to install, Windows OS needs to download pytorch from the pytorch channel, as win-64 is not built on the conda-forge channel.
(For development only)
-
Fork this repo to personal git
-
Clone forked copy to local computer
-
Install conda
Recommended conda distribution: Miniforge3
Apple silicon Mac: choose Miniforge3 native to the ARM64 architecture instead of Intel x86.
-
Create a new conda environment
You may also directly install
somatain an existing conda environment by skipping this step.$ cd <repo root directory with pyproject.toml>
$ mamba create -n somata -c pytorch -c conda-forge --file requirements/requirements-core.txt --file requirements/requirements-dev.txt
$ mamba activate somata -
Install somata as a package in development mode
$ cd <repo root directory with pyproject.toml>
$ pip install -e . --config-settings editable_mode=compat -
Configure IDEs to use the conda environment
Some notes on package dependency requirements
When somata is installed into an existing conda environment, unmet dependencies are automatically searched, downloaded, and installed from the same repository of packages requested to provide the somata build distribution and its dependencies (from PyPI with pip install somata or from pytorch and conda-forge channels with conda install somata -c pytorch -c conda-forge).
The need for specifying dependencies arises in multiple ways for Python.
There are non-negligible complexities due to the existence of different build backends as well as different Python dependency management and packaging tools such as pdm, poetry, pip, conda, etc.
One modern standard is to use a declarative config pyproject.toml file for package
Related Skills
node-connect
385.5kDiagnose OpenClaw Android, iOS, or macOS node pairing, QR/setup code, route, auth, and connection failures.
blender-python-addon
40.5kBlender Python add-on rules for operators, panels, properties, registration, testing, and API-safe scripting
flutter-development-guidelines-cursorrules-prompt-file
40.5kCursor rules for Flutter development with MVVM architecture, Riverpod state management, Material widgets, and Dart style guidelines.
commit-push-pr
140.7kCommit, push, and open a PR
