Skip to main content

Python API to easily download stimuli and fMRI betas from Natural Scenes Dataset.

Project description

🧠🏞️ nsdget

PyPI - Version

nsdget: easily download and use the single trial betas 1.8mm and coco images from the Natural Scenes Dataset

Note: I'm not affiliated with Natural Scenes Dataset. I just wanted an easier and quicker way to download the data I needed from them (hence this package).

Shoutout to https://github.com/clane9/NSD-Flat/ since I reused some of the functions from there. Thank you!

Usage

To use the data, please fill out the NSD Data Access Agreement first. Then download the nsdget python package:

Install

uv add nsdget

or

pip install nsdget

Then, to download the betas for all 8 subjects and 73k coco images do

from nsdget import nsd_betas_images_trials, nsd_coco_image, nsd_single_trial_betas

# download and use data
df: pd.DataFrame = nsd_betas_images_trials(save_to="./nsdata/")
betas: np.ndarray = sd_single_trial_betas(df.iloc[0]) # 1.8mm res fmri single trial from NSD for the given row (index 0 here) 
image0: PIL.Image = nsd_coco_image(df.iloc[0]) # crops how NSD did and gives you the PIL image (can easily be converted to numpy too)

Example above ran in example.ipynb.

Note that download happens only once. After the first slow run, subsequent runs will be very fast.

Development

Dev run

uv sync
make run

Deployment PyPi

uv sync
TOKEN=... make publish # insert your PyPi token where ...

References

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

nsdget-0.0.3.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

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

nsdget-0.0.3-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file nsdget-0.0.3.tar.gz.

File metadata

  • Download URL: nsdget-0.0.3.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.3

File hashes

Hashes for nsdget-0.0.3.tar.gz
Algorithm Hash digest
SHA256 2c26d2375e6dcecc41a4a83e08764e78389b90437a4f7aab0c4416b866c914bb
MD5 ef474a000956d6e008cb1ee9dc98d24a
BLAKE2b-256 1cd011596b079b6bd975fd041b3855401e464ea68e08e815c8e173babe299a09

See more details on using hashes here.

File details

Details for the file nsdget-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: nsdget-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.3

File hashes

Hashes for nsdget-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e73eed8907cb616cdb277ccefadf895d318ba5b76f944f83a018946667289a40
MD5 2f025426075f4ab06c8562c2c21e01b7
BLAKE2b-256 08f4dba8e4d41d189fd9ead2566af4b65f14cbe1a53dd3b2f10527cfbe80e1d5

See more details on using hashes here.

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