Skip to main content

Extended and maintained fork of the neurodesign package for fMRI experimental design optimisation

Project description

Neurodesign_Plus

This repository contains a extended version of the Neurodesign Python package. This version extends the original capabilities to allow for more complex and specific experimental conditions, including variable stimuli durations, conditional inter-trial intervals (ITIs), and user-defined stimulus ordering.

Neurodesign Documentation

The documentation of the base package neurodesign is available at ReadTheDocs.

File description

├── docs                    Contains the source code to generate the documentation with sphinx (WIP).
├── manuals                 Contains comprehensive markdown documentation on neurodesign-plus.
└── neurodesign             Folder with the source code of the python package
    └── media               Folder contains the logo of neurodesign, which is used in the reports.
├── tests                   Contains scripts to test modifications to the package.
└── tutorials               Contains .ipynb tutorials on neurodesign-plus, the base functions and the new functions.

Overview of Modifications

The modifications focus on the classes.py file, specifically enhancing the Experiment class to support greater flexibility. The core updates revolve around three key features:

  1. Fixed User Input: The ability to input a specific order and ITI sequence (bypassing randomization to evaluate a pre-determined design).
  2. Varied Stimuli Durations: Support for distribution-based durations rather than a single fixed duration.
  3. Conditional ITIs: Implementation of Inter-trial Intervals that vary based on probability distributions or the relationship between specific stimuli.

Installation & Setup

See link for environment setup and installation instructions.


Original Tool

The Neurodesign package is organized around three core classes: Experiment, Design, and Optimization.

  1. Experiment defines the experiment specification (conditions/stimuli, durations, ITIs, constraints).

  2. Design represents a concrete design instance generated from an experiment (event order + ITIs).

  3. Optimization searches over candidate designs and selects designs based on efficiency metrics.

Metrics

We are looking to optimize experimental design, but what defines good metrics?

The Neurodesign Python package optimizes these experiments based on four metrics:

  1. Fe : Estimation Efficiency

    Measures how well the design allows estimation of response shape and amplitude when events overlap in time. High Fe means the model can separate the contributions of different events cleanly.

  2. Fd : Detection Efficiency

    Measures how well the design supports detecting differences between conditions assuming a fixed canonical HRF. High Fd means convolved regressors for each condition are distinguishable.

  3. Fc: Confounding Efficiency

    Measures how closely the realized number of trials per condition matches the prescribed probabilities (e.g., 50/50). High Fc means the realized proportions match what was specified.

  4. Ff : Frequency Accuracy

    Measures whether the condition sequence is balanced across time and transitions (immediate and longer-range). High Ff means the design reduces serial dependencies and avoids systematic transition biases.

During optimization, you can assign weights to these metrics to reflect what matters most for your experiment.

See link for guidelines on interpreting metrics when optimising designs.


Modifications Documentation

See link for a detailed summary of changes relative to the upstream Neurodesign package.

With these new parameters and changes in the package, it is simply a matter of defining the parameters required for the specific use case and the tool will perform the optimization.

Note that precedence for order follows as (if all provided):

  • Fixed ordering
  • Controlled ordering
  • Random ordering

The same holds for conditional_ITI and stimuli_durations.


Tutorials

Tutorial notebooks / scripts are under tutorials/.

tutorials
├── base_functions                                    Contains tutorials of the different base package functions.
├── new_functions                                     Contains tutorials on using the modifications.
├── tutorial_1_neurodesign_base_overview              Base tutorial of the neurodesign package.
└── tutorial_2_comparing_designs_across_experiments   Tutorial on comparing designs across diverse experiment definitions.

For quick access, find the tutorials in the table below:

# Tutorial Link
1 tutorial_1_neurodesign_base_overview View
2 tutorial_2_comparing_designs_across_experiments View
3 tutorial_base_compare_and_simulate View
4 tutorial_base_comparing_designs View
5 tutorial_base_discovering_best_design View
6 tutorial_base_optimizating_and_report View
7 tutorial_new_controlled_probabalistic_ordering View
8 tutorial_new_fixed_order View
9 tutorial_new_varied_ITI View
10 tutorial_new_varied_stimuli_durations View

Credits

This is a fork of the original Neurodesign package.

  • Original Author: Neuropower Team
  • Primary refactoring, extensions, and tutorials: Atharv Umap (Social Learning and Decisions Lab, UMD)
  • Supervision, design guidance, tutorials: Valentin Guigon (Social Learning and Decisions Lab, UMD)

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

neurodesign_plus-1.0.0.tar.gz (3.3 MB view details)

Uploaded Source

Built Distribution

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

neurodesign_plus-1.0.0-py3-none-any.whl (131.0 kB view details)

Uploaded Python 3

File details

Details for the file neurodesign_plus-1.0.0.tar.gz.

File metadata

  • Download URL: neurodesign_plus-1.0.0.tar.gz
  • Upload date:
  • Size: 3.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for neurodesign_plus-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ed1596163719349f28163874ef93afa0bcb40b3f9e76c0ea7a0787f7b58bf6ca
MD5 a07398045ce546f03f4d3e310ff38eb9
BLAKE2b-256 bc58c4c75d2b687ed3be03dd0991230f58d2c9a923fca1f19d7159e906ce2f66

See more details on using hashes here.

Provenance

The following attestation bundles were made for neurodesign_plus-1.0.0.tar.gz:

Publisher: publish.yml on SLDlab/neurodesign-plus

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

File details

Details for the file neurodesign_plus-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for neurodesign_plus-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4da5f6430811446d992b12ad8e7e8765191d6faa871b277387ed396e6e759adf
MD5 1bf81f799f5470beea5a8a3321c568d4
BLAKE2b-256 a8a3199062a4465917e7a019f7fa89aefd82fea5fdc94b70d528adf700faeb2c

See more details on using hashes here.

Provenance

The following attestation bundles were made for neurodesign_plus-1.0.0-py3-none-any.whl:

Publisher: publish.yml on SLDlab/neurodesign-plus

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