Hello world!
I’m new in python and its package NiMARE, but I’m trying to use it in order to do a meta-analysis using both neurovault and neurosynth databases.
Unfortunately, when I run the function convert_neurovault_to_dataset from io.py the interpreter encounters a key error coming from line 353 of the io script as it does not find the key named “results” in images[].
Runing the function on the example (here) goes well, but I can’t run it on my own IDs.
Here’s my reprex, hoping it’ll help: #Importations
import nimare
from nimare.io import convert_neurovault_to_dataset
Thanks for this very rapid reply.
I ran this on spyder 5.0 and I guess the traceback isn’t full, but here is what I had :
runfile(‘D:\My Path\my script.py’, wdir=‘D:\My Path’)
Traceback (most recent call last):
File “D:\My Path\my script.py”, line 23, in
dset = convert_neurovault_to_dataset(
File “D:\Programmes\Anaconda3\envs\Nouveau\lib\site-packages\nimare\io.py”, line 353, in convert_neurovault_to_dataset
for img_dict in images[“results”]:
KeyError: ‘results’
I’ll edit this post as soon as I can when I’ll run it with jupyter for its tracebacks.
EDIT: Here’s the traceback coming from Jupyter’s notebook
D:\Programmes\Anaconda3\envs\JupytNiMARE\lib\site-packages\nimare\io.py in convert_neurovault_to_dataset(collection_ids, contrasts, img_dir, map_type_conversion, **dset_kwargs)
351
352 sample_sizes = []
→ 353 for img_dict in images[“results”]:
354 if not (
355 re.match(contrast_regex, img_dict[“name”])
Thanks! I was able to reproduce the issue, and the reason was that the collections were not accessible through the URLs that NiMARE generates to get them. I went through each one to check the URLs, and it looks like they couldn’t be found.
Here are the URLs where I’d expect to see the collections:
Oh god, how did I miss it that much?
You really helped me with the URLs where you expected to find the collections: Python was in fact searching for URLs that do not exist because the IDs were the images IDs in the neurovault, not the collections IDs… My fault.
I guess it might mean a great amount of job, but do you expect to make nimare works with the images IDs as well?
In any case: thanks a lot for your job, that’s really great!! And thanks for this very rapid help.