UnfoldSim.jl

Simulate EEG / ERP data with overlap, non-linear effects, multiple regression
Author unfoldtoolbox
Popularity
7 Stars
Updated Last
4 Months Ago
Started In
October 2021

logo_UnfoldSim jl_120px

Dev Build Status Coverage DOI

rERP EEG visualisation EEG Simulations BIDS pipeline Decode EEG data Statistical testing

A Julia package to simulate multivariate time series, e.g. model-based ERPs, fMRI activity, pupil dilation etc. UnfoldSim.jl provides multi-channel support via EEG-forward models. Moreover, it is possible to simulate overlapping event-related activity and to add noise of a certain type e.g. Pink noise.

Many tutorials, guides, how-tos and references are available in the documentation!

readme_figure

Install

Julia

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

using Pkg
Pkg.add("UnfoldSim")

Quickstart

using UnfoldSim
data, events = UnfoldSim.predef_eeg(; n_repeats = 1, noiselevel = 0.8)

Produces continuous "EEG" with PinkNoise and some overlap between 20 events (2 conditions * 10 levels of the continuous variable).

Slightly longer

using UnfoldSim
using Random

# Start by defining the design / events data frame
design =
    SingleSubjectDesign(; conditions = Dict(:condA => ["levelA", "levelB"])) |>
    d -> RepeatDesign(d, 10);

# Next define a ground truth signal + relation to events/design with Wilkinson formulas
signal = LinearModelComponent(;
    basis = [0, 0, 0, 0.5, 1, 1, 0.5, 0, 0],
    formula = @formula(0 ~ 1 + condA),
    Ξ² = [1, 0.5],
);
# finally, define some inter-onset distribution and noise, and simulate data!
data, events = simulate(
    Random.MersenneTwister(1),
    design,
    signal,
    UniformOnset(; offset = 5, width = 4),
    PinkNoise(),
);    

All components (design, components, onsets, noise) can be easily modified and you can simply plugin your own!

Contributions

Contributions of any kind are very welcome. Please have a look at CONTRIBUTING.md for guidance on contributing to UnfoldSim.jl.

Contributors

Maanik Marathe
Maanik Marathe

πŸ“– πŸ’»
Benedikt Ehinger
Benedikt Ehinger

πŸ› πŸ’» πŸ“– πŸ€” πŸš‡ 🚧 πŸ‘€ ⚠️ βœ…
Luis
Luis

πŸ› πŸ’» πŸ“– πŸ€”
Judith Schepers
Judith Schepers

πŸ€” πŸ› πŸ“– βœ… πŸ’» ⚠️
Vladimir Mikheev
Vladimir Mikheev

πŸ›
Manpa Barman
Manpa Barman

πŸš‡
RenΓ© Skukies
RenΓ© Skukies

πŸ“–

This project follows the all-contributors specification. Please reach out, if you have contributed to UnfoldSim.jl but we have not listed you as a contributor yet.

Citation

TBA

Acknowledgements

Funded by Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) under GermanyΒ΄s Excellence Strategy – EXC 2075 – 390740016. Furthermore, the authors thank the International Max Planck Research School for Intelligent Systems (IMPRS-IS) for supporting Judith Schepers.