🧠🏞️ nsdget
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
- https://naturalscenesdataset.org/ (Allen, St-Yves, Wu, Breedlove, Prince, Dowdle, Nau, Caron, Pestilli, Charest, Hutchinson, Naselaris*, & Kay*. A massive 7T fMRI dataset to bridge cognitive neuroscience and artificial intelligence. Nature Neuroscience (2021).)
- https://cocodataset.org/#home
- https://github.com/clane9/NSD-Flat/blob/b6851300ea3778eae7e4dbb88a85d71ce18cb9a5/generate_dataset.py#L157
Metadata
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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nsdget-0.0.4.tar.gz | 5.9 kB | Without provenance | Details for nsdget-0.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nsdget-0.0.4-py3-none-any.whl | Python 3 | none | any | Details for nsdget-0.0.4-py3-none-any.whl |
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
|
Security for nsdget 0.0.4
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.