Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: 'bool' object is not iterable #822

Closed
JohannesWiesner opened this issue Aug 9, 2023 · 4 comments
Closed

TypeError: 'bool' object is not iterable #822

JohannesWiesner opened this issue Aug 9, 2023 · 4 comments
Labels
bug Issues noting problems and PRs fixing those problems.

Comments

@JohannesWiesner
Copy link

Summary

When trying to run nimare.extract.fetch_neurosynth("../data", unpack=True) I get:

INFO:nimare.extract.utils:Dataset created in ../data/neurosynth
Traceback (most recent call last):

  File ~/micromamba/envs/csp_wiesner_johannes/lib/python3.8/site-packages/spyder_kernels/py3compat.py:356 in compat_exec
    exec(code, globals, locals)

  File ~/work/projects/project_hcp/code/analysis_neurosynth.py:12
    nimare.extract.fetch_neurosynth("../data", unpack=True)

  File ~/micromamba/envs/csp_wiesner_johannes/lib/python3.8/site-packages/nimare/extract/extract.py:191 in fetch_neurosynth
    found_databases = _fetch_database(kwargs, URL, data_dir, overwrite=overwrite)

  File ~/micromamba/envs/csp_wiesner_johannes/lib/python3.8/site-packages/nimare/extract/extract.py:74 in _fetch_database
    if not _find_entities(coordinates_file, search_pairs, log=log):

  File ~/micromamba/envs/csp_wiesner_johannes/lib/python3.8/site-packages/nimare/extract/extract.py:42 in _find_entities
    search_pairs = [[f"{k}-{v_i}" for v_i in v] for k, v in search_pairs.items()]

  File ~/micromamba/envs/csp_wiesner_johannes/lib/python3.8/site-packages/nimare/extract/extract.py:42 in <listcomp>
    search_pairs = [[f"{k}-{v_i}" for v_i in v] for k, v in search_pairs.items()]

TypeError: 'bool' object is not iterable

Additional details

  • NiMARE version: 0.1.1

What were you trying to do?

Following this code section:

https://neurostars.org/t/is-there-any-way-to-pull-unthresholded-images-from-neurosynth/19431/2?u=johanneswiesner

What did you expect to happen?

Successful download of neurosynth database

What actually happened?

Download failed.

@JohannesWiesner JohannesWiesner added the bug Issues noting problems and PRs fixing those problems. label Aug 9, 2023
@JohannesWiesner
Copy link
Author

I use Ubuntu and installed NiMARE into an exisiting conda environement, but could also be reproduced on a Windows machine with a fresh conda environment (i.e. conda create -n test pip + pip install nimare)

@JohannesWiesner
Copy link
Author

Seems to work though with nimare.extract.fetch_neurosynth(path="."):

INFO:nimare.extract.utils:Dataset created in /home/johannes.wiesner/.nimare/neurosynth
INFO:nimare.extract.extract:Searching for any feature files matching the following criteria: [('path-.', 'data-neurosynth', 'version-7')]
Downloading data-neurosynth_version-7_coordinates.tsv.gz
Downloading data-neurosynth_version-7_metadata.tsv.gz
Downloading data-neurosynth_version-7_vocab-LDA100_keys.tsv
Downloading data-neurosynth_version-7_vocab-LDA100_metadata.json
Downloading data-neurosynth_version-7_vocab-LDA100_source-abstract_type-weight_features.npz
Downloading data-neurosynth_version-7_vocab-LDA100_vocabulary.txt
Downloading data-neurosynth_version-7_vocab-LDA200_keys.tsv
Downloading data-neurosynth_version-7_vocab-LDA200_metadata.json
Downloading data-neurosynth_version-7_vocab-LDA200_source-abstract_type-weight_features.npz
Downloading data-neurosynth_version-7_vocab-LDA200_vocabulary.txt
Downloading data-neurosynth_version-7_vocab-LDA400_keys.tsv
Downloading data-neurosynth_version-7_vocab-LDA400_metadata.json
Downloading data-neurosynth_version-7_vocab-LDA400_source-abstract_type-weight_features.npz
Downloading data-neurosynth_version-7_vocab-LDA400_vocabulary.txt
Downloading data-neurosynth_version-7_vocab-LDA50_keys.tsv
Downloading data-neurosynth_version-7_vocab-LDA50_metadata.json
Downloading data-neurosynth_version-7_vocab-LDA50_source-abstract_type-weight_features.npz
Downloading data-neurosynth_version-7_vocab-LDA50_vocabulary.txt
Downloading data-neurosynth_version-7_vocab-terms_source-abstract_type-tfidf_features.npz
Downloading data-neurosynth_version-7_vocab-terms_vocabulary.txt

I think this is might be a string-parsing bug that appears when you set path to some other string than "."

@JulioAPeraza
Copy link
Collaborator

I think this issue comes from the unpack argument. In that call (nimare.extract.fetch_neurosynth("../data", unpack=True)), the parameter is interpreted as a kwargs and then passed to _fetch_database.

Starting in version 0.0.10 we are using a new format for fetching Neurosynth and NeuroQuery databases. The parameters url and unpack were removed, and we changed the parameter path to data_dir.

You would find an example with the new format here: https://nimare.readthedocs.io/en/stable/auto_examples/01_datasets/02_download_neurosynth.html#download-neurosynth

@jdkent
Copy link
Member

jdkent commented Aug 22, 2023

Closing this issue for now, let us know if we did not answer your question fully and I'll reopen, thanks!

@jdkent jdkent closed this as completed Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues noting problems and PRs fixing those problems.
Projects
None yet
Development

No branches or pull requests

3 participants