- Authors: Jack Goffinet, Casey Hanks, David Carlson
Conda:
conda env create -f conda_requirements.ymlAlternatively using pip:
conda create -n torus python=3.11
conda activate torus
pip install -r requirements.txtThen optionally install IDTxl from source to run bivariate TE tests.
tg_ssm_example.py, Torus graph (TG) usagehmm_example.pyTorus graph hidden Markov model (TG-HMM) usageartg_example.pyautoregressive torus graph (AR-TG) usagemvte_example.pyAR-TG multivariate transfer entropy (MVTE) estimation usage
ssm_synthetic_heatmaps.py(Figure 2a,b)hmm_synthetic_heatmaps.py(Figure 2c,d)bvte_synthetic_comparison.py(Figure 3a,b)mvte_synthetic_heatmaps.py(Figure 3c,d)ssm_mouse_lfp_experiment.py(Figure 4)hmm_mouse_lfp_experiment.py(Figure 5)mvte_mouse_lfp_experiment.py(Figure 6)
src.conditional_model_sgdstochastic gradient descent trainer for conditional TG models with von Mises outputssrc.conditional_sgdlearns conditional TG parameters with score-matching-style SGDsrc.fit_artgtools for fitting univariate and bivariate AR-TG models via MAP/BFGS optimizerssrc.fit_mv_artgstochastic score matching for multivariate AR-TG models using sequential batchessrc.hmmexpectation-maximization routines for TG-based hidden Markov modelssrc.hmm_evalalignment metrics, plots, and diagnostics for TG-HMM latent statessrc.imputation_modelGaussian conditioning model for imputing lagged cosine/sine featuressrc.lfp_loaderstreaming loader that constructs Morlet-based LFP phase windows on the flysrc.multivariate_transfer_entropyMonte Carlo estimator for AR-TG multivariate transfer entropysrc.plotsplotting helpers for circular statistics, complex covariances, and TG parameterssrc.reference_implementationMatlab TG reference algorithms ported to JAXsrc.sampleMCMC samplers and utilities for drawing from torus graph distributionssrc.simulate_arsimulators and priors for autoregressive torus graphssrc.simulate_hmmsynthetic TG-HMM generator and sticky transition priorssrc.conditional_ssmscore matching baseline for conditional TGssrc.ssmstochastic score matching losses and optimizers for torus graphssrc.statscircular sufficient statistics, Jacobians, and TG linear algebra utilitiessrc.von_misesentropy, log-density, and helper functions for von Mises distributions
scripts.align_sleep_spindlesrefines spindle detections with similarity-based ordering and QC plotsscripts.find_sleep_spindlesdetects spindle events from LFPs and saves summary diagnosticsscripts.make_schematic_figurereproduces the torus graph schematic using Morlet features and TG solvesscripts.plot_lfp_ssm_figureassembles figures from score-matching TG fits on sleep LFPsscripts.plot_lfp_te_figurerenders the multivariate transfer entropy LFP visualizationsscripts.plot_spindle_hmm_figurecreates PLV and TG-HMM visualizations for the sleep spindle figure
test_jacobian.pyTests the Jacobian math for stochastic score matching
@inproceedings{Goffinet2026TorusGraphs,
author = {Goffinet, Jack and Hanks, Casey and Carlson, David E.},
title = {Torus Graphs for Large Scale Neural Phase Analysis},
booktitle = {International Conference on Machine Learning},
year = {2026},
organization = {PMLR}
}- Code on GitHub
- Camera-ready on arXiv
- Add links