RepositoryJulia
unfoldtoolbox

unfoldtoolbox/Unfold.jl

Neuroimaging (EEG, fMRI, pupil ...) regression analysis in Julia

74stars
18forks
27issues
1views

Unfold.jl EEG toolbox

Stable Documentation In development documentation Test workflow status Lint workflow Status Docs workflow Status Coverage DOI Contributor Covenant All Contributors

EstimationVisualisationSimulationBIDS pipelineDecodingStatisticsMixedModelling
Unfold.jl LogoUnfoldMakie.jl LogoUnfoldSim.jl LogoUnfoldBIDS.jl LogoUnfoldDecode.jl LogoUnfoldStats.jl LogoUnfoldMixedModels.jl logo

Package (-family) to perform linear / GAM / hierarchical / deconvolution regression on biological signals.

This kind of modelling is also known as encoding modeling, linear deconvolution, Temporal Response Functions (TRFs), linear system identification, and probably under other names. fMRI models with HRF-basis functions and pupil-dilation bases are also supported.

Getting started

🐍Python User?

We clearly recommend Julia 😉 - but Python users can use juliacall/Unfold directly from python!

Julia installation

Click to expand

The recommended way to install julia is juliaup. It allows you to, e.g., easily update Julia at a later point, but also test out alpha/beta versions etc.

TL:DR; If you dont want to read the explicit instructions, just copy the following command

Windows

AppStore -> JuliaUp, or winget install julia -s msstore in CMD

Mac & Linux

curl -fsSL https://install.julialang.org | sh in any shell

Unfold.jl installation

using Pkg
Pkg.add("Unfold")

Usage

Please check out the documentation for extensive tutorials, explanations and more!

Tipp on Docs

You can read the docs online: Stable Documentation - or use the ?fit, ?effects julia-REPL feature. To filter docs, use e.g. ?fit(::UnfoldModel)

Here is a quick overview on what to expect.

What you need

using Unfold

events::DataFrame

# formula with or without random effects
f = @formula 0~1+condA
fLMM = @formula 0~1+condA+(1|subject) + (1|item)

# in case of [overlap-correction] we need continuous data plus per-eventtype one basisfunction (typically firbasis)
data::Array{Float64,2}
basis = firbasis(τ=(-0.3,0.5),srate=250) # for "timeexpansion" / deconvolution

# in case of [mass univariate] we need to epoch the data into trials, and a accompanying time vector
epochs::Array{Float64,3} # channel x time x epochs (n-epochs == nrows(events))
times = range(0,length=size(epochs,3),step=1/sampling_rate)

To fit any of the models, Unfold.jl offers a unified syntax:

Overlap-CorrectionMixed Modellingjulia syntax
fit(UnfoldModel,[Any=>(f,times)),evts,data_epoch]
xfit(UnfoldModel,[Any=>(f,basis)),evts,data]
xfit(UnfoldModel,[Any=>(fLMM,times)),evts,data_epoch]
xxfit(UnfoldModel,[Any=>(fLMM,basis)),evts,data]

Comparison to Unfold (matlab)

Click to expand

The matlab version is still maintained, but active development happens in Julia.

FeatureUnfoldUnfold.jl
overlap correctionxx
non-linear splinesxx
speed⚡ 2-100x
GPU support🚀
plotting toolsxUnfoldMakie.jl
Interactive plottingERPExplorer.jl
simulation toolsxUnfoldSim.jl
BIDS supportxUnfoldBIDS.jl)
tutorialsxx
unittestsxx
Alternative bases e.g. HRF (fMRI)x
Duration modelling (e.g. Hassal style)x
mix different basisfunctionsx
different timewindows per eventx
linear mixed modelsx
decodingUnfoldDecode.jl
outlier-robust fitsmany options (but slower)
🐍Python supportvia juliacall

Contributions

Contributions are very welcome. These could be typos, bugreports, feature-requests, speed-optimization, new solvers, better code, better documentation.

How-to Contribute

You are very welcome to raise issues and start pull requests!

Adding Documentation

  1. We recommend to write a Literate.jl document and place it in docs/literate/FOLDER/FILENAME.jl with FOLDER being HowTo, Explanation, Tutorial or Reference (recommended reading on the 4 categories).
  2. Literate.jl converts the .jl file to a .md automatically and places it in docs/src/generated/FOLDER/FILENAME.md.
  3. Edit make.jl with a reference to docs/src/generated/FOLDER/FILENAME.md.

Contributors

Judith Schepers
Judith Schepers

🐛 💻 📖 ✅ 🤔 ⚠️
Benedikt Ehinger
Benedikt Ehinger

🐛 💻 📖 ✅ 🤔 ⚠️ 🚇 ⚠️ 🚧 👀 💬
René Skukies
René Skukies

🐛 📖 ✅ 💻 🤔
Manpa Barman
Manpa Barman

🚇
Phillip Alday
Phillip Alday

💻 🚇
Dave Kleinschmidt
Dave Kleinschmidt

📖
Saket Saurabh
Saket Saurabh

🐛
suddha-bpn
suddha-bpn

🐛
Vladimir Mikheev
Vladimir Mikheev

🐛 📖
carmenamme
carmenamme

📖
Maximilien Van Migem
Maximilien Van Migem

🐛
Till Prölß
Till Prölß

📖 🐛
Leon von Haugwitz
Leon von Haugwitz

🐛
Jordan Deakin
Jordan Deakin

🐛
Sanaz
Sanaz

📖

This project follows the all-contributors specification.

Contributions of any kind welcome!

Citation

For now, please cite

DOI and/or Ehinger & Dimigen

Acknowledgements

This work was initially supported by the Center for Interdisciplinary Research, Bielefeld (ZiF) Cooperation Group "Statistical models for psychological and linguistic data".

Funded by Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) under Germany´s Excellence Strategy – EXC 2075 – 390740016

Similar Projects

Discover other similar projects and AI models.

RepositoryMATLAB
unfoldtoolbox/unfold

A matlab EEG toolbox to perform overlap correction and non-linear & linear regression.

68
May 13, 2025
RepositoryJulia
JuliaAI/MLJ.jl

A Julia machine learning framework

1.9k
Dec 1, 2026
RepositoryJulia
JuliaStats/GLM.jl

Generalized linear models in Julia

637
Sep 19, 2026
RepositoryJulia
JuliaLang/julia

The Julia Programming Language

49.3k
Dec 2, 2026
RepositoryJulia
SciML/DifferentialEquations.jl

Multi-language suite for high-performance solvers of differential equations and scientific machine learning (SciML) components. Ordinary differential equations (ODEs), stochastic differential equations (SDEs), delay differential equations (DDEs), differential-algebraic equations (DAEs), and more in Julia.

3.2k
Oct 17, 2026
RepositoryJulia
MakieOrg/Makie.jl

Interactive data visualizations and plotting in Julia

2.8k
Nov 25, 2026
RepositoryJulia
jump-dev/JuMP.jl

Modeling language for Mathematical Optimization (linear, mixed-integer, conic, semidefinite, nonlinear)

2.5k
Nov 26, 2026
RepositoryJulia
GenieFramework/Genie.jl

🧞The highly productive Julia web framework

2.4k
Oct 15, 2026
RepositoryJulia
JuliaPlots/Plots.jl

Powerful convenience for Julia visualizations and data analysis

2.0k
Nov 27, 2026