Examples

Examples

Some introduction to the encoding/decoding framework.

Fit the residual covariance matrix

Fit the residual covariance matrix

Stimulus decoding using stimulus mask

Stimulus decoding using stimulus mask

Linear encoding model

Linear encoding model

Create a simple Gaussian Prf encoding model

Create a simple Gaussian Prf encoding model

Invert encoding model

Invert encoding model

Decoding of stimuli from neural data

Decoding of stimuli from neural data

Recontruct a 2D visual stimulus from real fMRI data

Recontruct a 2D visual stimulus from real fMRI data

Fit a 2D PRF model

Fit a 2D PRF model

Fisher information to estimate precision of encoding parameters across stimulus space

Fisher information to estimate precision of encoding parameters across stimulus space

Different flavors of visual population receptive field models

Different flavors of visual population receptive field models

Decoding 2D stimuli from neural data

Decoding 2D stimuli from neural data

End-to-end decoding pipeline on real data

Three connected examples that walk through a full encoding-model decoding pipeline on a small extract of single-trial fMRI data (numerosity task, right numerosity-tuned parietal cortex):

  1. Select responsive voxels from whole-brain R² by fitting a 2-component mixture and picking a threshold (FDR or posterior).

  2. Decode trial-wise stimulus posteriors using a noise model whose covariance is regularised by geodesic distance on the cortical surface.

  3. Quantify expected decoding uncertainty by simulating from the fitted model and re-decoding.

Each example is self-contained but share the same demo dataset, which is downloaded on first run via braincoder.utils.data.load_dehollander2024_npc.

Voxel selection via a 2-component R² mixture model

Voxel selection via a 2-component R² mixture model

Expected decoding uncertainty via simulate + decode

Expected decoding uncertainty via simulate + decode

Geodesic-regularised noise model for trial-wise decoding

Geodesic-regularised noise model for trial-wise decoding

Gallery generated by Sphinx-Gallery