Skip to main content

🧠🏞️ 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

df = nsd_betas_images_trials(save_to="./nsdata/") # 213k trials in a Pandas DataFrame
betas = nsd_single_trial_betas(df.iloc[0]) # first betas trial as Nifty Image 
image = nsd_coco_image(df.iloc[0])  # first trial stimulus as COCO PIL Image

Example above ran in example.ipynb.

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

If you want the betas in numpy, just convert from nibabel image to numpy like

nd_betas = betas.get_fdata() 

If you want the COCO image in numpy just convert the PIL Image to numpy like

nd_image = np.asarray(image)

Development

Dev run

uv sync
make run

Deployment PyPi

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

References

Release files for nsdget 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nsdget 0.0.4
File Size Uploaded
nsdget-0.0.4.tar.gz 5.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nsdget 0.0.4
File Interpreter ABI Platform
nsdget-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 12.6 kB

Release files / nsdget-0.0.4.tar.gz

Download URL nsdget-0.0.4.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e24fb504cc3962eee7af7cf73959222f733f6c51ca4be73484c4eb37f7d91b61
BLAKE2b-256 checksum
How to use checksums
a471a1e45a87cad8176bb3c2e40cbe9796e333d90d5fa62a7185dfcec2029804
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.3

Release files / nsdget-0.0.4-py3-none-any.whl

Download URL nsdget-0.0.4-py3-none-any.whl
Size 6.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3d2c6d45bdced813cdde1e3dcc79d6807428deaffcd94afa2733631ea883b08f
BLAKE2b-256 checksum
How to use checksums
717f453a0c7aff3e0675f3a24a9d6941cf4778243872692336d300ca08a870e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.3

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page