mvpa
mvpa is a multi-voxel pattern analysis tool for fMRI data. Given a subject's fMRI scans for two conditions (e.g. exposure to two different stimuli), this tool can identify distinct patterns of responses for each condition. It's adapted from the method described in Distributed and Overlapping Representations of Faces and Objects in Ventral Temporal Cortex, except searchlight spheres are analyzed instead of anatomical ROIs.
Notably, this tool is less computationally expensive than a SVM-based searchlight.
Installation
mvpa can be installed from PyPi:
$ pip install mvpa
Usage Example
Load the Haxby dataset
import pandas as pd
from nilearn.datasets import fetch_haxby
# We fetch 2nd subject from haxby datasets (which is default)
haxby_dataset = fetch_haxby()
fmri_filename = haxby_dataset.func[0]
labels = pd.read_csv(haxby_dataset.session_target[0], sep=" ")
y, session = labels["labels"], labels["chunks"]
Restrict to faces and houses
from nilearn.image import index_img
face_mask = y.isin(["face"]) # Condition A
house_mask = y.isin(["house"]) # Condition B
face_niimg = index_img(fmri_filename, face_mask)
house_niimg = index_img(fmri_filename, house_mask)
Prepare input data
from nilearn.image import load_img
from mvpa import even_odd_split
face_niimg_even, face_niimg_odd = even_odd_split(face_niimg)
house_niimg_even, house_niimg_odd = even_odd_split(house_niimg)
A = [(face_niimg_even, face_niimg_odd)]
B = [(house_niimg_even, house_niimg_odd)]
mask_img = load_img(haxby_dataset.mask)
Run correlation searchlight
from mvpa import correlation_searchlight, significance_map
score_maps = correlation_searchlight(A, B, mask_img, radius=3)
# t_map, p_map = significance_map(score_maps, mask_img) # Only used for datasets
# with multiple subjects
score_maps is a list of paths to NIfTI files, each representing the significance scores for each voxel in a subject's scan.
Visualize results
from nilearn.image import mean_img
from nilearn.plotting import plot_stat_map
score_map = load_img(score_maps[0])
plot_stat_map(score_map, bg_img=mean_img(fmri_filename), colorbar=True,
display_mode="z")
Metadata
Release files for mvpa 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mvpa-1.0.0.tar.gz | 5.8 kB | Without provenance | Details for mvpa-1.0.0.tar.gz |
Release files / mvpa-1.0.0.tar.gz
| Download URL | mvpa-1.0.0.tar.gz |
|---|---|
| Size | 5.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
41c9df85e3ff8624e7b81ba337ce3c7fe4084245f9bb1ba233abbe91f2632d86
|
|
BLAKE2b-256 checksum How to use checksums |
84ac442b6180f595fcb62b40f897c44e8e2019fe7214b04929d54386624c7d04
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.9.1
|
Security for mvpa 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.