Skip to main content

GLM-HMM and GLM-HMMT tooling for behavioural task analysis.

Project description

glmhmmt

glmhmmt is the installable package for the Dynamax-based GLM-HMM / GLM-HMMT code.

If someone in the lab only wants to import the model class in their own code, this package is enough:

pip install "git+https://github.com/BrainCircuitsBehaviorLab/glmhmmt.git"

or with uv:

uv pip install "git+https://github.com/BrainCircuitsBehaviorLab/glmhmmt.git"

If they want to add it as a dependency in another uv project:

uv add "glmhmmt @ git+https://github.com/BrainCircuitsBehaviorLab/glmhmmt.git"

Then in Python:

from glmhmmt import SoftmaxGLMHMM

If they want the baseline GLM fit directly in their own code, including binary lapses:

from glmhmmt import fit_glm

Direct Model Use

See examples/use_softmax_glmhmm.py for a minimal example that builds the model directly from arrays, without any task adapter.

For a baseline GLM example, see examples/glm_lapses/example.py.

The package root uses lazy imports, so importing SoftmaxGLMHMM does not require task adapters.

The CLI entrypoints under glmhmmt.cli.* are wrappers around task adapters, runtime paths, and result directories. They are useful for command-line workflows, but they are not the recommended import interface for another project.

Runtime Config

glmhmmt now looks for config.toml by searching upward from the current working directory. That means each analysis project can keep its own config next to its notebooks and scripts.

The clean way to initialise one is:

uv run glmhmmt-init-config

That writes config.toml in the current working directory. You can also choose the destination explicitly:

uv run glmhmmt-init-config \
  --path ./config.toml \
  --data-dir /absolute/path/to/data \
  --results-dir /absolute/path/to/results

At runtime, config precedence is:

  1. configure_paths(...)
  2. GLMHMMT_CONFIG_PATH
  3. nearest config.toml found by upward search from the current working directory
  4. repo-local config.toml for editable installs
  5. packaged defaults in src/glmhmmt/resources/default_config.toml

Runtime Compatibility

The published package is tested against:

  • jax==0.4.35
  • jaxlib==0.4.35
  • tensorflow-probability==0.25.0
  • optax==0.2.5

These pins are intentionally conservative because newer JAX / TFP combinations have broken the tensorflow_probability.substrates.jax import path used by dynamax and glmhmmt.model.

Task Adapters Are Optional

This package does not need task adapters when someone only wants the reusable model classes and fitting utilities.

If a user wants task-aware CLIs or notebooks, they can provide adapters in either of these ways:

  1. Put an adapters/ package in their own working directory, or configure [plugins].adapter_paths / GLMHMMT_TASK_PATHS.
  2. Install a separate package that exposes entry points in the glmhmmt.tasks group.

Minimal entry-point example:

[project.entry-points."glmhmmt.tasks"]
my_lab_task = "my_lab_glmhmmt.task:MyLabTaskAdapter"

Recommended Sharing Workflow

For lab use, the simplest setup is:

  1. Keep glmhmmt in its own Git repo.
  2. Keep task adapters in a separate companion repo.
  3. Install both from Git or from local editable paths during development.

That is usually better than publishing to PyPI immediately, because:

  • it avoids exposing unrelated analysis code
  • updates are simple
  • private sharing inside the lab is easy

Publish to PyPI later only if you want a public, versioned release.

Local Development

For work inside this repository:

uv sync
uv run python -c "from glmhmmt import SoftmaxGLMHMM; print(SoftmaxGLMHMM)"

If you want the notebook extras too:

uv sync --extra notebooks

The project-local runtime overrides live in config.toml. Packaged defaults live in src/glmhmmt/resources/default_config.toml.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

glmhmmt-0.1.2.tar.gz (136.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

glmhmmt-0.1.2-py3-none-any.whl (156.5 kB view details)

Uploaded Python 3

File details

Details for the file glmhmmt-0.1.2.tar.gz.

File metadata

  • Download URL: glmhmmt-0.1.2.tar.gz
  • Upload date:
  • Size: 136.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for glmhmmt-0.1.2.tar.gz
Algorithm Hash digest
SHA256 b2e36411f9df316dc802d04b9259cc6b3cf46e35e12fcb406539b2623ea84dca
MD5 efc5e3d3f84a7e6bbc83dc19c67d2385
BLAKE2b-256 2d55dad7e53834b6e2ed8c94fde0e9759556a22039945f74cd35c9e8ccba3998

See more details on using hashes here.

Provenance

The following attestation bundles were made for glmhmmt-0.1.2.tar.gz:

Publisher: publish.yml on BrainCircuitsBehaviorLab/glmhmmt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file glmhmmt-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: glmhmmt-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 156.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for glmhmmt-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 47b84bb3ee5fc21c07ca4bfcfdcb5a3b20f06ca7f34b1718e6b68418f3ad08d1
MD5 d0e7418941e8fc60d8913ec8d57a95ed
BLAKE2b-256 9e146a2cd7651d49b819c497ce29c5ce499b49d5ff254c0d59724fb046890aa5

See more details on using hashes here.

Provenance

The following attestation bundles were made for glmhmmt-0.1.2-py3-none-any.whl:

Publisher: publish.yml on BrainCircuitsBehaviorLab/glmhmmt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page